{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cem\u003eI know, up on top you are seeing great sights,\u003cbr /\u003e\r\n\tBut down at the bottom, we, too, should have rights.\u003cbr /\u003e\r\n\tWe turtles can\u0026#39;t stand it. Our shells will all crack!\u003cbr /\u003e\r\n\tBesides, we need food. We are starving!\u0026quot; groaned Mack. \u003c/em\u003e\u003c/p\u003e\r\n\u003ch3\u003e\r\n\tThe Problem\u003c/h3\u003e\r\n\u003cp\u003e\r\n\tMack, in an effort to avoid being cracked, has enlisted your advice as to the order in which turtles should be dispatched to form Yertle\u0026#39;s throne. Each of the five thousand, six hundred and seven turtles ordered by Yertle has a different weight and strength. Your task is to build the largest stack of turtles possible.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tStandard input consists of several lines, each containing a pair of integers separated by one or more space characters, specifying the weight and strength of a turtle. The weight of the turtle is in grams. The strength, also in grams, is the turtle\u0026#39;s overall carrying capacity, including its own weight. That is, a turtle weighing 300g with a strength of 1000g could carry 700g of turtles on its back. There are at most 5,607 turtles.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tYour output is a single integer indicating the maximum number of turtles that can be stacked without exceeding the strength of any one.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e300 1000\r\n1000 1200\r\n200 600\r\n100 101\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e3\u003c/pre\u003e"}}]}