{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eBessie has gone to the mall\u0027s jewelry store and spies a charm bracelet. Of course, she\u0027d like to fill it with the best charms possible from the \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 3,402) available charms. Each charm \u003ci\u003ei\u003c/i\u003e in the supplied list has a weight \u003ci\u003eW\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003eW\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 400), a \u0027desirability\u0027 factor \u003ci\u003eD\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003eD\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 100), and can be used at most once. Bessie can only support a charm bracelet whose weight is no more than \u003ci\u003eM\u003c/i\u003e (1 ≤ \u003ci\u003eM\u003c/i\u003e ≤ 12,880).\u003c/p\u003e\u003cp\u003eGiven that weight limit as a constraint and a list of the charms with their weights and desirability rating, deduce the maximum possible sum of ratings.\u003c/p\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e* Line 1: Two space-separated integers: \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eM\u003c/i\u003e\u003cbr\u003e* Lines 2..\u003ci\u003eN\u003c/i\u003e+1: Line \u003ci\u003ei\u003c/i\u003e+1 describes charm \u003ci\u003ei\u003c/i\u003e with two space-separated integers: \u003ci\u003eW\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e and \u003ci\u003eD\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e* Line 1: A single integer that is the greatest sum of charm desirabilities that can be achieved given the weight constraints\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 6\r\n1 4\r\n2 6\r\n3 12\r\n2 7\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e23\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}