{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s829715321", "group_id": "codeNet:p02550", "input_text": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, k, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n for i := 0 to 100000 do\n begin\n a[i] := 0;\n b[i] := 0;\n end;\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[integer(x)] := 1;\n for i := 2 to integer(m) do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n k := integer(x);\n if b[k] > 0 then\n begin\n offset := b[k] - 1;\n period := i - offset - 1;\n break;\n end;\n b[k] := i;\n end;\n num := (n - offset) div period;\n rem := integer(n - offset - num * period);\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "language": "Pascal", "metadata": {"date": 1600569004, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Pascal/s829715321.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s829715321", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, k, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n for i := 0 to 100000 do\n begin\n a[i] := 0;\n b[i] := 0;\n end;\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[integer(x)] := 1;\n for i := 2 to integer(m) do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n k := integer(x);\n if b[k] > 0 then\n begin\n offset := b[k] - 1;\n period := i - offset - 1;\n break;\n end;\n b[k] := i;\n end;\n num := (n - offset) div period;\n rem := integer(n - offset - num * period);\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 809, "cpu_time_ms": 5, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s298759827", "group_id": "codeNet:p02550", "input_text": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[x] := 1;\n for i := 2 to m do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n if b[x] > 0 then\n begin\n offset := b[x] - 1;\n period := i - offset - 1;\n break;\n end;\n b[x] := i;\n end;\n num := (n - offset) div period;\n rem := n - offset - num * period;\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "language": "Pascal", "metadata": {"date": 1600568708, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Pascal/s298759827.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s298759827", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[x] := 1;\n for i := 2 to m do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n if b[x] > 0 then\n begin\n offset := b[x] - 1;\n period := i - offset - 1;\n break;\n end;\n b[x] := i;\n end;\n num := (n - offset) div period;\n rem := n - offset - num * period;\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 687, "cpu_time_ms": 8, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s000077794", "group_id": "codeNet:p02552", "input_text": "program test;\n{$mode objfpc}{$H+}{$R+}{$S+}\nUses sysutils;\nvar\n\tx\t\t:integer;\nbegin\n readln(x);\n if (x=0) then writeln(stdout,1)\n else writeln(stdout,0);\nend.", "language": "Pascal", "metadata": {"date": 1600023848, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Pascal/s000077794.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s000077794", "user_id": "u705827623"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program test;\n{$mode objfpc}{$H+}{$R+}{$S+}\nUses sysutils;\nvar\n\tx\t\t:integer;\nbegin\n readln(x);\n if (x=0) then writeln(stdout,1)\n else writeln(stdout,0);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s206877287", "group_id": "codeNet:p02553", "input_text": "var a,b,c,d,ll,lr,rl,rr,tmp:int64;\nbegin\nreadln(a,b,c,d);\nll:=a*c;\nrl:=b*d;\nlr:=a*d;\nrr:=b*d;\ntmp:=-1000000000 * 1000000000;\nif(ll>=tmp)then tmp:=ll;\nif(rl>=tmp)then tmp:=rl;\nif(lr>=tmp)then tmp:=lr;\nif(rr>=tmp)then tmp:=rr;\nwriteln(tmp);\nend.", "language": "Pascal", "metadata": {"date": 1600502190, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s206877287.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s206877287", "user_id": "u984276646"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a,b,c,d,ll,lr,rl,rr,tmp:int64;\nbegin\nreadln(a,b,c,d);\nll:=a*c;\nrl:=b*d;\nlr:=a*d;\nrr:=b*d;\ntmp:=-1000000000 * 1000000000;\nif(ll>=tmp)then tmp:=ll;\nif(rl>=tmp)then tmp:=rl;\nif(lr>=tmp)then tmp:=lr;\nif(rr>=tmp)then tmp:=rr;\nwriteln(tmp);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s497033365", "group_id": "codeNet:p02553", "input_text": "var a,b,c,d,s:int64;\nbegin\nread(a,b,c,d);\ns:=a*c;\nif s 0) AND (c > 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\nend;\n \nIF (b < 0) AND (d < 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n \nIF (a < 0) AND (c < 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\n exit;\nend;\n \nIF (b < 0) AND (d > 0) THEN\nbegin\n\tx:= max(a,b) * min(c,d);\n writeln(x);\n exit;\nend;\n\nIF (b > 0) AND (d < 0) THEN\nbegin\n\tx:= min(a,b) * max(c,d);\n writeln(x);\n exit;\nend;\n \nend.", "language": "Pascal", "metadata": {"date": 1600029294, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s305676624.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s305676624", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses\nsysutils, math;\n \n \nvar\na,b,c,d,x,t1,t2: integer;\n \nbegin\n \nread (a);\nread (b);\nread(c);\nread(d);\n \nIF (b = 0) AND (c = 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n \nIF (a > 0) AND (c > 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\nend;\n \nIF (b < 0) AND (d < 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n \nIF (a < 0) AND (c < 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\n exit;\nend;\n \nIF (b < 0) AND (d > 0) THEN\nbegin\n\tx:= max(a,b) * min(c,d);\n writeln(x);\n exit;\nend;\n\nIF (b > 0) AND (d < 0) THEN\nbegin\n\tx:= min(a,b) * max(c,d);\n writeln(x);\n exit;\nend;\n \nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 600, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s654182573", "group_id": "codeNet:p02553", "input_text": "uses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c > 0) AND (d > 0) THEN//if all positive\nbegin\n\tx:= max(a,b) * max(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= min(a,b) * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\nend.", "language": "Pascal", "metadata": {"date": 1600028166, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s654182573.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s654182573", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c > 0) AND (d > 0) THEN//if all positive\nbegin\n\tx:= max(a,b) * max(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= min(a,b) * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 884, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s804409839", "group_id": "codeNet:p02553", "input_text": "Program AtCoderBeginnerContest178;\n\nuses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c > 0) AND (d > 0) THEN//if all positive\nbegin\n\tx:= max(a,b) * max(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= min(a,b) * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\n\n\n\n//program 1\n\n{readln(x);\n\nIF (x = 0) THEN\n\nbegin\n\twriteln('1');\nend;\n\nIF (x = 1) THEN\n\nbegin\n\twriteln('0');\nend;}\n\nend.\n", "language": "Pascal", "metadata": {"date": 1600026972, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s804409839.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s804409839", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Program AtCoderBeginnerContest178;\n\nuses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c > 0) AND (d > 0) THEN//if all positive\nbegin\n\tx:= max(a,b) * max(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= min(a,b) * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\n\n\n\n//program 1\n\n{readln(x);\n\nIF (x = 0) THEN\n\nbegin\n\twriteln('1');\nend;\n\nIF (x = 1) THEN\n\nbegin\n\twriteln('0');\nend;}\n\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1039, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s240883038", "group_id": "codeNet:p02553", "input_text": "uses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c > 0) AND (d > 0) THEN//if all positive\nbegin\n\tx:= max(a,b) * max(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= min(a,b) * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\nend.", "language": "Pascal", "metadata": {"date": 1600026913, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s240883038.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s240883038", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c > 0) AND (d > 0) THEN//if all positive\nbegin\n\tx:= max(a,b) * max(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= min(a,b) * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 884, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s305513667", "group_id": "codeNet:p02553", "input_text": "var\n\na,b,c,d,x:longint;\ns:string;\nr:real;\n\n\n\nbegin\n\nreadln(a);\nreadln(b);\nreadln(c);\nreadln(d);\n\nx:= b * d;\n\nwriteln(x);\n\nend.", "language": "Pascal", "metadata": {"date": 1600024074, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s305513667.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s305513667", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\na,b,c,d,x:longint;\ns:string;\nr:real;\n\n\n\nbegin\n\nreadln(a);\nreadln(b);\nreadln(c);\nreadln(d);\n\nx:= b * d;\n\nwriteln(x);\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 6, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s368155142", "group_id": "codeNet:p02553", "input_text": "var\n\na,b,c,d,x:integer;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nreadln(d);\n\nx:= b * d;\n\nwriteln(x);\n\nend.", "language": "Pascal", "metadata": {"date": 1600023966, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s368155142.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s368155142", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\na,b,c,d,x:integer;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nreadln(d);\n\nx:= b * d;\n\nwriteln(x);\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 120, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s683534092", "group_id": "codeNet:p02556", "input_text": "var\nx,y,a,b,n:integer;\n\n\nbegin\n\n//mod 1000000007;\n\nreadln(n);\n\nread(x);\nreadln(y);\n\nread(a);\nreadln(b);\n\nx:= (x-a) + (y-b);\nwriteln(x);\n\nend.", "language": "Pascal", "metadata": {"date": 1600027318, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02556.html", "problem_id": "p02556", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02556/input.txt", "sample_output_relpath": "derived/input_output/data/p02556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02556/Pascal/s683534092.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s683534092", "user_id": "u655825084"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\nx,y,a,b,n:integer;\n\n\nbegin\n\n//mod 1000000007;\n\nreadln(n);\n\nread(x);\nreadln(y);\n\nread(a);\nreadln(b);\n\nx:= (x-a) + (y-b);\nwriteln(x);\n\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "sample_input": "3\n1 1\n2 4\n3 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02556", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 4, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s504186228", "group_id": "codeNet:p02582", "input_text": "program bt;\n\nvar s:string;\n t:byte;\n \nbegin\n readln(s);\n t:=0;\n if (pos('R',S)<>0) then t:=1;\n if (pos('RR',S)<>0) then t:=2;\n if (pos('RRR',S)<>0) then t:=3;\n write(t);\nend.", "language": "Pascal", "metadata": {"date": 1597518516, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Pascal/s504186228.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504186228", "user_id": "u824872487"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program bt;\n\nvar s:string;\n t:byte;\n \nbegin\n readln(s);\n t:=0;\n if (pos('R',S)<>0) then t:=1;\n if (pos('RR',S)<>0) then t:=2;\n if (pos('RRR',S)<>0) then t:=3;\n write(t);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 6, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s985296988", "group_id": "codeNet:p02583", "input_text": "program bt;\n\nvar i,j,k,n,t:longint;\n a :array[1..1000000] of longint;\n\nbegin \n readln(n);\n for i:=1 to n-1 do\n read(a[i]);\n readln(a[n]);\n t:=0;\n for i:=1 to n-2 do\n for j:=2 to n-1 do\n for k:=3 to n do\n if (a[i]+a[j]>a[k]) and (a[i]+a[k]>a[j]) and (a[j]+a[k]>a[i]) and (a[i]<>a[j]) and (a[j]<>a[k]) and (a[i]<>a[k]) then\n inc(t);\n write(t);\nend.\n ", "language": "Pascal", "metadata": {"date": 1597519110, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02583.html", "problem_id": "p02583", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02583/input.txt", "sample_output_relpath": "derived/input_output/data/p02583/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02583/Pascal/s985296988.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s985296988", "user_id": "u824872487"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program bt;\n\nvar i,j,k,n,t:longint;\n a :array[1..1000000] of longint;\n\nbegin \n readln(n);\n for i:=1 to n-1 do\n read(a[i]);\n readln(a[n]);\n t:=0;\n for i:=1 to n-2 do\n for j:=2 to n-1 do\n for k:=3 to n do\n if (a[i]+a[j]>a[k]) and (a[i]+a[k]>a[j]) and (a[j]+a[k]>a[i]) and (a[i]<>a[j]) and (a[j]<>a[k]) and (a[i]<>a[k]) then\n inc(t);\n write(t);\nend.\n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have sticks numbered 1, \\cdots, N. The length of Stick i (1 \\leq i \\leq N) is L_i.\n\nIn how many ways can we choose three of the sticks with different lengths that can form a triangle?\n\nThat is, find the number of triples of integers (i, j, k) (1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nL_i, L_j, and L_k are all different.\n\nThere exists a triangle whose sides have lengths L_i, L_j, and L_k.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 \\cdots L_N\n\nOutput\n\nPrint the number of ways to choose three of the sticks with different lengths that can form a triangle.\n\nSample Input 1\n\n5\n4 4 9 7 5\n\nSample Output 1\n\n5\n\nThe following five triples (i, j, k) satisfy the conditions: (1, 3, 4), (1, 4, 5), (2, 3, 4), (2, 4, 5), and (3, 4, 5).\n\nSample Input 2\n\n6\n4 5 4 3 3 5\n\nSample Output 2\n\n8\n\nWe have two sticks for each of the lengths 3, 4, and 5. To satisfy the first condition, we have to choose one from each length.\n\nThere is a triangle whose sides have lengths 3, 4, and 5, so we have 2 ^ 3 = 8 triples (i, j, k) that satisfy the conditions.\n\nSample Input 3\n\n10\n9 4 6 1 9 6 10 6 6 8\n\nSample Output 3\n\n39\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\n0\n\nNo triple (i, j, k) satisfies 1 \\leq i < j < k \\leq N, so we should print 0.", "sample_input": "5\n4 4 9 7 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02583", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have sticks numbered 1, \\cdots, N. The length of Stick i (1 \\leq i \\leq N) is L_i.\n\nIn how many ways can we choose three of the sticks with different lengths that can form a triangle?\n\nThat is, find the number of triples of integers (i, j, k) (1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nL_i, L_j, and L_k are all different.\n\nThere exists a triangle whose sides have lengths L_i, L_j, and L_k.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 \\cdots L_N\n\nOutput\n\nPrint the number of ways to choose three of the sticks with different lengths that can form a triangle.\n\nSample Input 1\n\n5\n4 4 9 7 5\n\nSample Output 1\n\n5\n\nThe following five triples (i, j, k) satisfy the conditions: (1, 3, 4), (1, 4, 5), (2, 3, 4), (2, 4, 5), and (3, 4, 5).\n\nSample Input 2\n\n6\n4 5 4 3 3 5\n\nSample Output 2\n\n8\n\nWe have two sticks for each of the lengths 3, 4, and 5. To satisfy the first condition, we have to choose one from each length.\n\nThere is a triangle whose sides have lengths 3, 4, and 5, so we have 2 ^ 3 = 8 triples (i, j, k) that satisfy the conditions.\n\nSample Input 3\n\n10\n9 4 6 1 9 6 10 6 6 8\n\nSample Output 3\n\n39\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\n0\n\nNo triple (i, j, k) satisfies 1 \\leq i < j < k \\leq N, so we should print 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 397, "cpu_time_ms": 14, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s917358739", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597205355, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s917358739.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s917358739", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 5, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s666336525", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597205349, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s666336525.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s666336525", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 3, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s969295245", "group_id": "codeNet:p02594", "input_text": "program main(input, output);\nvar\n x : integer;\nbegin\n readln(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597204451, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s969295245.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s969295245", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program main(input, output);\nvar\n x : integer;\nbegin\n readln(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s630175103", "group_id": "codeNet:p02594", "input_text": "program main(input, output);\nvar\n x : integer;\nbegin\n readln(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597204390, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s630175103.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s630175103", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program main(input, output);\nvar\n x : integer;\nbegin\n readln(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s519673456", "group_id": "codeNet:p02594", "input_text": "program main(input, output);\nvar\n x : integer;\nbegin\n readln(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597204308, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s519673456.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s519673456", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program main(input, output);\nvar\n x : integer;\nbegin\n readln(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s706808660", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596756699, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s706808660.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s706808660", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 9, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s982501668", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596462476, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s982501668.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s982501668", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 4, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s560585955", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596433731, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s560585955.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s560585955", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s188653678", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596433494, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s188653678.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s188653678", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s763580867", "group_id": "codeNet:p02595", "input_text": "var N,i,c:Longint;\nD,x,y:int64;\nbegin\nread(N,D);\nD:=D*D;\nfor i:=1 to N do begin\nread(x,y);\nif x*x+y*y<=D then inc(c);\nend;\nwriteln(c);\nend.", "language": "Pascal", "metadata": {"date": 1596433711, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Pascal/s763580867.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s763580867", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var N,i,c:Longint;\nD,x,y:int64;\nbegin\nread(N,D);\nD:=D*D;\nfor i:=1 to N do begin\nread(x,y);\nif x*x+y*y<=D then inc(c);\nend;\nwriteln(c);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 139, "cpu_time_ms": 59, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s021658037", "group_id": "codeNet:p02600", "input_text": "var x:int64;begin read(x);writeln(8-((x-400)div 200));end.", "language": "Pascal", "metadata": {"date": 1597192098, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s021658037.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s021658037", "user_id": "u984276646"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var x:int64;begin read(x);writeln(8-((x-400)div 200));end.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 58, "cpu_time_ms": 5, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s509154192", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733321, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s509154192.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s509154192", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s874471074", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733173, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s874471074.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874471074", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 4, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s388958262", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595732984, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s388958262.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s388958262", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 5, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s321050073", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595732818, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s321050073.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s321050073", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 6, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s706918830", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595732655, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s706918830.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s706918830", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 6, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s602933551", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595732643, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s602933551.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s602933551", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s385849219", "group_id": "codeNet:p02600", "input_text": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1599) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595729056, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s385849219.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s385849219", "user_id": "u824872487"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1599) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\n readln;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 6, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s363075298", "group_id": "codeNet:p02600", "input_text": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1399) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595729045, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s363075298.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s363075298", "user_id": "u840460038"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1399) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\n readln;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s762141387", "group_id": "codeNet:p02600", "input_text": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1399) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\nend.", "language": "Pascal", "metadata": {"date": 1595728110, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s762141387.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s762141387", "user_id": "u824872487"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1399) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 418, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s496170714", "group_id": "codeNet:p02600", "input_text": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1399) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595727515, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s496170714.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s496170714", "user_id": "u824872487"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program bt;\n\nvar x,a:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then a:=8 else\n if (x>=600) and (x<=799) then a:=7 else\n if (x>=800) and (x<=999) then a:=6 else\n if (x>=1000) and (x<=1199) then a:=5 else\n if (x>=1200) and (x<=1399) then a:=4 else\n if (x>=1400) and (x<=1399) then a:=3 else\n if (x>=1600) and (x<=1799) then a:=2 else\n if (x>=1800) and (x<=1999) then a:=1;\n write(a);\n readln;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s386010333", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733559, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s386010333.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s386010333", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s920116761", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733323, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s920116761.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s920116761", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 4, "memory_kb": 1332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s467900005", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733174, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s467900005.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s467900005", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 6, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s059385266", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733052, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s059385266.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s059385266", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s267841478", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733004, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s267841478.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s267841478", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s194564319", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595732986, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s194564319.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s194564319", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 6, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s502357964", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1595732828, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s502357964.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s502357964", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 6, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s972383774", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1595732819, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s972383774.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s972383774", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s559694839", "group_id": "codeNet:p02602", "input_text": "program bt;\n\nvar n,k,i,j:longint;\n a,t :array[1..1000000] of int64;\n\nbegin\n readln(n,k);\n for i:=1 to n-1 do\n read(a[i]);\n readln(a[n]);\n for i:=1 to n-k+1 do\n begin\n t[i]:=1;\n for j:=1 to k do\n t[i]:=t[i]*a[i+j-1];\n end;\n for i:=2 to n-k+1 do\n if (t[i]>t[i-1]) then writeln('Yes') else writeln('No');\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595730332, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02602.html", "problem_id": "p02602", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02602/input.txt", "sample_output_relpath": "derived/input_output/data/p02602/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02602/Pascal/s559694839.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s559694839", "user_id": "u824872487"}, "prompt_components": {"gold_output": "Yes\nNo\n", "input_to_evaluate": "program bt;\n\nvar n,k,i,j:longint;\n a,t :array[1..1000000] of int64;\n\nbegin\n readln(n,k);\n for i:=1 to n-1 do\n read(a[i]);\n readln(a[n]);\n for i:=1 to n-k+1 do\n begin\n t[i]:=1;\n for j:=1 to k do\n t[i]:=t[i]*a[i+j-1];\n end;\n for i:=2 to n-k+1 do\n if (t[i]>t[i-1]) then writeln('Yes') else writeln('No');\n readln;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\n\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\nFor the first through (K-1)-th terms: not given.\n\nFor each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.\n\nM-kun scored A_i in the exam at the end of the i-th term.\n\nFor each i such that K+1 \\leq i \\leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq K \\leq N-1\n\n1 \\leq A_i \\leq 10^{9}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 A_3 \\ldots A_N\n\nOutput\n\nPrint the answer in N-K lines.\n\nThe i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.\n\nSample Input 1\n\n5 3\n96 98 95 100 20\n\nSample Output 1\n\nYes\nNo\n\nHis grade for each term is computed as follows:\n\n3-rd term: (96 \\times 98 \\times 95) = 893760\n\n4-th term: (98 \\times 95 \\times 100) = 931000\n\n5-th term: (95 \\times 100 \\times 20) = 190000\n\nSample Input 2\n\n3 2\n1001 869120 1001\n\nSample Output 2\n\nNo\n\nNote that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.\n\nSample Input 3\n\n15 7\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9\n\nSample Output 3\n\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes", "sample_input": "5 3\n96 98 95 100 20\n"}, "reference_outputs": ["Yes\nNo\n"], "source_document_id": "p02602", "source_text": "Score: 300 points\n\nProblem Statement\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\n\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\nFor the first through (K-1)-th terms: not given.\n\nFor each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.\n\nM-kun scored A_i in the exam at the end of the i-th term.\n\nFor each i such that K+1 \\leq i \\leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq K \\leq N-1\n\n1 \\leq A_i \\leq 10^{9}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 A_3 \\ldots A_N\n\nOutput\n\nPrint the answer in N-K lines.\n\nThe i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.\n\nSample Input 1\n\n5 3\n96 98 95 100 20\n\nSample Output 1\n\nYes\nNo\n\nHis grade for each term is computed as follows:\n\n3-rd term: (96 \\times 98 \\times 95) = 893760\n\n4-th term: (98 \\times 95 \\times 100) = 931000\n\n5-th term: (95 \\times 100 \\times 20) = 190000\n\nSample Input 2\n\n3 2\n1001 869120 1001\n\nSample Output 2\n\nNo\n\nNote that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.\n\nSample Input 3\n\n15 7\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9\n\nSample Output 3\n\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 363, "cpu_time_ms": 2205, "memory_kb": 4028}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s269578965", "group_id": "codeNet:p02603", "input_text": "var\n\tN,i:Longint;\n\tp,A,T:int64;\nbegin\n\tread(N,p);\n\tT:=1000;\n\tfor i:=2 to N do begin\n\t\tread(A);\n\t\tif p=1) or (input<=10) then \nwriteln (input+input*input+input*input*input);\nend.", "language": "Pascal", "metadata": {"date": 1594313269, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02621.html", "problem_id": "p02621", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02621/input.txt", "sample_output_relpath": "derived/input_output/data/p02621/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02621/Pascal/s429535413.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s429535413", "user_id": "u746789001"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main;\nvar input : integer;\nbegin\nreadln (input);\nif (input>=1) or (input<=10) then \nwriteln (input+input*input+input*input*input);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02621", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s847906527", "group_id": "codeNet:p02621", "input_text": "program main ;\nvar a: integer;\n\nbegin \nreadln(a);\nif (a>=1) and (a<=10) then\n begin\n writeln(a+a*a+a*a*a);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1594313140, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02621.html", "problem_id": "p02621", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02621/input.txt", "sample_output_relpath": "derived/input_output/data/p02621/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02621/Pascal/s847906527.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s847906527", "user_id": "u880893396"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main ;\nvar a: integer;\n\nbegin \nreadln(a);\nif (a>=1) and (a<=10) then\n begin\n writeln(a+a*a+a*a*a);\n end;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02621", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 1, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s678625182", "group_id": "codeNet:p02622", "input_text": "program main;\nvar a, b : string;\n n,i : integer;\nbegin\n n := 0;\n readln(a);\n readln(b);\n for i := 1 to length(a) do \n if a[i] <> b[i] then \n inc(n);\n writeln(n);\nend.", "language": "Pascal", "metadata": {"date": 1597085042, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Pascal/s678625182.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s678625182", "user_id": "u743163683"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main;\nvar a, b : string;\n n,i : integer;\nbegin\n n := 0;\n readln(a);\n readln(b);\n for i := 1 to length(a) do \n if a[i] <> b[i] then \n inc(n);\n writeln(n);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 202, "cpu_time_ms": 11, "memory_kb": 1296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s382883782", "group_id": "codeNet:p02622", "input_text": "program main;\nvar\n\ts1, s2 : string;\n count, len, i : integer;\n\n\nbegin\n count := 0;\n\treadln(s1);\n readln(s2);\n \n len := length(s1);\n for i := 1 to len do begin\n \tif s1[i] <> s2[i]\n \tthen count := count + 1;\n end;\n\twriteln(count);\nend.\n ", "language": "Pascal", "metadata": {"date": 1595356173, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Pascal/s382883782.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s382883782", "user_id": "u522723337"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main;\nvar\n\ts1, s2 : string;\n count, len, i : integer;\n\n\nbegin\n count := 0;\n\treadln(s1);\n readln(s2);\n \n len := length(s1);\n for i := 1 to len do begin\n \tif s1[i] <> s2[i]\n \tthen count := count + 1;\n end;\n\twriteln(count);\nend.\n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 269, "cpu_time_ms": 12, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s889359623", "group_id": "codeNet:p02622", "input_text": "program main;\nvar\n input1, input2:string;\n i, diff, len: integer;\nbegin\n\treadln(input1);\n readln(input2);\n diff := 0;\n for i:= 1 to length(input1) do begin\n if(input1[i] <> input2[i]) then\n diff := diff + 1;\n end;\n writeln(diff);\nend.", "language": "Pascal", "metadata": {"date": 1594304224, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Pascal/s889359623.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s889359623", "user_id": "u172444704"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main;\nvar\n input1, input2:string;\n i, diff, len: integer;\nbegin\n\treadln(input1);\n readln(input2);\n diff := 0;\n for i:= 1 to length(input1) do begin\n if(input1[i] <> input2[i]) then\n diff := diff + 1;\n end;\n writeln(diff);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 272, "cpu_time_ms": 8, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s210701803", "group_id": "codeNet:p02626", "input_text": "var\n n : integer;\n a, b, x, val, y, z, k, res: int64;\n label ending;\n\nbegin\n read(n);\n read(a, b);\n n := n - 2;\n while n <> 0 do begin\n n := n - 1;\n read(val);\n x := x xor val;\n end;\n y := a + b - x;\n z := y shr 1;\n if (y < 0) or ((y and 1) <> 0) or ((x and z) <> 0) or (a < z) then\n begin\n writeln('-1');\n goto ending;\n end;\n res := z;\n k := 1 shl 40; \n while k <> 0 do begin\n if (x and k) <> 0 then begin\n if (res or k) <= a then begin\n res := res or k;\n end;\n end;\n k := k shr 1;\n end;\n res := a - res;\n if res = 0 then writeln('-1') else writeln(res);\n ending:\nend.", "language": "Pascal", "metadata": {"date": 1593390944, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02626.html", "problem_id": "p02626", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02626/input.txt", "sample_output_relpath": "derived/input_output/data/p02626/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02626/Pascal/s210701803.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s210701803", "user_id": "u394853232"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n : integer;\n a, b, x, val, y, z, k, res: int64;\n label ending;\n\nbegin\n read(n);\n read(a, b);\n n := n - 2;\n while n <> 0 do begin\n n := n - 1;\n read(val);\n x := x xor val;\n end;\n y := a + b - x;\n z := y shr 1;\n if (y < 0) or ((y and 1) <> 0) or ((x and z) <> 0) or (a < z) then\n begin\n writeln('-1');\n goto ending;\n end;\n res := z;\n k := 1 shl 40; \n while k <> 0 do begin\n if (x and k) <> 0 then begin\n if (res or k) <= a then begin\n res := res or k;\n end;\n end;\n k := k shr 1;\n end;\n res := a - res;\n if res = 0 then writeln('-1') else writeln(res);\n ending:\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N piles of stones. The i-th pile has A_i stones.\n\nAoki and Takahashi are about to use them to play the following game:\n\nStarting with Aoki, the two players alternately do the following operation:\n\nOperation: Choose one pile of stones, and remove one or more stones from it.\n\nWhen a player is unable to do the operation, he loses, and the other player wins.\n\nWhen the two players play optimally, there are two possibilities in this game: the player who moves first always wins, or the player who moves second always wins, only depending on the initial number of stones in each pile.\n\nIn such a situation, Takahashi, the second player to act, is trying to guarantee his win by moving at least zero and at most (A_1 - 1) stones from the 1-st pile to the 2-nd pile before the game begins.\n\nIf this is possible, print the minimum number of stones to move to guarantee his victory; otherwise, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 300\n\n1 \\leq A_i \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum number of stones to move to guarantee Takahashi's win; otherwise, print -1 instead.\n\nSample Input 1\n\n2\n5 3\n\nSample Output 1\n\n1\n\nWithout moving stones, if Aoki first removes 2 stones from the 1-st pile, Takahashi cannot win in any way.\n\nIf Takahashi moves 1 stone from the 1-st pile to the 2-nd before the game begins so that both piles have 4 stones, Takahashi can always win by properly choosing his actions.\n\nSample Input 2\n\n2\n3 5\n\nSample Output 2\n\n-1\n\nIt is not allowed to move stones from the 2-nd pile to the 1-st.\n\nSample Input 3\n\n3\n1 1 2\n\nSample Output 3\n\n-1\n\nIt is not allowed to move all stones from the 1-st pile.\n\nSample Input 4\n\n8\n10 9 8 7 6 5 4 3\n\nSample Output 4\n\n3\n\nSample Input 5\n\n3\n4294967297 8589934593 12884901890\n\nSample Output 5\n\n1\n\nWatch out for overflows.", "sample_input": "2\n5 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02626", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N piles of stones. The i-th pile has A_i stones.\n\nAoki and Takahashi are about to use them to play the following game:\n\nStarting with Aoki, the two players alternately do the following operation:\n\nOperation: Choose one pile of stones, and remove one or more stones from it.\n\nWhen a player is unable to do the operation, he loses, and the other player wins.\n\nWhen the two players play optimally, there are two possibilities in this game: the player who moves first always wins, or the player who moves second always wins, only depending on the initial number of stones in each pile.\n\nIn such a situation, Takahashi, the second player to act, is trying to guarantee his win by moving at least zero and at most (A_1 - 1) stones from the 1-st pile to the 2-nd pile before the game begins.\n\nIf this is possible, print the minimum number of stones to move to guarantee his victory; otherwise, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 300\n\n1 \\leq A_i \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum number of stones to move to guarantee Takahashi's win; otherwise, print -1 instead.\n\nSample Input 1\n\n2\n5 3\n\nSample Output 1\n\n1\n\nWithout moving stones, if Aoki first removes 2 stones from the 1-st pile, Takahashi cannot win in any way.\n\nIf Takahashi moves 1 stone from the 1-st pile to the 2-nd before the game begins so that both piles have 4 stones, Takahashi can always win by properly choosing his actions.\n\nSample Input 2\n\n2\n3 5\n\nSample Output 2\n\n-1\n\nIt is not allowed to move stones from the 2-nd pile to the 1-st.\n\nSample Input 3\n\n3\n1 1 2\n\nSample Output 3\n\n-1\n\nIt is not allowed to move all stones from the 1-st pile.\n\nSample Input 4\n\n8\n10 9 8 7 6 5 4 3\n\nSample Output 4\n\n3\n\nSample Input 5\n\n3\n4294967297 8589934593 12884901890\n\nSample Output 5\n\n1\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s539956331", "group_id": "codeNet:p02627", "input_text": "program main;\nvar i : char;\nbegin \n readln(i);\n if (ord(i) >= 97) and (ord(i) <= 122) then writeln('a');\n if (ord(i) >= 65) and (ord(i) <= 90) then writeln('A');\nend.", "language": "Pascal", "metadata": {"date": 1598114197, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s539956331.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s539956331", "user_id": "u289438802"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar i : char;\nbegin \n readln(i);\n if (ord(i) >= 97) and (ord(i) <= 122) then writeln('a');\n if (ord(i) >= 65) and (ord(i) <= 90) then writeln('A');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s878800945", "group_id": "codeNet:p02627", "input_text": "program main;\nvar c : char;\n\nbegin\n readln(c);\n if c in ['a'..'z'] then\n writeln('a')\n else if c in ['A'..'Z'] then\n writeln('A');\nend.", "language": "Pascal", "metadata": {"date": 1596437654, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s878800945.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s878800945", "user_id": "u122156580"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar c : char;\n\nbegin\n readln(c);\n if c in ['a'..'z'] then\n writeln('a')\n else if c in ['A'..'Z'] then\n writeln('A');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 146, "cpu_time_ms": 5, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s354133739", "group_id": "codeNet:p02627", "input_text": "program main;\nvar\n c : char;\nbegin\n readln(c);\n if (c >= 'a') and (c <= 'z')\n then writeln('a');\n if (c >= 'A') and (c <= 'Z')\n then writeln('A');\nend.\n", "language": "Pascal", "metadata": {"date": 1595458682, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s354133739.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354133739", "user_id": "u581648177"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar\n c : char;\nbegin\n readln(c);\n if (c >= 'a') and (c <= 'z')\n then writeln('a');\n if (c >= 'A') and (c <= 'Z')\n then writeln('A');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 2, "memory_kb": 1304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s156014000", "group_id": "codeNet:p02627", "input_text": "program main;\nvar\n n, k, sum, mini, i, j, temp : integer;\n a : array[1..1000] of integer;\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n sum := 0;\n for i := 1 to k do begin\n mini := i;\n for j := i + 1 to n do \n if (a[mini] > a[j]) then\n mini := j;\n \n sum := sum + a[mini];\n temp := a[mini];\n a[mini] := a[i];\n a[i] := temp;\n end;\n \n\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595395922, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s156014000.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s156014000", "user_id": "u151858600"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar\n n, k, sum, mini, i, j, temp : integer;\n a : array[1..1000] of integer;\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n sum := 0;\n for i := 1 to k do begin\n mini := i;\n for j := i + 1 to n do \n if (a[mini] > a[j]) then\n mini := j;\n \n sum := sum + a[mini];\n temp := a[mini];\n a[mini] := a[i];\n a[i] := temp;\n end;\n \n\n writeln(sum);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 473, "cpu_time_ms": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s984786234", "group_id": "codeNet:p02628", "input_text": "program main;\ntype\n arr = array [1..1000] of longint;\n \nvar i, n, t, sum : longint;\n juice : arr;\n\nprocedure bubble_sort (var number : arr);\nvar\n i, t : integer;\n swap : boolean = true;\n\nbegin\n while swap do begin\n swap := false;\n for i := 1 to (n-1) do \n if (number[i] > number[i+1]) then begin //ascending order\n {if (number[i] < number[i+1]) then begin //descending order}\n t := number[i];\n \t number[i] := number[i+1];\n\t\t number[i+1] := t;\n \t swap := true;\n end;\n end;\nend;\n\n \nbegin\n read(n);\n readln(t);\n for i := 1 to n do\n read(juice[i]);\n readln;\n bubble_sort(juice);\n sum := 0;\n for i := 1 to t do\n sum := sum + juice[i];\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1596484129, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s984786234.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s984786234", "user_id": "u122156580"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\ntype\n arr = array [1..1000] of longint;\n \nvar i, n, t, sum : longint;\n juice : arr;\n\nprocedure bubble_sort (var number : arr);\nvar\n i, t : integer;\n swap : boolean = true;\n\nbegin\n while swap do begin\n swap := false;\n for i := 1 to (n-1) do \n if (number[i] > number[i+1]) then begin //ascending order\n {if (number[i] < number[i+1]) then begin //descending order}\n t := number[i];\n \t number[i] := number[i+1];\n\t\t number[i+1] := t;\n \t swap := true;\n end;\n end;\nend;\n\n \nbegin\n read(n);\n readln(t);\n for i := 1 to n do\n read(juice[i]);\n readln;\n bubble_sort(juice);\n sum := 0;\n for i := 1 to t do\n sum := sum + juice[i];\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 708, "cpu_time_ms": 7, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s864134359", "group_id": "codeNet:p02628", "input_text": "program main;\ntype\n arr = array [1..1000] of longint;\n\nvar i, n, t, sum : longint;\n juice : arr;\n\nprocedure quicksort (var number : arr; left, right : longint);\nvar\n l, r, t, tswap : longint;\n\nbegin\n l := left;\n r := right;\n t := number[l];\n repeat\n while (number[l] < t) and (l < right) do \n inc(l);\n while (number[r] >= t) and (r > left) do \n dec(r);\n if (l < r) then begin\n tswap := number[l];\n number[l] := number[right];\n number[r] := tswap; \n end;\n until (l >= r);\n quicksort(number, left, r);\n quicksort(number, (r+1), right);\nend;\n\nbegin\n read(n);\n readln(t);\n for i := 1 to n do\n read(juice[i]);\n readln;\n quicksort(juice, 1, n);\n sum := 0;\n for i := 1 to t do\n sum := sum + juice[i];\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1596484022, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s864134359.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s864134359", "user_id": "u122156580"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\ntype\n arr = array [1..1000] of longint;\n\nvar i, n, t, sum : longint;\n juice : arr;\n\nprocedure quicksort (var number : arr; left, right : longint);\nvar\n l, r, t, tswap : longint;\n\nbegin\n l := left;\n r := right;\n t := number[l];\n repeat\n while (number[l] < t) and (l < right) do \n inc(l);\n while (number[r] >= t) and (r > left) do \n dec(r);\n if (l < r) then begin\n tswap := number[l];\n number[l] := number[right];\n number[r] := tswap; \n end;\n until (l >= r);\n quicksort(number, left, r);\n quicksort(number, (r+1), right);\nend;\n\nbegin\n read(n);\n readln(t);\n for i := 1 to n do\n read(juice[i]);\n readln;\n quicksort(juice, 1, n);\n sum := 0;\n for i := 1 to t do\n sum := sum + juice[i];\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 777, "cpu_time_ms": 262, "memory_kb": 256764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s404805107", "group_id": "codeNet:p02628", "input_text": "program hi;\nvar \n k, n, i, j, ans: integer;\n p: array[1..1000] of integer;\n\nprocedure swap(var x: integer; var y: integer);\nvar tmp: integer;\nbegin\n tmp := x;\n x := y;\n y := tmp;\nend;\n\nbegin\n readln(n, k);\n for i := 1 to n do \n read(p[i]);\n for i := 1 to n - 1 do\n for j := 1 to n - 1 do \n if p[j] > p[j + 1] then\n swap(p[j], p[j + 1]);\n ans := 0;\n for i := 1 to k do\n ans := ans + p[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1596470895, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s404805107.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s404805107", "user_id": "u051422473"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program hi;\nvar \n k, n, i, j, ans: integer;\n p: array[1..1000] of integer;\n\nprocedure swap(var x: integer; var y: integer);\nvar tmp: integer;\nbegin\n tmp := x;\n x := y;\n y := tmp;\nend;\n\nbegin\n readln(n, k);\n for i := 1 to n do \n read(p[i]);\n for i := 1 to n - 1 do\n for j := 1 to n - 1 do \n if p[j] > p[j + 1] then\n swap(p[j], p[j + 1]);\n ans := 0;\n for i := 1 to k do\n ans := ans + p[i];\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 487, "cpu_time_ms": 6, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s809450623", "group_id": "codeNet:p02628", "input_text": "program main;\nvar\n i, x, y, smallest, count : integer;\n total : int64;\n A : array[1..1000] of integer;\n B : array[1..1000] of boolean;\nbegin\n readln(x, y);\n total := 0;\n for i := 1 to x do \n B[i] := false;\n for i := 1 to x do\n read(A[i]);\n while y > 0 do begin\n smallest := 1001;\n count := 0;\n for i := 1 to x do \n if (A[i] < smallest) and (B[i] = false)\n then begin\n smallest := A[i];\n count := i;\n end;\n B[count] := true;\n total := total + smallest;\n y := y - 1;\n end;\n writeln(total);\nend.", "language": "Pascal", "metadata": {"date": 1595459280, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s809450623.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s809450623", "user_id": "u581648177"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\nvar\n i, x, y, smallest, count : integer;\n total : int64;\n A : array[1..1000] of integer;\n B : array[1..1000] of boolean;\nbegin\n readln(x, y);\n total := 0;\n for i := 1 to x do \n B[i] := false;\n for i := 1 to x do\n read(A[i]);\n while y > 0 do begin\n smallest := 1001;\n count := 0;\n for i := 1 to x do \n if (A[i] < smallest) and (B[i] = false)\n then begin\n smallest := A[i];\n count := i;\n end;\n B[count] := true;\n total := total + smallest;\n y := y - 1;\n end;\n writeln(total);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 660, "cpu_time_ms": 4, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s957009957", "group_id": "codeNet:p02628", "input_text": "program main;\nvar\n n, k, sum, mini, i, j, temp : integer;\n a : array[1..1000] of integer;\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n sum := 0;\n for i := 1 to k do begin\n mini := i;\n for j := i + 1 to n do \n if (a[mini] > a[j]) then\n mini := j;\n \n sum := sum + a[mini];\n temp := a[mini];\n a[mini] := a[i];\n a[i] := temp;\n end;\n \n\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595396010, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s957009957.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s957009957", "user_id": "u151858600"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\nvar\n n, k, sum, mini, i, j, temp : integer;\n a : array[1..1000] of integer;\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n sum := 0;\n for i := 1 to k do begin\n mini := i;\n for j := i + 1 to n do \n if (a[mini] > a[j]) then\n mini := j;\n \n sum := sum + a[mini];\n temp := a[mini];\n a[mini] := a[i];\n a[i] := temp;\n end;\n \n\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 473, "cpu_time_ms": 5, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s507968874", "group_id": "codeNet:p02628", "input_text": "program main;\nvar\n n, k, sum, i: integer;\n a : array[1..1000] of integer;\n\n\nprocedure qs (l, r : integer);\nvar\n p, i, j, temp : integer;\nbegin\n if (l < r) then begin \n p := a[l]; i := l; j := r;\n \n while (i < j) do begin\n while (a[j] >= p) do\n j := j - 1;\n while (a[i] < p) do\n i := i + 1;\n \n if (i < j) then begin\n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n end;\n end;\n\n qs(l, i - 1);\n qs(i + 1, r);\n end;\nend;\n\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n qs(1, n);\n\n sum := 0;\n for i := 1 to k do\n sum += a[i];\n \n\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595393038, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s507968874.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s507968874", "user_id": "u151858600"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\nvar\n n, k, sum, i: integer;\n a : array[1..1000] of integer;\n\n\nprocedure qs (l, r : integer);\nvar\n p, i, j, temp : integer;\nbegin\n if (l < r) then begin \n p := a[l]; i := l; j := r;\n \n while (i < j) do begin\n while (a[j] >= p) do\n j := j - 1;\n while (a[i] < p) do\n i := i + 1;\n \n if (i < j) then begin\n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n end;\n end;\n\n qs(l, i - 1);\n qs(i + 1, r);\n end;\nend;\n\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n qs(1, n);\n\n sum := 0;\n for i := 1 to k do\n sum += a[i];\n \n\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 777, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s564292907", "group_id": "codeNet:p02629", "input_text": "var\n\tN,T:int64;\nbegin\n\tread(N);\n\tT:=1;\n\twhile N>=T do begin\n\t\tdec(N,T);\n\t\tT:=T*26;\n\tend;\n\twhile T>1 do begin\n\t\tT:=T div 26;\n\t\twrite(Chr(N div T+97));\n\t\tN:=N mod T;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1592792116, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Pascal/s564292907.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564292907", "user_id": "u657913472"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "var\n\tN,T:int64;\nbegin\n\tread(N);\n\tT:=1;\n\twhile N>=T do begin\n\t\tdec(N,T);\n\t\tT:=T*26;\n\tend;\n\twhile T>1 do begin\n\t\tT:=T div 26;\n\t\twrite(Chr(N div T+97));\n\t\tN:=N mod T;\n\tend;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 174, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s080407374", "group_id": "codeNet:p02639", "input_text": "program main;\nvar x : array[1..5] of integer;\n\ti,n : integer;\nbegin\n\tfor i := 1 to 5 do begin\n \treadln(x[i]);\n end;\n if(x[1] = 0) \n \tthen n := 1\n else if(x[2] = 0) \n \t\tthen n := 2\n else if(x[3] = 0) \n \t\t\t then n := 3\n else if(x[4] = 0) \n \t\t\t \tthen n := 4\n else if(x[5] = 0) \n \t\t\t \t\tthen n := 5; \n writeln(n + 1);\nend. ", "language": "Pascal", "metadata": {"date": 1600794350, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s080407374.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s080407374", "user_id": "u212944395"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar x : array[1..5] of integer;\n\ti,n : integer;\nbegin\n\tfor i := 1 to 5 do begin\n \treadln(x[i]);\n end;\n if(x[1] = 0) \n \tthen n := 1\n else if(x[2] = 0) \n \t\tthen n := 2\n else if(x[3] = 0) \n \t\t\t then n := 3\n else if(x[4] = 0) \n \t\t\t \tthen n := 4\n else if(x[5] = 0) \n \t\t\t \t\tthen n := 5; \n writeln(n + 1);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 403, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s294022758", "group_id": "codeNet:p02639", "input_text": "program hi;\nvar x, i: integer;\n\nbegin\n for i := 1 to 5 do begin\n read(x);\n if (x = 0) then \n writeln(i);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1596467999, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s294022758.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s294022758", "user_id": "u051422473"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program hi;\nvar x, i: integer;\n\nbegin\n for i := 1 to 5 do begin\n read(x);\n if (x = 0) then \n writeln(i);\n end;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 146, "cpu_time_ms": 4, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s998426052", "group_id": "codeNet:p02639", "input_text": "program main;\nvar\n a, b, c, d, e : integer;\nbegin\n readln(a, b, c, d, e);\n if a <> 1\n then writeln('1');\n if b <> 2\n then writeln('2');\n if c <> 3\n then writeln('3');\n if d <> 4\n then writeln('4'); \n if e <> 5\n then writeln('5');\nend.\n", "language": "Pascal", "metadata": {"date": 1595461081, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s998426052.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s998426052", "user_id": "u581648177"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar\n a, b, c, d, e : integer;\nbegin\n readln(a, b, c, d, e);\n if a <> 1\n then writeln('1');\n if b <> 2\n then writeln('2');\n if c <> 3\n then writeln('3');\n if d <> 4\n then writeln('4'); \n if e <> 5\n then writeln('5');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 294, "cpu_time_ms": 2, "memory_kb": 1220}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s230936835", "group_id": "codeNet:p02639", "input_text": "var\n a,b,c,d,e:longint;\nbegin\n readln(a,b,c,d,e);\n if a=0 then writeln(1);\n if b=0 then writeln(2);\n if c=0 then writeln(3);\n if d=0 then writeln(4);\n if e=0 then writeln(5);\nend.", "language": "Pascal", "metadata": {"date": 1592349823, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s230936835.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s230936835", "user_id": "u481028033"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a,b,c,d,e:longint;\nbegin\n readln(a,b,c,d,e);\n if a=0 then writeln(1);\n if b=0 then writeln(2);\n if c=0 then writeln(3);\n if d=0 then writeln(4);\n if e=0 then writeln(5);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 4, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s842317901", "group_id": "codeNet:p02640", "input_text": "program ct;\nvar\n i, x, y : longint;\nbegin\n read(x, y);\n readln;\n if y mod 2 = 0 then\n for i := 1 to x do begin\n if y - 4 >= 0 then\n y -= 4\n else if y - 2 >= 0 then\n y -= 2\n else break;\n end\n else y := 1;\n if y = 0 then\n writeln('Yes')\n else \n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1597974333, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s842317901.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s842317901", "user_id": "u583992857"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ct;\nvar\n i, x, y : longint;\nbegin\n read(x, y);\n readln;\n if y mod 2 = 0 then\n for i := 1 to x do begin\n if y - 4 >= 0 then\n y -= 4\n else if y - 2 >= 0 then\n y -= 2\n else break;\n end\n else y := 1;\n if y = 0 then\n writeln('Yes')\n else \n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 378, "cpu_time_ms": 5, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s097087338", "group_id": "codeNet:p02640", "input_text": "program ct;\nvar\n i, x, y : longint;\nbegin\n read(x, y);\n readln;\n for i := 1 to x do begin\n if y - 4 >= 0 then\n y -= 4\n else if y - 2 >= 0 then\n y -= 2\n else break;\n end;\n if y = 0 then\n writeln('Yes')\n else \n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1597974184, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s097087338.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s097087338", "user_id": "u583992857"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ct;\nvar\n i, x, y : longint;\nbegin\n read(x, y);\n readln;\n for i := 1 to x do begin\n if y - 4 >= 0 then\n y -= 4\n else if y - 2 >= 0 then\n y -= 2\n else break;\n end;\n if y = 0 then\n writeln('Yes')\n else \n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 310, "cpu_time_ms": 7, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s430400615", "group_id": "codeNet:p02640", "input_text": "var x,y,i:longint;\nbegin\nread(x,y);\nfor i:=0 to x do begin\nif 2*x+2*i=y then begin\nwriteln('Yes');\nexit;\nend;\nend;\nwriteln('No');\nend.", "language": "Pascal", "metadata": {"date": 1597457279, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s430400615.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s430400615", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var x,y,i:longint;\nbegin\nread(x,y);\nfor i:=0 to x do begin\nif 2*x+2*i=y then begin\nwriteln('Yes');\nexit;\nend;\nend;\nwriteln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 5, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s635106318", "group_id": "codeNet:p02640", "input_text": "program main;\nvar \n a, b : integer;\nbegin\n readln(a, b);\n if ( b mod 2 = 1 ) or ( a*4 < b ) or ( a*2 > b ) then \n writeln('No')\n else \n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1597086685, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s635106318.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s635106318", "user_id": "u743163683"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar \n a, b : integer;\nbegin\n readln(a, b);\n if ( b mod 2 = 1 ) or ( a*4 < b ) or ( a*2 > b ) then \n writeln('No')\n else \n writeln('Yes');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 182, "cpu_time_ms": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s370093541", "group_id": "codeNet:p02640", "input_text": "program main;\nvar x, y, a, b : longint; \n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n if frac((y-2*x) / 2) = 0 then\n b := (y-2*x) div 2\n else \n r := false;\n if r then\n a := x-b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596484655, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s370093541.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s370093541", "user_id": "u122156580"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar x, y, a, b : longint; \n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n if frac((y-2*x) / 2) = 0 then\n b := (y-2*x) div 2\n else \n r := false;\n if r then\n a := x-b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s527501799", "group_id": "codeNet:p02640", "input_text": "program main;\nvar\n a, b, x, y, legs : integer;\nbegin\n readln(x, y);\n a := 0;\n b := x;\n while a <= x do begin\n legs := a*2 + b*4;\n if legs = y \n then begin\n writeln('Yes');\n halt;\n end\n else begin\n a := a + 1;\n b := b - 1;\n end;\n end;\n if a > x \n then writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1595461436, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s527501799.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s527501799", "user_id": "u581648177"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar\n a, b, x, y, legs : integer;\nbegin\n readln(x, y);\n a := 0;\n b := x;\n while a <= x do begin\n legs := a*2 + b*4;\n if legs = y \n then begin\n writeln('Yes');\n halt;\n end\n else begin\n a := a + 1;\n b := b - 1;\n end;\n end;\n if a > x \n then writeln('No');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 417, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s360315778", "group_id": "codeNet:p02645", "input_text": "var s:string;\nbegin\nreadln(s);\nwriteln(s[1]+s[2]+s[3])\nend.", "language": "Pascal", "metadata": {"date": 1592098150, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02645.html", "problem_id": "p02645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02645/input.txt", "sample_output_relpath": "derived/input_output/data/p02645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02645/Pascal/s360315778.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s360315778", "user_id": "u851084981"}, "prompt_components": {"gold_output": "tak\n", "input_to_evaluate": "var s:string;\nbegin\nreadln(s);\nwriteln(s[1]+s[2]+s[3])\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "sample_input": "takahashi\n"}, "reference_outputs": ["tak\n"], "source_document_id": "p02645", "source_text": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 59, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s114459471", "group_id": "codeNet:p02646", "input_text": "var a,b,v,w,t: int64; x:real;\nbegin\nreadln(a,v);\nreadln(b,w);\nreadln(t);\nif w>=v then begin writeln('NO'); exit end;\nx:=(b*v-a*w)/(v-w);\nx:=(x-a)/v;\nif x>t then begin writeln('NO'); exit end;\nwriteln('YES')\nend.\n", "language": "Pascal", "metadata": {"date": 1592100052, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02646.html", "problem_id": "p02646", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02646/input.txt", "sample_output_relpath": "derived/input_output/data/p02646/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02646/Pascal/s114459471.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s114459471", "user_id": "u851084981"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var a,b,v,w,t: int64; x:real;\nbegin\nreadln(a,v);\nreadln(b,w);\nreadln(t);\nif w>=v then begin writeln('NO'); exit end;\nx:=(b*v-a*w)/(v-w);\nx:=(x-a)/v;\nif x>t then begin writeln('NO'); exit end;\nwriteln('YES')\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "sample_input": "1 2\n3 1\n3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02646", "source_text": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 1, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s999908051", "group_id": "codeNet:p02657", "input_text": "program main;\nvar a,b : integer;\nbegin \n read(a,b);\n writeln(a*b);\nend.", "language": "Pascal", "metadata": {"date": 1598114947, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s999908051.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s999908051", "user_id": "u289438802"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main;\nvar a,b : integer;\nbegin \n read(a,b);\n writeln(a*b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 73, "cpu_time_ms": 2, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s542949723", "group_id": "codeNet:p02657", "input_text": "program multi;\nvar \n a, b : longint;\nbegin\n read(a, b);\n readln;\n writeln(a * b);\nend.", "language": "Pascal", "metadata": {"date": 1597970924, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s542949723.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s542949723", "user_id": "u583992857"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program multi;\nvar \n a, b : longint;\nbegin\n read(a, b);\n readln;\n writeln(a * b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 3, "memory_kb": 1244}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s803047150", "group_id": "codeNet:p02657", "input_text": "program hi;\nvar \n a, ans: QWord;\n n, i: integer;\n ex: boolean = false;\n\nbegin\n readln(n);\n ans := 1;\n for i := 1 to n do begin\n read(a);\n if (ans > 1000000000000000000) then \n ex := true;\n if (a = 0) then begin\n writeln(0);\n exit;\n end else if (a > 1000000000000000000) then \n ex := true\n else\n ans := ans * a;\n end;\n if (ex) or (ans > 1000000000000000000) then \n writeln(-1)\n else \n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1596472310, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s803047150.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s803047150", "user_id": "u051422473"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program hi;\nvar \n a, ans: QWord;\n n, i: integer;\n ex: boolean = false;\n\nbegin\n readln(n);\n ans := 1;\n for i := 1 to n do begin\n read(a);\n if (ans > 1000000000000000000) then \n ex := true;\n if (a = 0) then begin\n writeln(0);\n exit;\n end else if (a > 1000000000000000000) then \n ex := true\n else\n ans := ans * a;\n end;\n if (ex) or (ans > 1000000000000000000) then \n writeln(-1)\n else \n writeln(ans)\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 532, "cpu_time_ms": 7, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s690613661", "group_id": "codeNet:p02657", "input_text": "program hi;\nvar a, b: integer;\n\nbegin\n readln(a, b);\n writeln(a * b);\nend.", "language": "Pascal", "metadata": {"date": 1596468141, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s690613661.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s690613661", "user_id": "u051422473"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program hi;\nvar a, b: integer;\n\nbegin\n readln(a, b);\n writeln(a * b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 80, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s618912609", "group_id": "codeNet:p02657", "input_text": "program main;\nvar\n\tx, y : integer;\n sum : int64;\nbegin\n\tread(x, y);\n sum := x*y;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595466821, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s618912609.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s618912609", "user_id": "u522723337"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main;\nvar\n\tx, y : integer;\n sum : int64;\nbegin\n\tread(x, y);\n sum := x*y;\n writeln(sum);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 109, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s326855405", "group_id": "codeNet:p02657", "input_text": "var a,b:Longint;\nbegin\nread(a,b);\nwriteln(a*b);\nend.", "language": "Pascal", "metadata": {"date": 1591128413, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s326855405.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s326855405", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var a,b:Longint;\nbegin\nread(a,b);\nwriteln(a*b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 52, "cpu_time_ms": 1, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s676087776", "group_id": "codeNet:p02660", "input_text": "var\n\tN,i,c,t,z:int64;\nbegin\n\tread(N);\n\ti:=2;\n\twhile i*i<=N do begin\n\t\tif N mod i=0 then begin\n\t\t\tc:=0;\n\t\t\twhile N mod i=0 do begin\n\t\t\t\tN:=N div i;\n\t\t\t\tinc(c);\n\t\t\tend;\n\t\t\tt:=1;\n\t\t\twhile c>=t do begin\n\t\t\t\tdec(c,t);\n\t\t\t\tinc(t);\n\t\t\t\tinc(z);\n\t\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif N>1 then inc(z);\n\twriteln(z);\nend.\n", "language": "Pascal", "metadata": {"date": 1591916313, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02660.html", "problem_id": "p02660", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02660/input.txt", "sample_output_relpath": "derived/input_output/data/p02660/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02660/Pascal/s676087776.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s676087776", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\tN,i,c,t,z:int64;\nbegin\n\tread(N);\n\ti:=2;\n\twhile i*i<=N do begin\n\t\tif N mod i=0 then begin\n\t\t\tc:=0;\n\t\t\twhile N mod i=0 do begin\n\t\t\t\tN:=N div i;\n\t\t\t\tinc(c);\n\t\t\tend;\n\t\t\tt:=1;\n\t\t\twhile c>=t do begin\n\t\t\t\tdec(c,t);\n\t\t\t\tinc(t);\n\t\t\t\tinc(z);\n\t\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif N>1 then inc(z);\n\twriteln(z);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\nFirst, choose a positive integer z satisfying all of the conditions below:\n\nz can be represented as z=p^e, where p is a prime number and e is a positive integer;\n\nz divides N;\n\nz is different from all integers chosen in previous operations.\n\nThen, replace N with N/z.\n\nFind the maximum number of times the operation can be applied.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum number of times the operation can be applied.\n\nSample Input 1\n\n24\n\nSample Output 1\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=12.)\n\nChoose z=3 (=3^1). (Now we have N=4.)\n\nChoose z=4 (=2^2). (Now we have N=1.)\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nWe cannot apply the operation at all.\n\nSample Input 3\n\n64\n\nSample Output 3\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=32.)\n\nChoose z=4 (=2^2). (Now we have N=8.)\n\nChoose z=8 (=2^3). (Now we have N=1.)\n\nSample Input 4\n\n1000000007\n\nSample Output 4\n\n1\n\nWe can apply the operation once by, for example, making the following choice:\n\nz=1000000007 (=1000000007^1). (Now we have N=1.)\n\nSample Input 5\n\n997764507000\n\nSample Output 5\n\n7", "sample_input": "24\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02660", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\nFirst, choose a positive integer z satisfying all of the conditions below:\n\nz can be represented as z=p^e, where p is a prime number and e is a positive integer;\n\nz divides N;\n\nz is different from all integers chosen in previous operations.\n\nThen, replace N with N/z.\n\nFind the maximum number of times the operation can be applied.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum number of times the operation can be applied.\n\nSample Input 1\n\n24\n\nSample Output 1\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=12.)\n\nChoose z=3 (=3^1). (Now we have N=4.)\n\nChoose z=4 (=2^2). (Now we have N=1.)\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nWe cannot apply the operation at all.\n\nSample Input 3\n\n64\n\nSample Output 3\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=32.)\n\nChoose z=4 (=2^2). (Now we have N=8.)\n\nChoose z=8 (=2^3). (Now we have N=1.)\n\nSample Input 4\n\n1000000007\n\nSample Output 4\n\n1\n\nWe can apply the operation once by, for example, making the following choice:\n\nz=1000000007 (=1000000007^1). (Now we have N=1.)\n\nSample Input 5\n\n997764507000\n\nSample Output 5\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 17, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s965670430", "group_id": "codeNet:p02675", "input_text": "program therefore;\nvar\n n : string;\n x : char;\nbegin\n readln(n);\n x := n[length(n)];\n if (x = '2') or (x = '4') or (x = '5') or (x = '7') or (x = '9') then \n writeln('hon')\n else if x = '3' then\n writeln('bon')\n else writeln('pon');\nend.", "language": "Pascal", "metadata": {"date": 1598115290, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s965670430.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s965670430", "user_id": "u289438802"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program therefore;\nvar\n n : string;\n x : char;\nbegin\n readln(n);\n x := n[length(n)];\n if (x = '2') or (x = '4') or (x = '5') or (x = '7') or (x = '9') then \n writeln('hon')\n else if x = '3' then\n writeln('bon')\n else writeln('pon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 6, "memory_kb": 1332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s973755599", "group_id": "codeNet:p02675", "input_text": "program therefore;\nvar\n n : string;\n x : char;\nbegin\n readln(n);\n x := n[length(n)];\n if (x = '2') or (x = '4') or (x = '5') or (x = '7') or (x = '9') then \n writeln('hon')\n else if x = '3' then\n writeln('bon')\n else writeln('pon');\nend.", "language": "Pascal", "metadata": {"date": 1597910658, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s973755599.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s973755599", "user_id": "u583992857"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program therefore;\nvar\n n : string;\n x : char;\nbegin\n readln(n);\n x := n[length(n)];\n if (x = '2') or (x = '4') or (x = '5') or (x = '7') or (x = '9') then \n writeln('hon')\n else if x = '3' then\n writeln('bon')\n else writeln('pon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 5, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s809760888", "group_id": "codeNet:p02675", "input_text": "program main;\nvar n : integer;\n \nbegin\n readln(n);\n n := n mod 10;\n case n of \n 2,4,5,7,9 : writeln('hon');\n 0,1,6,8 : writeln('pon');\n 3 : writeln('bon');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1597084264, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s809760888.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s809760888", "user_id": "u743163683"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main;\nvar n : integer;\n \nbegin\n readln(n);\n n := n mod 10;\n case n of \n 2,4,5,7,9 : writeln('hon');\n 0,1,6,8 : writeln('pon');\n 3 : writeln('bon');\n end;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 1, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s473951838", "group_id": "codeNet:p02675", "input_text": "program main; \nvar a : integer;\nbegin\n readln(a);\n if (a > 10) then \n repeat \n dec(a,10);\n until (a <= 10);\n case a of\n 2,4,5,7,9 : writeln('hon');\n 0,1,6,8 : writeln('pon');\n 3 : writeln('bon');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1597084050, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s473951838.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s473951838", "user_id": "u743163683"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main; \nvar a : integer;\nbegin\n readln(a);\n if (a > 10) then \n repeat \n dec(a,10);\n until (a <= 10);\n case a of\n 2,4,5,7,9 : writeln('hon');\n 0,1,6,8 : writeln('pon');\n 3 : writeln('bon');\n end;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 5, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s564495659", "group_id": "codeNet:p02675", "input_text": "program hi;\nvar n: integer;\n\nbegin\n readln(n);\n n := n mod 10;\n if n in [2, 4, 5, 7, 9] then\n writeln('hon')\n else if n in [0, 1, 6, 8] then\n writeln('pon')\n else \n writeln('bon')\nend.", "language": "Pascal", "metadata": {"date": 1596468382, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s564495659.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564495659", "user_id": "u051422473"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program hi;\nvar n: integer;\n\nbegin\n readln(n);\n n := n mod 10;\n if n in [2, 4, 5, 7, 9] then\n writeln('hon')\n else if n in [0, 1, 6, 8] then\n writeln('pon')\n else \n writeln('bon')\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s594434028", "group_id": "codeNet:p02675", "input_text": "var\n\ts:string;\nbegin\n\treadln(s);\n\tif s[length(s)]='3' then \n \twriteln('bon')\n else if pos(s[length(s)],'24579')<>0 then\n \twriteln('hon')\n else writeln('pon');\nend.", "language": "Pascal", "metadata": {"date": 1595009077, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s594434028.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s594434028", "user_id": "u678829637"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n\ts:string;\nbegin\n\treadln(s);\n\tif s[length(s)]='3' then \n \twriteln('bon')\n else if pos(s[length(s)],'24579')<>0 then\n \twriteln('hon')\n else writeln('pon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 5, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s983461930", "group_id": "codeNet:p02675", "input_text": "var\n n: Integer;\n c: Integer;\nbegin\n read(n);\n c := n mod 10;\n case c of\n \t3: writeln('bon');\n \t0, 1, 6, 8: writeln('pon');\n else writeln('hon');\n end;\n read(n);\nend.\n", "language": "Pascal", "metadata": {"date": 1590167418, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s983461930.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s983461930", "user_id": "u029261695"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n n: Integer;\n c: Integer;\nbegin\n read(n);\n c := n mod 10;\n case c of\n \t3: writeln('bon');\n \t0, 1, 6, 8: writeln('pon');\n else writeln('hon');\n end;\n read(n);\nend.\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 204, "cpu_time_ms": 1, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s001447374", "group_id": "codeNet:p02675", "input_text": "var N:Longint;\nbegin\nread(N);\nN:=N mod 10;\nif N=3 then writeln('bon')else if(N=0)or(N=1)or(N=6)or(N=8)then writeln('pon')else writeln('hon');\nend.", "language": "Pascal", "metadata": {"date": 1589929612, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s001447374.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s001447374", "user_id": "u657913472"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nN:=N mod 10;\nif N=3 then writeln('bon')else if(N=0)or(N=1)or(N=6)or(N=8)then writeln('pon')else writeln('hon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 146, "cpu_time_ms": 1, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s872381951", "group_id": "codeNet:p02676", "input_text": "program main;\nvar \n a, i : integer;\n b : string;\nbegin\n readln(a);\n readln(b);\n if ( a >= length(b) ) then\n writeln(b)\n else \n begin \n for i := 1 to a do \n write(b[i]);\n write('...');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1597095008, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s872381951.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s872381951", "user_id": "u743163683"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main;\nvar \n a, i : integer;\n b : string;\nbegin\n readln(a);\n readln(b);\n if ( a >= length(b) ) then\n writeln(b)\n else \n begin \n for i := 1 to a do \n write(b[i]);\n write('...');\n end;\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s379747695", "group_id": "codeNet:p02676", "input_text": "program main;\nvar\n x : integer;\n s : string;\nbegin\n readln(x);\n readln(s);\n if x >= length(s)\n then writeln(s)\n else begin\n s := copy(s, 1, x);\n writeln(s,'...');\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1595461654, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s379747695.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s379747695", "user_id": "u581648177"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main;\nvar\n x : integer;\n s : string;\nbegin\n readln(x);\n readln(s);\n if x >= length(s)\n then writeln(s)\n else begin\n s := copy(s, 1, x);\n writeln(s,'...');\n end;\nend.\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 232, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s955373177", "group_id": "codeNet:p02676", "input_text": "var K:Longint;\nS:String;\nbegin\nreadln(K);\nreadln(S);\nif length(S)<=K then writeln(S)else writeln(copy(S,1,K),'...');\nend.", "language": "Pascal", "metadata": {"date": 1589929656, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s955373177.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s955373177", "user_id": "u657913472"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "var K:Longint;\nS:String;\nbegin\nreadln(K);\nreadln(S);\nif length(S)<=K then writeln(S)else writeln(copy(S,1,K),'...');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 5, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s675447936", "group_id": "codeNet:p02677", "input_text": "var\n\ta,b,c,d:Longint;\nbegin\n\tread(a,b,c,d);\n\twriteln(sqrt(a*a+b*b-2*a*b*cos((30*c-5.5*d)*3.14159265358979/180)):0:9);\nend.\n", "language": "Pascal", "metadata": {"date": 1591916061, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Pascal/s675447936.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s675447936", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "var\n\ta,b,c,d:Longint;\nbegin\n\tread(a,b,c,d);\n\twriteln(sqrt(a*a+b*b-2*a*b*cos((30*c-5.5*d)*3.14159265358979/180)):0:9);\nend.\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s944537942", "group_id": "codeNet:p02677", "input_text": "Uses crt,math;\nVar a,b,h,m,i,j,k,n:longint;\nangle1,angle2,res:extended;\nbegin\nclrscr;\nreadln(a,b,h,m);\nangle1:=(m/60)*360;\nIf angle1<180 then angle1:=360-angle1; \nangle2:=((m/60+h)/12)*360;\nangle1:=abs(angle1-angle2);\nwriteln(sqrt(a*a+b*b-2*a*b*cos((angle1)/180*pi)):0:20);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1590021178, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Pascal/s944537942.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s944537942", "user_id": "u382911836"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "Uses crt,math;\nVar a,b,h,m,i,j,k,n:longint;\nangle1,angle2,res:extended;\nbegin\nclrscr;\nreadln(a,b,h,m);\nangle1:=(m/60)*360;\nIf angle1<180 then angle1:=360-angle1; \nangle2:=((m/60+h)/12)*360;\nangle1:=abs(angle1-angle2);\nwriteln(sqrt(a*a+b*b-2*a*b*cos((angle1)/180*pi)):0:20);\nend.\n\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 2, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s403229937", "group_id": "codeNet:p02682", "input_text": "program linear;\nvar\n a, b, c, k : longint;\nbegin\n readln(a, b, c, k);\n writeln(a - (k - a - b) * c);\nend.", "language": "Pascal", "metadata": {"date": 1597904382, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Pascal/s403229937.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s403229937", "user_id": "u583992857"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program linear;\nvar\n a, b, c, k : longint;\nbegin\n readln(a, b, c, k);\n writeln(a - (k - a - b) * c);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 5, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s641606736", "group_id": "codeNet:p02682", "input_text": "var A,B,C,K:Longint;\nbegin\nread(A,B,C,K);\nif A>K then writeln(K) else if A+B>K then writeln(A) else writeln(A+A+B-K);\nend.", "language": "Pascal", "metadata": {"date": 1589416021, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Pascal/s641606736.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s641606736", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var A,B,C,K:Longint;\nbegin\nread(A,B,C,K);\nif A>K then writeln(K) else if A+B>K then writeln(A) else writeln(A+A+B-K);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s014822029", "group_id": "codeNet:p02687", "input_text": "program main;\nvar s : string;\nbegin\n readln(s);\n if s = 'ABC'\n then writeln('ARC')\n else writeln('ABC');\nend.", "language": "Pascal", "metadata": {"date": 1597848181, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s014822029.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s014822029", "user_id": "u225670189"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "program main;\nvar s : string;\nbegin\n readln(s);\n if s = 'ABC'\n then writeln('ARC')\n else writeln('ABC');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 4, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s583080592", "group_id": "codeNet:p02687", "input_text": "program main;\nvar\n a : string;\nbegin\n read(a);\n if a ='ABC'\n then writeln('ARC')\n else writeln('ABC');\nend.", "language": "Pascal", "metadata": {"date": 1595354352, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s583080592.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s583080592", "user_id": "u522723337"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "program main;\nvar\n a : string;\nbegin\n read(a);\n if a ='ABC'\n then writeln('ARC')\n else writeln('ABC');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 4, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s503185331", "group_id": "codeNet:p02687", "input_text": "var\n\ts:string;\nbegin\n\treadln(s);\n if s='ABC' then writeln('ARC') else writeln('ABC');\nend.", "language": "Pascal", "metadata": {"date": 1594959612, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s503185331.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503185331", "user_id": "u678829637"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "var\n\ts:string;\nbegin\n\treadln(s);\n if s='ABC' then writeln('ARC') else writeln('ABC');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 4, "memory_kb": 1260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s674672354", "group_id": "codeNet:p02687", "input_text": "var\n s:string;\nbegin\n readln(s);//读入s\n if s='ABC' then write('ARC')//如果为ABC,输出ARC\n else write('ABC');//否则输出ABC\nend.", "language": "Pascal", "metadata": {"date": 1588702363, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s674672354.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s674672354", "user_id": "u723721005"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "var\n s:string;\nbegin\n readln(s);//读入s\n if s='ABC' then write('ARC')//如果为ABC,输出ARC\n else write('ABC');//否则输出ABC\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 1, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s715970272", "group_id": "codeNet:p02687", "input_text": "var s:string;\nbegin\n readln(s);\n if s='ABC' then write('ARC')\n else write('ABC');\nend.", "language": "Pascal", "metadata": {"date": 1588555837, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s715970272.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s715970272", "user_id": "u350243594"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "var s:string;\nbegin\n readln(s);\n if s='ABC' then write('ARC')\n else write('ABC');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s110704419", "group_id": "codeNet:p02688", "input_text": "program trickortreat;\nvar\n snuke : array[1..100] of boolean;\n n, k, i, j, x, y, counter : longint;\nbegin\n readln(n, k);\n counter := 0;\n for i := 1 to 100 do begin\n snuke[i] := false;\n end;\n \n for i := 1 to k do begin\n readln(x);\n for j := 1 to x do begin\n read(y);\n snuke[y] := true;\n end;\n end; \n\n for i := 1 to n do begin\n if not(snuke[i]) then \n counter += 1;\n end;\n writeln(counter);\nend.", "language": "Pascal", "metadata": {"date": 1597188318, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Pascal/s110704419.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s110704419", "user_id": "u583992857"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program trickortreat;\nvar\n snuke : array[1..100] of boolean;\n n, k, i, j, x, y, counter : longint;\nbegin\n readln(n, k);\n counter := 0;\n for i := 1 to 100 do begin\n snuke[i] := false;\n end;\n \n for i := 1 to k do begin\n readln(x);\n for j := 1 to x do begin\n read(y);\n snuke[y] := true;\n end;\n end; \n\n for i := 1 to n do begin\n if not(snuke[i]) then \n counter += 1;\n end;\n writeln(counter);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 505, "cpu_time_ms": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s579708967", "group_id": "codeNet:p02688", "input_text": "var N,K,i,c,j,a:Longint;\nex:Array[1..100]of Boolean;\nbegin\nread(N,K);\nfor i:=1 to K do begin\nread(c);\nfor j:=1 to c do begin\nread(a);\nif not ex[a]then begin\nex[a]:=True;\ndec(N);\nend;\nend;\nend;\nwriteln(N);\nend.", "language": "Pascal", "metadata": {"date": 1589415847, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Pascal/s579708967.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s579708967", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var N,K,i,c,j,a:Longint;\nex:Array[1..100]of Boolean;\nbegin\nread(N,K);\nfor i:=1 to K do begin\nread(c);\nfor j:=1 to c do begin\nread(a);\nif not ex[a]then begin\nex[a]:=True;\ndec(N);\nend;\nend;\nend;\nwriteln(N);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 209, "cpu_time_ms": 2, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s861699065", "group_id": "codeNet:p02688", "input_text": "var a,b:array[1..10000000] of int64;\n i,j:longint;\n res,k,n,d:int64;\nbegin\n for i:=1 to 200 do b[i]:=0;\n read(n,k);\n for i:=1 to k do\n begin\n readln(d);\n for j:=1 to d do\n begin\n read(a[j]);\n b[a[j]]:=1;\n end;\n end;\n for i:=1 to n do if(b[i]=0) then res:=res+1;\n write(res);\nend.\n", "language": "Pascal", "metadata": {"date": 1588558500, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Pascal/s861699065.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s861699065", "user_id": "u350243594"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a,b:array[1..10000000] of int64;\n i,j:longint;\n res,k,n,d:int64;\nbegin\n for i:=1 to 200 do b[i]:=0;\n read(n,k);\n for i:=1 to k do\n begin\n readln(d);\n for j:=1 to d do\n begin\n read(a[j]);\n b[a[j]]:=1;\n end;\n end;\n for i:=1 to n do if(b[i]=0) then res:=res+1;\n write(res);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 2, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s353201009", "group_id": "codeNet:p02693", "input_text": "program main;\nvar k, a, b, i, x : integer;\n ok : boolean;\nbegin\n ok := false;\n\treadln(k);\n readln(a, b);\n \n for i := a to b do begin\n x := i mod k;\n if x = 0\n then ok := true;\n end;\n \n if ok\n then writeln('OK')\n else writeln('NG');\nend.", "language": "Pascal", "metadata": {"date": 1597425479, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s353201009.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s353201009", "user_id": "u384260326"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "program main;\nvar k, a, b, i, x : integer;\n ok : boolean;\nbegin\n ok := false;\n\treadln(k);\n readln(a, b);\n \n for i := a to b do begin\n x := i mod k;\n if x = 0\n then ok := true;\n end;\n \n if ok\n then writeln('OK')\n else writeln('NG');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 299, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s964661193", "group_id": "codeNet:p02693", "input_text": "program wlw;\nvar\n k, i, a, b : longint;\n found : boolean;\nbegin\n readln(k);\n readln(a, b);\n found := false;\n for i := a to b do begin\n if i mod k = 0 then\n found := true;\n end;\n if not(found) then\n writeln('NG')\n else \n writeln('OK')\n \nend.", "language": "Pascal", "metadata": {"date": 1597173131, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s964661193.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s964661193", "user_id": "u583992857"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "program wlw;\nvar\n k, i, a, b : longint;\n found : boolean;\nbegin\n readln(k);\n readln(a, b);\n found := false;\n for i := a to b do begin\n if i mod k = 0 then\n found := true;\n end;\n if not(found) then\n writeln('NG')\n else \n writeln('OK')\n \nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 302, "cpu_time_ms": 3, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s475122713", "group_id": "codeNet:p02693", "input_text": "program main;\nvar\n a, b, target, i : integer;\n can : boolean;\nbegin\n can := false;\n readln(target);\n readln(a, b);\n for i := a to b do\n if (i mod target = 0)\n then can := true;\n if can \n then writeln('OK')\n else writeln('NG');;\nend.\n", "language": "Pascal", "metadata": {"date": 1595453710, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s475122713.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s475122713", "user_id": "u581648177"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "program main;\nvar\n a, b, target, i : integer;\n can : boolean;\nbegin\n can := false;\n readln(target);\n readln(a, b);\n for i := a to b do\n if (i mod target = 0)\n then can := true;\n if can \n then writeln('OK')\n else writeln('NG');;\nend.\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 6, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s781186426", "group_id": "codeNet:p02693", "input_text": "program main;\nvar\n\tk, a, b, count, i : integer;\n\nbegin\n\tread(k);\n readln(a, b);\n \n if k = 1\n \tthen writeln('OK')\n \telse begin\n \tcount := 0;\n \tfor i := a to b do begin\n \tif (frac(i / k) = 0)\n \tthen count := count +1;\n end;\n if count <> 0\n \tthen writeln('OK')\n \t\telse writeln('NG');\n end;\nend.\n \n ", "language": "Pascal", "metadata": {"date": 1595302046, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s781186426.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s781186426", "user_id": "u522723337"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "program main;\nvar\n\tk, a, b, count, i : integer;\n\nbegin\n\tread(k);\n readln(a, b);\n \n if k = 1\n \tthen writeln('OK')\n \telse begin\n \tcount := 0;\n \tfor i := a to b do begin\n \tif (frac(i / k) = 0)\n \tthen count := count +1;\n end;\n if count <> 0\n \tthen writeln('OK')\n \t\telse writeln('NG');\n end;\nend.\n \n ", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 409, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s169366337", "group_id": "codeNet:p02693", "input_text": "var\n\ti,n,a,b:integer;\n kk:boolean;\nbegin\n\treadln(n);\n readln(a,b);\n kk:=false;\n for i:=a to b do if (i mod n)=0 then kk:=true;\n if kk then writeln('OK') else writeln('NG');\nend.", "language": "Pascal", "metadata": {"date": 1594927963, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s169366337.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s169366337", "user_id": "u678829637"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "var\n\ti,n,a,b:integer;\n kk:boolean;\nbegin\n\treadln(n);\n readln(a,b);\n kk:=false;\n for i:=a to b do if (i mod n)=0 then kk:=true;\n if kk then writeln('OK') else writeln('NG');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 6, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s487402249", "group_id": "codeNet:p02693", "input_text": "var k,a,b,i,t:longint;\nbegin\n readln(k);read(a,b);\n t:=0;\n for i:=a to b do\n if i mod k=0 then\n begin\n t:=1;\n break;\n end;\n if t=0 then write('NG')\n else write('OK');\nend.\n", "language": "Pascal", "metadata": {"date": 1588517893, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s487402249.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s487402249", "user_id": "u350243594"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "var k,a,b,i,t:longint;\nbegin\n readln(k);read(a,b);\n t:=0;\n for i:=a to b do\n if i mod k=0 then\n begin\n t:=1;\n break;\n end;\n if t=0 then write('NG')\n else write('OK');\nend.\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 185, "cpu_time_ms": 1, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s703137854", "group_id": "codeNet:p02693", "input_text": "var a, b, k, i : longint;\n\nbegin\n readln(k);\n readln(a, b);\n for i := a to b do\n begin\n if (i mod k = 0) then \n begin\n writeln('OK');\n halt;\n end;\n end;\n writeln('NG');\nend.", "language": "Pascal", "metadata": {"date": 1588478059, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s703137854.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s703137854", "user_id": "u366795445"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "var a, b, k, i : longint;\n\nbegin\n readln(k);\n readln(a, b);\n for i := a to b do\n begin\n if (i mod k = 0) then \n begin\n writeln('OK');\n halt;\n end;\n end;\n writeln('NG');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 234, "cpu_time_ms": 1, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s354321681", "group_id": "codeNet:p02694", "input_text": "program onepercent;\nvar\n x, current : int64;\n counter : longint;\n\nbegin\n readln(x);\n counter := 0;\n current := 100;\n while not(current >= x) do begin\n current := current + (current div 100);\n counter += 1;\n end;\n writeln(counter);\nend.", "language": "Pascal", "metadata": {"date": 1597181119, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s354321681.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354321681", "user_id": "u583992857"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program onepercent;\nvar\n x, current : int64;\n counter : longint;\n\nbegin\n readln(x);\n counter := 0;\n current := 100;\n while not(current >= x) do begin\n current := current + (current div 100);\n counter += 1;\n end;\n writeln(counter);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 4, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s160774051", "group_id": "codeNet:p02694", "input_text": "program main;\nvar x,d,n : int64;\nbegin\n d:=0;\n x := 100;\n readln(n);\n repeat\n x:=trunc(x*1.01);\n inc(d);\n until (x >= n) ;\n writeln(d);\nend.", "language": "Pascal", "metadata": {"date": 1596727249, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s160774051.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s160774051", "user_id": "u225670189"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar x,d,n : int64;\nbegin\n d:=0;\n x := 100;\n readln(n);\n repeat\n x:=trunc(x*1.01);\n inc(d);\n until (x >= n) ;\n writeln(d);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 164, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s725926439", "group_id": "codeNet:p02694", "input_text": "program main;\nvar\n\tcount, target : int64;\n\tsum : real;\nbegin\n\tread(target);\n sum := 100; \n count := 0;\n repeat\n \tsum := sum * 1.01;\n count := count + 1;\n until sum >= target;\n\t\n writeln(count);\nend.", "language": "Pascal", "metadata": {"date": 1595302835, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s725926439.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s725926439", "user_id": "u522723337"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar\n\tcount, target : int64;\n\tsum : real;\nbegin\n\tread(target);\n sum := 100; \n count := 0;\n repeat\n \tsum := sum * 1.01;\n count := count + 1;\n until sum >= target;\n\t\n writeln(count);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 223, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s608340200", "group_id": "codeNet:p02694", "input_text": "uses math;\nvar\n\tx:int64;\nbegin\n\treadln(x);\n\twriteln(log10(x/100)/log10(1.01):0:0)\nend.", "language": "Pascal", "metadata": {"date": 1594928991, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s608340200.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s608340200", "user_id": "u678829637"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tx:int64;\nbegin\n\treadln(x);\n\twriteln(log10(x/100)/log10(1.01):0:0)\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 6, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s236434005", "group_id": "codeNet:p02694", "input_text": "uses math;\nvar\n\ti,tar,save : int64;\nbegin\n\treadln(tar);\n\tsave:=100;\n i:=0;\n while save= x) then break;\n m := m + (m div 100);\n inc(ans);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1588478984, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s859410162.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s859410162", "user_id": "u366795445"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var x, m : int64;\n ans : longint;\n\nbegin\n readln(x);\n m := 100; ans := 0;\n while (true) do\n begin\n if (m >= x) then break;\n m := m + (m div 100);\n inc(ans);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 3, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s546999926", "group_id": "codeNet:p02699", "input_text": "program SheepandWolves;\nvar \n\tS, W : integer;\nbegin\n\tReadln(S, W);\n\tif W >= S \n\t\tthen writeln('unsafe')\n\t\telse writeln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1597025986, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s546999926.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s546999926", "user_id": "u204635765"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program SheepandWolves;\nvar \n\tS, W : integer;\nbegin\n\tReadln(S, W);\n\tif W >= S \n\t\tthen writeln('unsafe')\n\t\telse writeln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 132, "cpu_time_ms": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s231065497", "group_id": "codeNet:p02699", "input_text": "program HelloWorld;\nvar\n s, w : integer;\nbegin\n readln(s, w);\n if s > w \n then writeln('safe')\n else writeln('unsafe');\nend.\n", "language": "Pascal", "metadata": {"date": 1595452455, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s231065497.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s231065497", "user_id": "u581648177"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program HelloWorld;\nvar\n s, w : integer;\nbegin\n readln(s, w);\n if s > w \n then writeln('safe')\n else writeln('unsafe');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 148, "cpu_time_ms": 6, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s824319547", "group_id": "codeNet:p02699", "input_text": "program main;\nvar\n s, w : integer;\nbegin\n readln(s, w);\n if (s > w) then\n writeln('safe')\n else \n writeln('unsafe');\nend.", "language": "Pascal", "metadata": {"date": 1595400170, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s824319547.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824319547", "user_id": "u151858600"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\nvar\n s, w : integer;\nbegin\n readln(s, w);\n if (s > w) then\n writeln('safe')\n else \n writeln('unsafe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s470700339", "group_id": "codeNet:p02699", "input_text": "program main;\nvar\n\ts, w : integer;\nbegin\n\tread(s, w);\n if w >= s\n \tthen writeln('unsafe')\n \telse writeln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1595299646, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s470700339.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s470700339", "user_id": "u522723337"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\nvar\n\ts, w : integer;\nbegin\n\tread(s, w);\n if w >= s\n \tthen writeln('unsafe')\n \telse writeln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s799324433", "group_id": "codeNet:p02699", "input_text": "program main;\nvar\n\ts, w : integer;\n\nbegin\n\tread(s, w);\n if s < w\n \tthen writeln('unsafe')\n \telse writeln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1595299539, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s799324433.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s799324433", "user_id": "u522723337"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\nvar\n\ts, w : integer;\n\nbegin\n\tread(s, w);\n if s < w\n \tthen writeln('unsafe')\n \telse writeln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620410785", "group_id": "codeNet:p02699", "input_text": "program main;\nvar\n\ts,w:integer;\nbegin\n\treadln(s,w);\n if (w>=s) then writeln('unsafe') else writeln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1594879650, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s620410785.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620410785", "user_id": "u678829637"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\nvar\n\ts,w:integer;\nbegin\n\treadln(s,w);\n if (w>=s) then writeln('unsafe') else writeln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s125568243", "group_id": "codeNet:p02699", "input_text": "var a,b:longint;\nbegin\n readln(a,b);\n if a<=b then write('un');\n writeln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1588288011, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s125568243.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s125568243", "user_id": "u743614777"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "var a,b:longint;\nbegin\n readln(a,b);\n if a<=b then write('un');\n writeln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 89, "cpu_time_ms": 1, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s268790712", "group_id": "codeNet:p02701", "input_text": "var\n\tarr : array[0..2068,1..2000] of string;\n s:string;\n i,j,n,temp,cnt:longint;\nfunction hash(s:string):integer;\nvar\n\ti:integer;\n sum:longint;\nbegin\n\tsum:=0;\n\tfor i:=1 to length(s) do begin\n \tsum:=(ord(s[i])*i)+sum;\n\tend;\n hash:=(sum mod 2069);\nend;\nbegin\n\tcnt:=0;\n\tfor i:=0 to 2068 do \n \tfor j:=1 to 2000 do arr[i][j]:='.';\n\treadln(n);\n for i:=1 to n do begin\n \treadln(s);\n cnt:=cnt+1;\n j:=1;\n temp:=hash(s);\n while (arr[temp][j]<>'.') and (arr[temp][j]<>s) do begin\n \tj:=j+1;\n end;\n if (arr[temp][j]=s) then begin\n \tcnt:=cnt-1;\n \tcontinue;\n end;\n if arr[temp][j]<>'.' then continue\n else arr[temp][j]:=s;\n end;\n\twriteln(cnt);\nend.\n \n \n ", "language": "Pascal", "metadata": {"date": 1596870172, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s268790712.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s268790712", "user_id": "u678829637"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tarr : array[0..2068,1..2000] of string;\n s:string;\n i,j,n,temp,cnt:longint;\nfunction hash(s:string):integer;\nvar\n\ti:integer;\n sum:longint;\nbegin\n\tsum:=0;\n\tfor i:=1 to length(s) do begin\n \tsum:=(ord(s[i])*i)+sum;\n\tend;\n hash:=(sum mod 2069);\nend;\nbegin\n\tcnt:=0;\n\tfor i:=0 to 2068 do \n \tfor j:=1 to 2000 do arr[i][j]:='.';\n\treadln(n);\n for i:=1 to n do begin\n \treadln(s);\n cnt:=cnt+1;\n j:=1;\n temp:=hash(s);\n while (arr[temp][j]<>'.') and (arr[temp][j]<>s) do begin\n \tj:=j+1;\n end;\n if (arr[temp][j]=s) then begin\n \tcnt:=cnt-1;\n \tcontinue;\n end;\n if arr[temp][j]<>'.' then continue\n else arr[temp][j]:=s;\n end;\n\twriteln(cnt);\nend.\n \n \n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 771, "cpu_time_ms": 2208, "memory_kb": 88960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s025384804", "group_id": "codeNet:p02701", "input_text": "program hi;\ntype ars = array[1..200000] of string;\nvar \n n, i, cnt: longint;\n s, tmp: ars;\n \nprocedure mSort(var a, tmp: ars; l, r: longint);\nvar m, i, i1, i2: longint;\nbegin\n if l < r then begin\n m := (l + r) div 2;\n mSort(a, tmp, l, m);\n mSort(a, tmp, m + 1, r);\n i := l; i1 := l; i2 := m + 1;\n while (i1 <= m) and (i2 <= r) do begin\n if a[i1] <= a[i2] then begin\n tmp[i] := a[i1];\n inc(i1);\n end else begin\n tmp[i] := a[i2];\n inc(i2);\n end;\n inc(i);\n end;\n while i1 <= m do begin\n tmp[i] := a[i1];\n inc(i1); inc(i);\n end;\n while i2 <= r do begin\n tmp[i] := a[i2];\n inc(i2); inc(i);\n end;\n for i := l to r do \n a[i] := tmp[i];\n end;\nend;\n \nbegin\n readln(n);\n for i := 1 to n do \n readln(s[i]);\n mSort(s, tmp, 1, n);\n cnt := 1;\n for i := 1 to n - 1 do \n if s[i] <> s[i + 1] then\n inc(cnt);\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596728514, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s025384804.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s025384804", "user_id": "u051422473"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program hi;\ntype ars = array[1..200000] of string;\nvar \n n, i, cnt: longint;\n s, tmp: ars;\n \nprocedure mSort(var a, tmp: ars; l, r: longint);\nvar m, i, i1, i2: longint;\nbegin\n if l < r then begin\n m := (l + r) div 2;\n mSort(a, tmp, l, m);\n mSort(a, tmp, m + 1, r);\n i := l; i1 := l; i2 := m + 1;\n while (i1 <= m) and (i2 <= r) do begin\n if a[i1] <= a[i2] then begin\n tmp[i] := a[i1];\n inc(i1);\n end else begin\n tmp[i] := a[i2];\n inc(i2);\n end;\n inc(i);\n end;\n while i1 <= m do begin\n tmp[i] := a[i1];\n inc(i1); inc(i);\n end;\n while i2 <= r do begin\n tmp[i] := a[i2];\n inc(i2); inc(i);\n end;\n for i := l to r do \n a[i] := tmp[i];\n end;\nend;\n \nbegin\n readln(n);\n for i := 1 to n do \n readln(s[i]);\n mSort(s, tmp, 1, n);\n cnt := 1;\n for i := 1 to n - 1 do \n if s[i] <> s[i + 1] then\n inc(cnt);\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1101, "cpu_time_ms": 322, "memory_kb": 59980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s029010403", "group_id": "codeNet:p02701", "input_text": "program main;\nvar n,i,j,c : longint;\n a : array[1..200000] of string;\n t : boolean;\nbegin\n c := 0;\n t := true;\n readln(n);\n for i := 1 to n do begin\n readln(a[i]);\n if i > 1 then\n for j := 1 to i-1 do\n if a[i] = a[j]\n then t := false;\n if t = true\n then inc(c)\n else t := true;\n end;\n writeln(c);\nend.", "language": "Pascal", "metadata": {"date": 1596727801, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s029010403.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s029010403", "user_id": "u225670189"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar n,i,j,c : longint;\n a : array[1..200000] of string;\n t : boolean;\nbegin\n c := 0;\n t := true;\n readln(n);\n for i := 1 to n do begin\n readln(a[i]);\n if i > 1 then\n for j := 1 to i-1 do\n if a[i] = a[j]\n then t := false;\n if t = true\n then inc(c)\n else t := true;\n end;\n writeln(c);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 2205, "memory_kb": 4668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s469164589", "group_id": "codeNet:p02701", "input_text": "program hi;\ntype ars = array[1..200000] of string;\nvar \n n, i, cnt: longint;\n s, tmp: ars;\n\nprocedure mSort(var a, tmp: ars; l, r: longint);\nvar m, i, i1, i2: longint;\nbegin\n if l < r then begin\n m := (l + r) div 2;\n mSort(a, tmp, l, m);\n mSort(a, tmp, m + 1, r);\n i := l; i1 := l; i2 := m + 1;\n while (i1 <= m) and (i2 <= r) do begin\n if a[i1] <= a[i2] then begin\n tmp[i] := a[i1];\n inc(i1);\n end else begin\n tmp[i] := a[i2];\n inc(i2);\n end;\n inc(i);\n end;\n if i1 <= m then \n while i1 <= m do begin\n tmp[i] := a[i1];\n inc(i1); inc(i);\n end \n else while i2 <= r do begin\n tmp[i] := a[i2];\n inc(i1); inc(i);\n end;\n for i := l to r do \n a[i] := tmp[i];\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(s[i]);\n mSort(s, tmp, 1, n);\n cnt := 1;\n for i := 1 to n - 1 do \n if s[i] <> s[i + 1] then\n inc(cnt);\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596727250, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s469164589.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s469164589", "user_id": "u051422473"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program hi;\ntype ars = array[1..200000] of string;\nvar \n n, i, cnt: longint;\n s, tmp: ars;\n\nprocedure mSort(var a, tmp: ars; l, r: longint);\nvar m, i, i1, i2: longint;\nbegin\n if l < r then begin\n m := (l + r) div 2;\n mSort(a, tmp, l, m);\n mSort(a, tmp, m + 1, r);\n i := l; i1 := l; i2 := m + 1;\n while (i1 <= m) and (i2 <= r) do begin\n if a[i1] <= a[i2] then begin\n tmp[i] := a[i1];\n inc(i1);\n end else begin\n tmp[i] := a[i2];\n inc(i2);\n end;\n inc(i);\n end;\n if i1 <= m then \n while i1 <= m do begin\n tmp[i] := a[i1];\n inc(i1); inc(i);\n end \n else while i2 <= r do begin\n tmp[i] := a[i2];\n inc(i1); inc(i);\n end;\n for i := l to r do \n a[i] := tmp[i];\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(s[i]);\n mSort(s, tmp, 1, n);\n cnt := 1;\n for i := 1 to n - 1 do \n if s[i] <> s[i + 1] then\n inc(cnt);\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1145, "cpu_time_ms": 81, "memory_kb": 59948}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s062001314", "group_id": "codeNet:p02701", "input_text": "program gacha;\ntype \n arr = array[1..200000] of string;\n\nvar\n n, i, count : longint;\n list : arr;\n\nprocedure swap(var x: string; var y: string);\nvar tmp: string;\nbegin\n tmp := x;\n x := y;\n y := tmp;\nend;\n\nprocedure quicksort(var x: arr; left, right: longint);\nvar \n i, j: integer;\n k: string;\n\nbegin\n if (left < right) then begin \n k := x[left]; \n i := left; j := right;\n repeat \n while (x[i] < k) and (i < right) do \n i := i + 1;\n while (x[j] >= k) and (j > left) do \n j := j - 1;\n if (i < j) then \n swap(x[i], x[j])\n until (i >= j);\n quicksort(x, left, j);\n quicksort(x, j + 1, right);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(list[i]);\n quicksort(list, 1, n);\n count := 1;\n for i := 2 to n do begin\n if list[i - 1] <> list[i] then \n inc(count);\n end;\n writeln(count);\nend.", "language": "Pascal", "metadata": {"date": 1596691163, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s062001314.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s062001314", "user_id": "u583992857"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program gacha;\ntype \n arr = array[1..200000] of string;\n\nvar\n n, i, count : longint;\n list : arr;\n\nprocedure swap(var x: string; var y: string);\nvar tmp: string;\nbegin\n tmp := x;\n x := y;\n y := tmp;\nend;\n\nprocedure quicksort(var x: arr; left, right: longint);\nvar \n i, j: integer;\n k: string;\n\nbegin\n if (left < right) then begin \n k := x[left]; \n i := left; j := right;\n repeat \n while (x[i] < k) and (i < right) do \n i := i + 1;\n while (x[j] >= k) and (j > left) do \n j := j - 1;\n if (i < j) then \n swap(x[i], x[j])\n until (i >= j);\n quicksort(x, left, j);\n quicksort(x, j + 1, right);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(list[i]);\n quicksort(list, 1, n);\n count := 1;\n for i := 2 to n do begin\n if list[i - 1] <> list[i] then \n inc(count);\n end;\n writeln(count);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 990, "cpu_time_ms": 2207, "memory_kb": 59948}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s386403115", "group_id": "codeNet:p02701", "input_text": "program gacha;\nvar\n n, i, j, x : longint;\n list : array[1..200000] of string;\n new : boolean;\nbegin\n readln(n);\n x := 1;\n for i := 1 to n do begin\n readln(list[i]);\n new := false;\n if (i > 1) then begin\n for j := 1 to i - 1 do begin\n if (list[j] = list[i]) then break\n else new := true;\n end;\n end;\n if new then x += 1;\n end;\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1596604028, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s386403115.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s386403115", "user_id": "u583992857"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program gacha;\nvar\n n, i, j, x : longint;\n list : array[1..200000] of string;\n new : boolean;\nbegin\n readln(n);\n x := 1;\n for i := 1 to n do begin\n readln(list[i]);\n new := false;\n if (i > 1) then begin\n for j := 1 to i - 1 do begin\n if (list[j] = list[i]) then break\n else new := true;\n end;\n end;\n if new then x += 1;\n end;\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 458, "cpu_time_ms": 2205, "memory_kb": 58408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s941017242", "group_id": "codeNet:p02701", "input_text": "type SortDataType=String;\nfunction SortCmp(const a,b:SortDataType):Boolean;forward;\nprocedure SortImpl(var A:Array of SortDataType;L,R:Longint);\nvar\n\ttmp:SortDataType;\n\tmid,il,ir:Longint;\nbegin\n\tif R-L<20 then begin\n\t\tfor ir:=R-1 downto L+1 do for il:=L to ir-1 do if SortCmp(A[il+1],A[il])then begin\n\t\t\ttmp:=A[il];\n\t\t\tA[il]:=A[il+1];\n\t\t\tA[il+1]:=tmp;\n\t\tend;\n\tend else begin\n\t\tmid:=(L+R)div 2;\n\t\tif SortCmp(A[mid],A[L])then begin\n\t\t\ttmp:=A[mid];\n\t\t\tA[mid]:=A[L];\n\t\t\tA[L]:=tmp;\n\t\tend;\n\t\tif SortCmp(A[R-1],A[mid])then begin\n\t\t\ttmp:=A[R-1];\n\t\t\tA[R-1]:=A[mid];\n\t\t\tA[mid]:=tmp;\n\t\t\tif SortCmp(A[mid],A[L])then begin\n\t\t\t\ttmp:=A[mid];\n\t\t\t\tA[mid]:=A[L];\n\t\t\t\tA[L]:=tmp;\n\t\t\tend;\n\t\tend;\n\t\til:=L;\n\t\tir:=R-1;\n\t\twhile il<=ir do begin\n\t\t\twhile SortCmp(A[il],A[mid])do inc(il);\n\t\t\twhile SortCmp(A[mid],A[ir])do dec(ir);\n\t\t\tif il= 0) then writeln(n)\n else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1596589102, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s139746324.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139746324", "user_id": "u583992857"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program HW;\nvar\n n, m, x, i : Longint;\nbegin\n readln(n, m);\n for i := 1 to m do begin\n read(x);\n n -= x;\n end;\n if (n >= 0) then writeln(n)\n else writeln(-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 8, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s706590328", "group_id": "codeNet:p02706", "input_text": "program train;\nvar \n n, m, i, x : longint;\nbegin\n read(n, m);\n for i := 1 to m do begin\n read(x);\n n := n - x;\n end;\n if n < 0 \n then write('-1')\n else write(n);\nend. ", "language": "Pascal", "metadata": {"date": 1596582284, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s706590328.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s706590328", "user_id": "u999320099"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program train;\nvar \n n, m, i, x : longint;\nbegin\n read(n, m);\n for i := 1 to m do begin\n read(x);\n n := n - x;\n end;\n if n < 0 \n then write('-1')\n else write(n);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s369417261", "group_id": "codeNet:p02706", "input_text": "program train;\nvar \n n, m, i, x : longint;\nbegin\n read(n, m);\n for i := 1 to m do begin\n read(x);\n n := n - x;\n end;\n write(n);\nend. \n", "language": "Pascal", "metadata": {"date": 1596582139, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s369417261.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s369417261", "user_id": "u999320099"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program train;\nvar \n n, m, i, x : longint;\nbegin\n read(n, m);\n for i := 1 to m do begin\n read(x);\n n := n - x;\n end;\n write(n);\nend. \n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 170, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s955096434", "group_id": "codeNet:p02706", "input_text": "program train;\nvar \n n, m, i, x : integer;\nbegin\n read(n, m);\n for i := 1 to m do begin\n read(x);\n n := n - x;\n end;\n write(n);\nend. ", "language": "Pascal", "metadata": {"date": 1596582054, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s955096434.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s955096434", "user_id": "u999320099"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program train;\nvar \n n, m, i, x : integer;\nbegin\n read(n, m);\n for i := 1 to m do begin\n read(x);\n n := n - x;\n end;\n write(n);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 5, "memory_kb": 1348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s824852602", "group_id": "codeNet:p02706", "input_text": "program main;\nvar\n\tn, m, i, sum : longint;\n a : array[1..10005] of longint;\nbegin\n\tsum := 0;\n\treadln(n,m);\n\tfor i := 1 to m do a[i] := 0;\n for i := 1 to m do begin\n \tread(a[i]);\n sum := sum + a[i];\n end;\n if sum > n \n \tthen writeln(-1)\n \telse writeln(n-sum);\nend.", "language": "Pascal", "metadata": {"date": 1596518068, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s824852602.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824852602", "user_id": "u068203622"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main;\nvar\n\tn, m, i, sum : longint;\n a : array[1..10005] of longint;\nbegin\n\tsum := 0;\n\treadln(n,m);\n\tfor i := 1 to m do a[i] := 0;\n for i := 1 to m do begin\n \tread(a[i]);\n sum := sum + a[i];\n end;\n if sum > n \n \tthen writeln(-1)\n \telse writeln(n-sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 6, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s412562477", "group_id": "codeNet:p02706", "input_text": "program hihi;\nvar \n\tN : longint;\n M, i : integer;\n A : array[1..10000] of integer;\n \nbegin \n\treadln(N, M);\n for i:=1 to M do begin\n \tread(A[i]);\n \tN := N - A[i];\n end;\n if N<0 \n \tthen N:=-1;\n writeln(N);\nend.", "language": "Pascal", "metadata": {"date": 1596509415, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s412562477.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s412562477", "user_id": "u303822545"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program hihi;\nvar \n\tN : longint;\n M, i : integer;\n A : array[1..10000] of integer;\n \nbegin \n\treadln(N, M);\n for i:=1 to M do begin\n \tread(A[i]);\n \tN := N - A[i];\n end;\n if N<0 \n \tthen N:=-1;\n writeln(N);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 4, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s126337309", "group_id": "codeNet:p02706", "input_text": "program Homework;\nvar\n\tsum, i, N, M, a : integer;\nbegin\n\tsum := 0;\n\treadln(N, M);\n\tfor i := 1 to m do begin\n\t\tread(a);\n\t\tsum := sum + a;\n\tend;\n\tif N >= sum\n\t\tthen writeln(N - sum)\n\t\telse writeln('-1');\nend.", "language": "Pascal", "metadata": {"date": 1596394999, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s126337309.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s126337309", "user_id": "u204635765"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program Homework;\nvar\n\tsum, i, N, M, a : integer;\nbegin\n\tsum := 0;\n\treadln(N, M);\n\tfor i := 1 to m do begin\n\t\tread(a);\n\t\tsum := sum + a;\n\tend;\n\tif N >= sum\n\t\tthen writeln(N - sum)\n\t\telse writeln('-1');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 206, "cpu_time_ms": 4, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s926319272", "group_id": "codeNet:p02706", "input_text": "program main;\nvar\n n : LongInt;\n m, i, a : integer;\nbegin\n readln(n, m);\n for i := 1 to m do begin\n read(a);\n n := n - a;\n end;\n\n if n < 0 then\n writeln(-1)\n else\n writeln(n);\nend.", "language": "Pascal", "metadata": {"date": 1595817977, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s926319272.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s926319272", "user_id": "u085059942"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main;\nvar\n n : LongInt;\n m, i, a : integer;\nbegin\n readln(n, m);\n for i := 1 to m do begin\n read(a);\n n := n - a;\n end;\n\n if n < 0 then\n writeln(-1)\n else\n writeln(n);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 3, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s418160145", "group_id": "codeNet:p02706", "input_text": "program main;\nvar\n i,j,k:integer;\n sum,n,m,haha:Int64;\nbegin\n readln(n,m);\n sum:=0;\n for i:=1 to m do begin\n read(haha);\n sum:=sum+haha;\n end;\n if (n-sum>=0) then writeln(n-sum) else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1594879542, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s418160145.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s418160145", "user_id": "u678829637"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main;\nvar\n i,j,k:integer;\n sum,n,m,haha:Int64;\nbegin\n readln(n,m);\n sum:=0;\n for i:=1 to m do begin\n read(haha);\n sum:=sum+haha;\n end;\n if (n-sum>=0) then writeln(n-sum) else writeln(-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s955017996", "group_id": "codeNet:p02706", "input_text": "uses math;\nvar n,m,i,t:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(t);\n dec(n,t);\n end;\n writeln(max(n,-1));\nend.", "language": "Pascal", "metadata": {"date": 1588705049, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s955017996.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s955017996", "user_id": "u476418095"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "uses math;\nvar n,m,i,t:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(t);\n dec(n,t);\n end;\n writeln(max(n,-1));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 2, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s768373309", "group_id": "codeNet:p02707", "input_text": "program main;\nvar \n n, i, temp : integer;\n a : array[1..20000] of integer;\n\nbegin\n readln(n);\n\n for i := 1 to n do \n a[i] := 0;\n\n for i := 2 to n do begin\n read(temp);\n a[temp] := a[temp] + 1;\n end;\n\n for i := 1 to n do \n writeln(a[i]);\n write(a[n])\nend.\n", "language": "Pascal", "metadata": {"date": 1597334422, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s768373309.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s768373309", "user_id": "u151858600"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main;\nvar \n n, i, temp : integer;\n a : array[1..20000] of integer;\n\nbegin\n readln(n);\n\n for i := 1 to n do \n a[i] := 0;\n\n for i := 2 to n do begin\n read(temp);\n a[temp] := a[temp] + 1;\n end;\n\n for i := 1 to n do \n writeln(a[i]);\n write(a[n])\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 9, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s833560592", "group_id": "codeNet:p02707", "input_text": "program main;\nvar \n n, i, temp : integer;\n a : array[1..20000] of integer;\n\nbegin\n readln(n);\n\n for i := 1 to n do \n a[i] := 0;\n\n for i := 2 to n do begin\n read(temp);\n a[temp] := a[temp] + 1;\n end;\n\n for i := 1 to n do \n writeln(a[i]);\nend.\n", "language": "Pascal", "metadata": {"date": 1597334343, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s833560592.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s833560592", "user_id": "u151858600"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main;\nvar \n n, i, temp : integer;\n a : array[1..20000] of integer;\n\nbegin\n readln(n);\n\n for i := 1 to n do \n a[i] := 0;\n\n for i := 2 to n do begin\n read(temp);\n a[temp] := a[temp] + 1;\n end;\n\n for i := 1 to n do \n writeln(a[i]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 5, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s932288793", "group_id": "codeNet:p02707", "input_text": "program main;\nvar\n i, n, x : longint;\n A : array[1..200000] of longint;\nbegin\n readln(n);\n for i := 1 to n do \n A[i] := 0;\n for i := 1 to n do begin\n read(x);\n A[x] := A[x] + 1;\n end;\n for i := 1 to n do \n writeln(A[i]);\nend.", "language": "Pascal", "metadata": {"date": 1596664757, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s932288793.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s932288793", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main;\nvar\n i, n, x : longint;\n A : array[1..200000] of longint;\nbegin\n readln(n);\n for i := 1 to n do \n A[i] := 0;\n for i := 1 to n do begin\n read(x);\n A[x] := A[x] + 1;\n end;\n for i := 1 to n do \n writeln(A[i]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 274, "cpu_time_ms": 42, "memory_kb": 1396}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s002963663", "group_id": "codeNet:p02707", "input_text": "program main;\nvar\n i, n, x, count, int : int64;\nbegin\n int := 1;\n readln(n);\n count := 0;\n for i := 1 to n-1 do begin\n read(x);\n if x = int\n then begin\n count := count + 1;\n if i = n-1 \n then writeln(count);\n end\n else begin\n writeln(count);\n count := 1;\n int := x;\n if i = n-1 \n then writeln(count);\n end;\n end;\n for i := int+1 to n do \n writeln('0');\nend.", "language": "Pascal", "metadata": {"date": 1596661189, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s002963663.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s002963663", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main;\nvar\n i, n, x, count, int : int64;\nbegin\n int := 1;\n readln(n);\n count := 0;\n for i := 1 to n-1 do begin\n read(x);\n if x = int\n then begin\n count := count + 1;\n if i = n-1 \n then writeln(count);\n end\n else begin\n writeln(count);\n count := 1;\n int := x;\n if i = n-1 \n then writeln(count);\n end;\n end;\n for i := int+1 to n do \n writeln('0');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 571, "cpu_time_ms": 45, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s960701297", "group_id": "codeNet:p02707", "input_text": "program main;\nvar\n i, n, x, count, int : longint;\nbegin\n int := 1;\n readln(n);\n count := 0;\n for i := 1 to n-1 do begin\n read(x);\n if x = int\n then begin\n count := count + 1;\n if i = n-1 \n then writeln(count);\n end\n else begin\n writeln(count);\n count := 1;\n int := x;\n if i = n-1 \n then writeln(count);\n end;\n end;\n for i := int+1 to n do \n writeln('0');\nend.", "language": "Pascal", "metadata": {"date": 1596660884, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s960701297.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s960701297", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main;\nvar\n i, n, x, count, int : longint;\nbegin\n int := 1;\n readln(n);\n count := 0;\n for i := 1 to n-1 do begin\n read(x);\n if x = int\n then begin\n count := count + 1;\n if i = n-1 \n then writeln(count);\n end\n else begin\n writeln(count);\n count := 1;\n int := x;\n if i = n-1 \n then writeln(count);\n end;\n end;\n for i := int+1 to n do \n writeln('0');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 573, "cpu_time_ms": 46, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s398313192", "group_id": "codeNet:p02707", "input_text": "Var b:Array[0 .. 200000] of Longint;\n a,n,i:Longint;\nBegin\n Readln(n);\n For i:=2 to n do begin\n Read(a);\n Inc(b[a]);\n End;\n For i:=1 to n do writeln(b[i]);\nEnd.", "language": "Pascal", "metadata": {"date": 1587345749, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s398313192.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s398313192", "user_id": "u866155170"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "Var b:Array[0 .. 200000] of Longint;\n a,n,i:Longint;\nBegin\n Readln(n);\n For i:=2 to n do begin\n Read(a);\n Inc(b[a]);\n End;\n For i:=1 to n do writeln(b[i]);\nEnd.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 37, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s809989020", "group_id": "codeNet:p02708", "input_text": "program Sum_of_Large_Numbers;\nvar\n n, k: int64;\nbegin\n read(n, k);\n writeln(((3*(n+1)*(n+k+1)*(n-k+2)+6*(n-k+2)-(n+1)*(n+2)*(2*n+3)+(k-1)*k*(2*k-1)) div 6) mod 1000000007);\nend.", "language": "Pascal", "metadata": {"date": 1587360264, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Pascal/s809989020.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s809989020", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program Sum_of_Large_Numbers;\nvar\n n, k: int64;\nbegin\n read(n, k);\n writeln(((3*(n+1)*(n+k+1)*(n-k+2)+6*(n-k+2)-(n+1)*(n+2)*(2*n+3)+(k-1)*k*(2*k-1)) div 6) mod 1000000007);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 180, "cpu_time_ms": 1, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s865172162", "group_id": "codeNet:p02708", "input_text": "program Sum_of_Large_Numbers;\nconst\n m: int64 = 1000000007;\n h: int64 = 500000004;\n s: int64 = 166666668;\nvar\n n, k: int64;\nfunction f(i: int64): int64;\nbegin\n f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);\nend;\nbegin\n read(n, k);\n writeln((m+(f(n+1)-f(k-1)) mod m) mod m);\nend.", "language": "Pascal", "metadata": {"date": 1587359776, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Pascal/s865172162.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s865172162", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program Sum_of_Large_Numbers;\nconst\n m: int64 = 1000000007;\n h: int64 = 500000004;\n s: int64 = 166666668;\nvar\n n, k: int64;\nfunction f(i: int64): int64;\nbegin\n f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);\nend;\nbegin\n read(n, k);\n writeln((m+(f(n+1)-f(k-1)) mod m) mod m);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 312, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s124073221", "group_id": "codeNet:p02712", "input_text": "program train;\nvar \n n, i : longint;\n sum : Int64;\nbegin\n read(n);\n sum := 0;\n for i := 1 to n do \n if not ((i mod 3) = 0) and not ((i mod 5) = 0)\n then sum := sum + i;\n write(sum);\nend. ", "language": "Pascal", "metadata": {"date": 1595959897, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s124073221.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s124073221", "user_id": "u999320099"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program train;\nvar \n n, i : longint;\n sum : Int64;\nbegin\n read(n);\n sum := 0;\n for i := 1 to n do \n if not ((i mod 3) = 0) and not ((i mod 5) = 0)\n then sum := sum + i;\n write(sum);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 21, "memory_kb": 1336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s641816290", "group_id": "codeNet:p02712", "input_text": "program train;\nvar \n n, i : int64;\n sum : Int64;\nbegin\n read(n);\n sum := 0;\n for i := 1 to n do \n if ((i mod 3) = 0) or ((i mod 5) = 0)\n then sum := sum + i;\n write(sum);\nend. ", "language": "Pascal", "metadata": {"date": 1595959353, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s641816290.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s641816290", "user_id": "u999320099"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program train;\nvar \n n, i : int64;\n sum : Int64;\nbegin\n read(n);\n sum := 0;\n for i := 1 to n do \n if ((i mod 3) = 0) or ((i mod 5) = 0)\n then sum := sum + i;\n write(sum);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 22, "memory_kb": 1336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s400468216", "group_id": "codeNet:p02712", "input_text": "program FizzBuzzSum;\nvar\n\tn, sum, i : int64; \nbegin\t\n\tsum := 0;\n\treadln(n);\n\ti := 1;\n\twhile i <= n do begin\n\t\tif ( i mod 3 <> 0 )\n\t\t\tthen if ( i mod 5 <> 0 )\n\t\t\t\t\tthen sum := sum + i;\n\t\ti := i + 1;\n\tend;\n\t\t\n\twriteln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595440494, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s400468216.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s400468216", "user_id": "u204635765"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program FizzBuzzSum;\nvar\n\tn, sum, i : int64; \nbegin\t\n\tsum := 0;\n\treadln(n);\n\ti := 1;\n\twhile i <= n do begin\n\t\tif ( i mod 3 <> 0 )\n\t\t\tthen if ( i mod 5 <> 0 )\n\t\t\t\t\tthen sum := sum + i;\n\t\ti := i + 1;\n\tend;\n\t\t\n\twriteln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 26, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s819045533", "group_id": "codeNet:p02712", "input_text": "program main;\nvar N, i, sum : Longint;\n c, b : real;\n A : array[1..1000000] of LongInt;\nbegin\n\tread(N);\n sum := 0;\n for i := 1 to N do begin\n c := frac(i / 3);\n b := frac(i / 5);\n if (c = 0) or (b = 0)\n then A[i] := 0\n else A[i] := i;\n sum := sum + A[i];\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595440052, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s819045533.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s819045533", "user_id": "u384260326"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar N, i, sum : Longint;\n c, b : real;\n A : array[1..1000000] of LongInt;\nbegin\n\tread(N);\n sum := 0;\n for i := 1 to N do begin\n c := frac(i / 3);\n b := frac(i / 5);\n if (c = 0) or (b = 0)\n then A[i] := 0\n else A[i] := i;\n sum := sum + A[i];\n end;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 66, "memory_kb": 4104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s940203775", "group_id": "codeNet:p02712", "input_text": "program HelloWorld;\nvar\n i, n, sum : int64;\nbegin\n readln(n);\n sum := 0;\n for i := 1 to n do \n if (i mod 3 <> 0) and (i mod 5 <> 0)\n then sum := sum + i;\n writeln(sum);\nend.\n", "language": "Pascal", "metadata": {"date": 1595438550, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s940203775.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s940203775", "user_id": "u581648177"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program HelloWorld;\nvar\n i, n, sum : int64;\nbegin\n readln(n);\n sum := 0;\n for i := 1 to n do \n if (i mod 3 <> 0) and (i mod 5 <> 0)\n then sum := sum + i;\n writeln(sum);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 24, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s874970553", "group_id": "codeNet:p02712", "input_text": "program main;\nvar\n n, i : int64;\nbegin\n readln(n);\n writeln(((1 + n) * n div 2) - (((3 * (n div 3)) + 3) * (n div 3) div 2) -(((5 * (n div 5)) + 5) * (n div 5) div 2) + (((15 * (n div 15)) + 15) * (n div 15) div 2))\nend.", "language": "Pascal", "metadata": {"date": 1595398767, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s874970553.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874970553", "user_id": "u151858600"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar\n n, i : int64;\nbegin\n readln(n);\n writeln(((1 + n) * n div 2) - (((3 * (n div 3)) + 3) * (n div 3) div 2) -(((5 * (n div 5)) + 5) * (n div 5) div 2) + (((15 * (n div 15)) + 15) * (n div 15) div 2))\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s772779513", "group_id": "codeNet:p02712", "input_text": "program main;\nvar\n\tnum, i, sum : int64;\nbegin\n\tread(num);\n \n sum := 0;\n \n for i := 1 to num do begin\n \tif (frac(i/3) = 0) or (frac(i/5) = 0)\n \tthen sum := sum + 0\n \t else sum := sum + i;\n end;\n \twriteln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595298292, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s772779513.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s772779513", "user_id": "u522723337"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar\n\tnum, i, sum : int64;\nbegin\n\tread(num);\n \n sum := 0;\n \n for i := 1 to num do begin\n \tif (frac(i/3) = 0) or (frac(i/5) = 0)\n \tthen sum := sum + 0\n \t else sum := sum + i;\n end;\n \twriteln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 248, "cpu_time_ms": 53, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s843652584", "group_id": "codeNet:p02712", "input_text": "program main;\nvar\n i,j,k:integer;\n n:longint;\n sum:longint;\nbegin\n readln(n);\n sum:=0;\n for i:=1 to n do if ((i mod 3) <> 0) and ((i mod 5) <> 0) then sum:=sum+i;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1594878921, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s843652584.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s843652584", "user_id": "u678829637"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar\n i,j,k:integer;\n n:longint;\n sum:longint;\nbegin\n readln(n);\n sum:=0;\n for i:=1 to n do if ((i mod 3) <> 0) and ((i mod 5) <> 0) then sum:=sum+i;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 29, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s141592608", "group_id": "codeNet:p02712", "input_text": "program FizzBuzzSum;\nvar\n x, i : Longint;\n sum : int64;\nbegin\n readln(x);\n sum := 0;\n for i := 1 to x do begin\n if (((i mod 3) <> 0) and ((i mod 5) <> 0)) then begin\n sum += i;\n end;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1594857867, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s141592608.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s141592608", "user_id": "u583992857"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program FizzBuzzSum;\nvar\n x, i : Longint;\n sum : int64;\nbegin\n readln(x);\n sum := 0;\n for i := 1 to x do begin\n if (((i mod 3) <> 0) and ((i mod 5) <> 0)) then begin\n sum += i;\n end;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 23, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s342232619", "group_id": "codeNet:p02712", "input_text": "var\n i,n:longint;\n s:int64;\nbegin\n readln(n);\n for i:=1 to n do\n if (i mod 3<>0) and (i mod 5<>0) then s:=s+i;\n writeln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1587600314, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s342232619.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s342232619", "user_id": "u426964396"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "var\n i,n:longint;\n s:int64;\nbegin\n readln(n);\n for i:=1 to n do\n if (i mod 3<>0) and (i mod 5<>0) then s:=s+i;\n writeln(s);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 21, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s636887461", "group_id": "codeNet:p02716", "input_text": "var\n\tN,i,a,j,ni,nj:Longint;\n\tdp:Array[0..100000,0..3]of int64;\nbegin\nread(N);\nfor i:=0 to N do for j:=0 to 2 do dp[i,j]:=-1000000000000000000;\ndp[0,0]:=0;\nfor i:=0 to N-1 do begin\nread(a);\nfor j:=0 to 2 do begin\nif dp[i+1,j+1]N then ni:=N;\nnj:=j;if i+2=N then inc(nj);\nif dp[ni,nj]N then ni:=N;\nnj:=j;if i+2=N then inc(nj);\nif dp[ni,nj] abs(n mod k)\n then writeln(abs(n mod k))\n else writeln(abs((n mod k)-k));\nend.", "language": "Pascal", "metadata": {"date": 1596592165, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s621919338.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s621919338", "user_id": "u225670189"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar n,k : int64;\nbegin\n readln(n,k);\n if abs((n mod k)-k) > abs(n mod k)\n then writeln(abs(n mod k))\n else writeln(abs((n mod k)-k));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 164, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s221701256", "group_id": "codeNet:p02719", "input_text": "program main;\nvar\n a,n,m : longint;\nbegin\n readln(n,m);\n a := n mod m;\n if abs(a-m) < abs(a)\n then writeln(abs(a-m))\n else writeln(abs(a));\nend.", "language": "Pascal", "metadata": {"date": 1596518862, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s221701256.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s221701256", "user_id": "u068203622"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar\n a,n,m : longint;\nbegin\n readln(n,m);\n a := n mod m;\n if abs(a-m) < abs(a)\n then writeln(abs(a-m))\n else writeln(abs(a));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 170, "cpu_time_ms": 6, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s410552560", "group_id": "codeNet:p02719", "input_text": "program main;\nvar\n a,n,m : longint;\nbegin\n readln(n,m);\n a := n mod m;\n if abs(a-m) < a\n then writeln(abs(a-m))\n else writeln(a);\nend.", "language": "Pascal", "metadata": {"date": 1596518564, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s410552560.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s410552560", "user_id": "u068203622"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar\n a,n,m : longint;\nbegin\n readln(n,m);\n a := n mod m;\n if abs(a-m) < a\n then writeln(abs(a-m))\n else writeln(a);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 160, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s979696045", "group_id": "codeNet:p02719", "input_text": "program hihi;\nvar \n\tN, K, result : longint;\nbegin\n\treadln(N, K);\n if N >=K \n \tthen result := N mod K\n \telse result := N;\n writeln(result);\nend.", "language": "Pascal", "metadata": {"date": 1596509881, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s979696045.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s979696045", "user_id": "u303822545"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program hihi;\nvar \n\tN, K, result : longint;\nbegin\n\treadln(N, K);\n if N >=K \n \tthen result := N mod K\n \telse result := N;\n writeln(result);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 155, "cpu_time_ms": 2, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s179451761", "group_id": "codeNet:p02719", "input_text": "program hihi;\nvar \n\tN, K, result : longint;\nbegin\n\treadln(N, K);\n if N >K \n \tthen result := N mod K\n \telse result := N;\n writeln(result);\nend.", "language": "Pascal", "metadata": {"date": 1596509828, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s179451761.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s179451761", "user_id": "u303822545"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program hihi;\nvar \n\tN, K, result : longint;\nbegin\n\treadln(N, K);\n if N >K \n \tthen result := N mod K\n \telse result := N;\n writeln(result);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 3, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s722738717", "group_id": "codeNet:p02719", "input_text": "var\n n,k : int64;\nbegin\n readln(n,k);\n if (n mod k) < (k-(n mod k)) then\n writeln(n mod k)\n else\n writeln(k-(n mod k));\nend.", "language": "Pascal", "metadata": {"date": 1596153269, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s722738717.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s722738717", "user_id": "u678829637"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,k : int64;\nbegin\n readln(n,k);\n if (n mod k) < (k-(n mod k)) then\n writeln(n mod k)\n else\n writeln(k-(n mod k));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s356108252", "group_id": "codeNet:p02719", "input_text": "program main;\nvar n,k,d : int64;\n b : boolean;\nbegin\n b := false;\n readln(n,k);\n repeat\n n := abs(n-k);\n d := abs(n-k);\n if n = 0\n then b := true;\n if d >= n\n then b := true;\n until b;\n writeln(n);\nend.", "language": "Pascal", "metadata": {"date": 1596062576, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s356108252.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s356108252", "user_id": "u225670189"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar n,k,d : int64;\n b : boolean;\nbegin\n b := false;\n readln(n,k);\n repeat\n n := abs(n-k);\n d := abs(n-k);\n if n = 0\n then b := true;\n if d >= n\n then b := true;\n until b;\n writeln(n);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 2205, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s132365488", "group_id": "codeNet:p02719", "input_text": "program ReplacingInteger;\nvar\n x, y, z : int64;\nbegin\n readln(x, y);\n if (x > y) then begin\n if (x mod y = 0) then \n writeln(0)\n else begin\n z := x div y;\n if (x mod y < (y - x mod y)) then \n writeln(x mod y)\n else\n writeln((y - x mod y));\n end;\n end\n else begin\n if (x < y) then\n writeln(abs(x))\n else if (x = y) then\n writeln(0);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1596037234, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s132365488.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s132365488", "user_id": "u583992857"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program ReplacingInteger;\nvar\n x, y, z : int64;\nbegin\n readln(x, y);\n if (x > y) then begin\n if (x mod y = 0) then \n writeln(0)\n else begin\n z := x div y;\n if (x mod y < (y - x mod y)) then \n writeln(x mod y)\n else\n writeln((y - x mod y));\n end;\n end\n else begin\n if (x < y) then\n writeln(abs(x))\n else if (x = y) then\n writeln(0);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 539, "cpu_time_ms": 5, "memory_kb": 1352}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s100176816", "group_id": "codeNet:p02719", "input_text": "program ReplacingInteger;\nvar\n x, y : int64;\n z : Longint;\nbegin\n readln(x, y);\n if (x > y) then begin\n if (x mod y = 0) then \n writeln(0)\n else begin\n z := x div y;\n if (z > x mod y) then \n writeln(z)\n else\n writeln(x mod y);\n end;\n end\n else begin\n if (x < y) then\n writeln(abs(x))\n else if (x = y) then\n writeln(0);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1596031337, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s100176816.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s100176816", "user_id": "u583992857"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program ReplacingInteger;\nvar\n x, y : int64;\n z : Longint;\nbegin\n readln(x, y);\n if (x > y) then begin\n if (x mod y = 0) then \n writeln(0)\n else begin\n z := x div y;\n if (z > x mod y) then \n writeln(z)\n else\n writeln(x mod y);\n end;\n end\n else begin\n if (x < y) then\n writeln(abs(x))\n else if (x = y) then\n writeln(0);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 529, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s913138925", "group_id": "codeNet:p02719", "input_text": "program main;\n\nvar\n\tx, y : integer;\n \nfunction min(x : integer; y : integer) : integer;\nbegin\n\tif x <= y then min := x\n else min := y;\nend;\n \nbegin\n\treadln(x, y);\n x := x mod y;\n writeln(min(x, y - x));\nend.", "language": "Pascal", "metadata": {"date": 1595991587, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s913138925.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s913138925", "user_id": "u838994261"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\n\nvar\n\tx, y : integer;\n \nfunction min(x : integer; y : integer) : integer;\nbegin\n\tif x <= y then min := x\n else min := y;\nend;\n \nbegin\n\treadln(x, y);\n x := x mod y;\n writeln(min(x, y - x));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s070034527", "group_id": "codeNet:p02721", "input_text": "var\n\tS:String;\n\tN,K,C,i,now:Longint;\n\tR:Array[1..200000]of Longint;\nbegin\n\treadln(N,K,C);\n\treadln(S);\n\tnow:=K;i:=N;\n\twhile i>=1 do begin\n\t\tif S[i]='o'then begin\n\t\t\tR[i]:=now;\n\t\t\tdec(now);\n\t\t\tdec(i,C);\n\t\tend;\n\t\tdec(i);\n\tend;\n\tnow:=0;i:=1;\n\twhile i<=N do begin\n\t\tif S[i]='o'then begin\n\t\t\tinc(now);\n\t\t\tif R[i]=now then writeln(i);\n\t\t\tinc(i,C);\n\t\tend;\n\t\tinc(i);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1586064258, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02721.html", "problem_id": "p02721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02721/input.txt", "sample_output_relpath": "derived/input_output/data/p02721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02721/Pascal/s070034527.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s070034527", "user_id": "u657913472"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\tS:String;\n\tN,K,C,i,now:Longint;\n\tR:Array[1..200000]of Longint;\nbegin\n\treadln(N,K,C);\n\treadln(S);\n\tnow:=K;i:=N;\n\twhile i>=1 do begin\n\t\tif S[i]='o'then begin\n\t\t\tR[i]:=now;\n\t\t\tdec(now);\n\t\t\tdec(i,C);\n\t\tend;\n\t\tdec(i);\n\tend;\n\tnow:=0;i:=1;\n\twhile i<=N do begin\n\t\tif S[i]='o'then begin\n\t\t\tinc(now);\n\t\t\tif R[i]=now then writeln(i);\n\t\t\tinc(i,C);\n\t\tend;\n\t\tinc(i);\n\tend;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "sample_input": "11 3 2\nooxxxoxxxoo\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02721", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 30, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s425652478", "group_id": "codeNet:p02726", "input_text": "var\n\tN,X,Y,loop,k,ans,z,t:Longint;\nbegin\n\tread(N,X,Y);\n\tloop:=Y-X+1;\n\tfor k:=1 to N-1 do begin\n\t\tans:=0;\n\t\tif X0 then t:=2*k-loop-1 else t:=0;\n\t\t\tinc(ans,(z-t div 2)*2);\n\t\t\tif(loop mod 2=0)and(loop div 20 then t:=2*k-loop-1 else t:=0;\n\t\t\tinc(ans,(z-t div 2)*2);\n\t\t\tif(loop mod 2=0)and(loop div 2k then inc(ans,N+1+X-Y-k);\n\t\tif k=1 then dec(ans)else begin\n\t\t\tif X-1>=k-1 then dec(ans);\n\t\t\tif N-Y>=k-1 then dec(ans);\n\t\tend;\n\t\tif k*20 then t:=2*k-loop-1 else t:=0;\n\t\t\tinc(ans,(z-t div 2)*2);\n\t\t\tif(loop mod 2=0)and(loop div 20 then t:=2*k-loop-1 else t:=0;\n\t\t\tinc(ans,(z-t div 2)*2);\n\t\t\tif(loop mod 2=0)and(loop div 2k then inc(ans,N+1+X-Y-k);\n\t\tif k=1 then dec(ans)else begin\n\t\t\tif X-1>=k-1 then dec(ans);\n\t\t\tif N-Y>=k-1 then dec(ans);\n\t\tend;\n\t\tif k*2>j)and 1)=1 then inc(now);\n\t\tout:=False;\n\t\tfor j:=0 to W-1 do begin\n\t\t\tid:=0;\n\t\t\ttake:=False;\n\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\tif cnt[id]>K then take:=True;\n\t\t\t\tif ((z>>l)and 1)=1 then inc(id);\n\t\t\tend;\n\t\t\tif take then begin\n\t\t\t\tinc(now);\n\t\t\t\tfor l:=0 to id do cnt[l]:=0;\n\t\t\t\tid:=0;\n\t\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\t\tif cnt[id]>K then out:=True;\n\t\t\t\t\tif((z>>l)and 1)=1 then inc(id);\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tif(not out)and(ans>now)then ans:=now;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1591929275, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02733.html", "problem_id": "p02733", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02733/input.txt", "sample_output_relpath": "derived/input_output/data/p02733/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02733/Pascal/s291599883.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s291599883", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ts:Array[0..9]of String;\n\tH,W,K,i,j,l,z,now,id,ans:Longint;\n\tcnt:Array[0..14]of Longint;\n\tout,take:Boolean;\nbegin\n\treadln(H,W,K);\n\tfor i:=0 to H-1 do readln(s[i]);\n\tans:=1000000000;\n\tfor z:=0 to (1<<(H-1))-1 do begin\n\t\tfor j:=0 to 14 do cnt[j]:=0;\n\t\tnow:=0;\n\t\tfor j:=0 to H-1 do if ((z>>j)and 1)=1 then inc(now);\n\t\tout:=False;\n\t\tfor j:=0 to W-1 do begin\n\t\t\tid:=0;\n\t\t\ttake:=False;\n\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\tif cnt[id]>K then take:=True;\n\t\t\t\tif ((z>>l)and 1)=1 then inc(id);\n\t\t\tend;\n\t\t\tif take then begin\n\t\t\t\tinc(now);\n\t\t\t\tfor l:=0 to id do cnt[l]:=0;\n\t\t\t\tid:=0;\n\t\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\t\tif cnt[id]>K then out:=True;\n\t\t\t\t\tif((z>>l)and 1)=1 then inc(id);\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tif(not out)and(ans>now)then ans:=now;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "sample_input": "3 5 4\n11100\n10001\n00111\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02733", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 840, "cpu_time_ms": 57, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s864295705", "group_id": "codeNet:p02733", "input_text": "var\n\ts:Array[0..9]of String;\n\tH,W,K,i,j,l,z,now,id,ans:Longint;\n\tcnt:Array[0..14]of Longint;\n\tout,take:Boolean;\nbegin\n\treadln(H,W,K);\n\tfor i:=0 to H-1 do readln(s[i]);\n\tans:=1000000000;\n\tfor z:=0 to (1<<(H-1))-1 do begin\n\t\tfor j:=0 to 14 do cnt[j]:=0;\n\t\tnow:=0;\n\t\tfor j:=0 to H-1 do if ((z>>j)and 1)=1 then inc(now);\n\t\tout:=False;\n\t\tfor j:=0 to W-1 do begin\n\t\t\tid:=0;\n\t\t\ttake:=False;\n\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\tif cnt[id]>K then take:=True;\n\t\t\t\tif ((z>>l)and 1)=1 then inc(id);\n\t\t\tend;\n\t\t\tif take then begin\n\t\t\t\tinc(now);\n\t\t\t\tfor l:=0 to id do cnt[l]:=0;\n\t\t\t\tinc(id);\n\t\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\t\tif cnt[id]>K then out:=True;\n\t\t\t\t\tif((z>>k)and 1)=1 then inc(id);\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tif(not out)and(ans>now)then ans:=now;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1591929156, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02733.html", "problem_id": "p02733", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02733/input.txt", "sample_output_relpath": "derived/input_output/data/p02733/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02733/Pascal/s864295705.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s864295705", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ts:Array[0..9]of String;\n\tH,W,K,i,j,l,z,now,id,ans:Longint;\n\tcnt:Array[0..14]of Longint;\n\tout,take:Boolean;\nbegin\n\treadln(H,W,K);\n\tfor i:=0 to H-1 do readln(s[i]);\n\tans:=1000000000;\n\tfor z:=0 to (1<<(H-1))-1 do begin\n\t\tfor j:=0 to 14 do cnt[j]:=0;\n\t\tnow:=0;\n\t\tfor j:=0 to H-1 do if ((z>>j)and 1)=1 then inc(now);\n\t\tout:=False;\n\t\tfor j:=0 to W-1 do begin\n\t\t\tid:=0;\n\t\t\ttake:=False;\n\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\tif cnt[id]>K then take:=True;\n\t\t\t\tif ((z>>l)and 1)=1 then inc(id);\n\t\t\tend;\n\t\t\tif take then begin\n\t\t\t\tinc(now);\n\t\t\t\tfor l:=0 to id do cnt[l]:=0;\n\t\t\t\tinc(id);\n\t\t\t\tfor l:=0 to H-1 do begin\n\t\t\t\t\tif s[l][j+1]='1'then inc(cnt[id]);\n\t\t\t\t\tif cnt[id]>K then out:=True;\n\t\t\t\t\tif((z>>k)and 1)=1 then inc(id);\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tif(not out)and(ans>now)then ans:=now;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "sample_input": "3 5 4\n11100\n10001\n00111\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02733", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 842, "cpu_time_ms": 146, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s555087020", "group_id": "codeNet:p02734", "input_text": "var\n n,s,sum:int64;\n a,f:array[0..3001] of int64;\n i,j:longint;\nbegin\n readln(n,s);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n begin\n for j:=s downto a[i]+1 do f[j]:=(f[j]+f[j-a[i]]) mod 998244353;\n f[a[i]]:=(f[a[i]]+i) mod 998244353;\n sum:=(sum+(n-i+1)*f[s] mod 998244353) mod 998244353;\n f[s]:=0;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1587949014, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02734.html", "problem_id": "p02734", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02734/input.txt", "sample_output_relpath": "derived/input_output/data/p02734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02734/Pascal/s555087020.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s555087020", "user_id": "u476418095"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n n,s,sum:int64;\n a,f:array[0..3001] of int64;\n i,j:longint;\nbegin\n readln(n,s);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n begin\n for j:=s downto a[i]+1 do f[j]:=(f[j]+f[j-a[i]]) mod 998244353;\n f[a[i]]:=(f[a[i]]+i) mod 998244353;\n sum:=(sum+(n-i+1)*f[s] mod 998244353) mod 998244353;\n f[s]:=0;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "sample_input": "3 4\n2 2 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02734", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 363, "cpu_time_ms": 89, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s137146451", "group_id": "codeNet:p02734", "input_text": "var\n\tN,S,i,j,A,ans:Longint;\n\tdp:Array[0..3001]of Longint;\nbegin\n\tread(N,S);\n\tfor i:=1 to N do begin\n\t\tdp[S]:=i;\n\t\tread(A);\n\t\tfor j:=A to S do begin\n\t\t\tinc(dp[j-A],dp[j]);\n\t\t\tif dp[j-A]>=998244353 then dec(dp[j-A],998244353);\n\t\tend;\n\t\tinc(ans,dp[0]);\n\t\tif ans>=998244353 then dec(ans,998244353);\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1584930108, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02734.html", "problem_id": "p02734", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02734/input.txt", "sample_output_relpath": "derived/input_output/data/p02734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02734/Pascal/s137146451.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s137146451", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n\tN,S,i,j,A,ans:Longint;\n\tdp:Array[0..3001]of Longint;\nbegin\n\tread(N,S);\n\tfor i:=1 to N do begin\n\t\tdp[S]:=i;\n\t\tread(A);\n\t\tfor j:=A to S do begin\n\t\t\tinc(dp[j-A],dp[j]);\n\t\t\tif dp[j-A]>=998244353 then dec(dp[j-A],998244353);\n\t\tend;\n\t\tinc(ans,dp[0]);\n\t\tif ans>=998244353 then dec(ans,998244353);\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "sample_input": "3 4\n2 2 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02734", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 321, "cpu_time_ms": 65, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s688933699", "group_id": "codeNet:p02735", "input_text": "uses math;\nvar n,m,i,j:longint;\n a:array[0..100,0..100]of longint;\n c:char;\nbegin\n fillchar(a,sizeof(a),$3f);\n a[1,0]:=0;\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(c);\n a[i,j]:=ord(c='#')+min(a[i-1,j],a[i,j-1]);\n end;\n readln;\n end;\n writeln(a[n,m]);\nend.", "language": "Pascal", "metadata": {"date": 1587216134, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Pascal/s688933699.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s688933699", "user_id": "u743614777"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses math;\nvar n,m,i,j:longint;\n a:array[0..100,0..100]of longint;\n c:char;\nbegin\n fillchar(a,sizeof(a),$3f);\n a[1,0]:=0;\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(c);\n a[i,j]:=ord(c='#')+min(a[i-1,j],a[i,j-1]);\n end;\n readln;\n end;\n writeln(a[n,m]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s014741598", "group_id": "codeNet:p02746", "input_text": "var\n\tQ,i,j:Longint;\n\tT:Array[0..30]of int64;\n\ta,b,c,d,ans,plus,tmp:int64;\nbegin\n\tT[0]:=1;\n\tfor i:=1 to 30 do T[i]:=T[i-1]*3;\n\tread(Q);\n\tfor i:=1 to Q do begin\n\t\tread(a,b,c,d);\n\t\tdec(a);\n\t\tdec(b);\n\t\tdec(c);\n\t\tdec(d);\n\t\tans:=abs(a-c)+abs(b-d);\n\t\tplus:=0;\n\t\tfor j:=30 downto 1 do begin\n\t\t\tif(a div T[j-1]=c div T[j-1])and(a div T[j-1]mod 3=1)then begin\n\t\t\t\tb:=b div T[j-1];\n\t\t\t\td:=d div T[j-1];\n\t\t\t\tif b>d then begin\n\t\t\t\t\ttmp:=b;\n\t\t\t\t\tb:=d;\n\t\t\t\t\td:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile b mod 3<>1 do inc(b);\n\t\t\t\twhile(d>=0)and(d mod 3<>1)do dec(d);\n\t\t\t\tif b<=d then begin\n\t\t\t\t\ta:=a mod T[j];\n\t\t\t\t\tc:=c mod T[j];\n\t\t\t\t\tif a>c then begin\n\t\t\t\t\t\ttmp:=a;\n\t\t\t\t\t\ta:=c;\n\t\t\t\t\t\tc:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif a+c+1<3*T[j-1]then plus:=a+1-T[j-1]else plus:=2*T[j-1]-c;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tif(b div T[j-1]=d div T[j-1])and(b div T[j-1]mod 3=1)then begin\n\t\t\t\ta:=a div T[j-1];\n\t\t\t\tc:=c div T[j-1];\n\t\t\t\tif a>c then begin\n\t\t\t\t\ttmp:=a;\n\t\t\t\t\ta:=c;\n\t\t\t\t\tc:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile a mod 3<>1 do inc(a);\n\t\t\t\twhile(c>=0)and(c mod 3<>1)do dec(c);\n\t\t\t\tif a<=c then begin\n\t\t\t\t\tb:=b mod T[j];\n\t\t\t\t\td:=d mod T[j];\n\t\t\t\t\tif b>d then begin\n\t\t\t\t\t\ttmp:=b;\n\t\t\t\t\t\tb:=d;\n\t\t\t\t\t\td:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif b+d+1<3*T[j-1]then plus:=b+1-T[j-1]else plus:=2*T[j-1]-d;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\twriteln(ans+plus*2);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1584250193, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02746.html", "problem_id": "p02746", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02746/input.txt", "sample_output_relpath": "derived/input_output/data/p02746/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02746/Pascal/s014741598.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s014741598", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n8\n", "input_to_evaluate": "var\n\tQ,i,j:Longint;\n\tT:Array[0..30]of int64;\n\ta,b,c,d,ans,plus,tmp:int64;\nbegin\n\tT[0]:=1;\n\tfor i:=1 to 30 do T[i]:=T[i-1]*3;\n\tread(Q);\n\tfor i:=1 to Q do begin\n\t\tread(a,b,c,d);\n\t\tdec(a);\n\t\tdec(b);\n\t\tdec(c);\n\t\tdec(d);\n\t\tans:=abs(a-c)+abs(b-d);\n\t\tplus:=0;\n\t\tfor j:=30 downto 1 do begin\n\t\t\tif(a div T[j-1]=c div T[j-1])and(a div T[j-1]mod 3=1)then begin\n\t\t\t\tb:=b div T[j-1];\n\t\t\t\td:=d div T[j-1];\n\t\t\t\tif b>d then begin\n\t\t\t\t\ttmp:=b;\n\t\t\t\t\tb:=d;\n\t\t\t\t\td:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile b mod 3<>1 do inc(b);\n\t\t\t\twhile(d>=0)and(d mod 3<>1)do dec(d);\n\t\t\t\tif b<=d then begin\n\t\t\t\t\ta:=a mod T[j];\n\t\t\t\t\tc:=c mod T[j];\n\t\t\t\t\tif a>c then begin\n\t\t\t\t\t\ttmp:=a;\n\t\t\t\t\t\ta:=c;\n\t\t\t\t\t\tc:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif a+c+1<3*T[j-1]then plus:=a+1-T[j-1]else plus:=2*T[j-1]-c;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tif(b div T[j-1]=d div T[j-1])and(b div T[j-1]mod 3=1)then begin\n\t\t\t\ta:=a div T[j-1];\n\t\t\t\tc:=c div T[j-1];\n\t\t\t\tif a>c then begin\n\t\t\t\t\ttmp:=a;\n\t\t\t\t\ta:=c;\n\t\t\t\t\tc:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile a mod 3<>1 do inc(a);\n\t\t\t\twhile(c>=0)and(c mod 3<>1)do dec(c);\n\t\t\t\tif a<=c then begin\n\t\t\t\t\tb:=b mod T[j];\n\t\t\t\t\td:=d mod T[j];\n\t\t\t\t\tif b>d then begin\n\t\t\t\t\t\ttmp:=b;\n\t\t\t\t\t\tb:=d;\n\t\t\t\t\t\td:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif b+d+1<3*T[j-1]then plus:=b+1-T[j-1]else plus:=2*T[j-1]-d;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\twriteln(ans+plus*2);\n\tend;\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nFor a non-negative integer K, we define a fractal of level K as follows:\n\nA fractal of level 0 is a grid with just one white square.\n\nWhen K > 0, a fractal of level K is a 3^K \\times 3^K grid. If we divide this grid into nine 3^{K-1} \\times 3^{K-1} subgrids:\n\nThe central subgrid consists of only black squares.\n\nEach of the other eight subgrids is a fractal of level K-1.\n\nFor example, a fractal of level 2 is as follows:\n\nIn a fractal of level 30, let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\n\nYou are given Q quadruples of integers (a_i, b_i, c_i, d_i).\nFor each quadruple, find the distance from (a_i, b_i) to (c_i, d_i).\n\nHere the distance from (a, b) to (c, d) is the minimum integer n that satisfies the following condition:\n\nThere exists a sequence of white squares (x_0, y_0), \\ldots, (x_n, y_n) satisfying the following conditions:\n\n(x_0, y_0) = (a, b)\n\n(x_n, y_n) = (c, d)\n\nFor every i (0 \\leq i \\leq n-1), (x_i, y_i) and (x_{i+1}, y_{i+1}) share a side.\n\nConstraints\n\n1 \\leq Q \\leq 10000\n\n1 \\leq a_i, b_i, c_i, d_i \\leq 3^{30}\n\n(a_i, b_i) \\neq (c_i, d_i)\n\n(a_i, b_i) and (c_i, d_i) are white squares.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\na_1 \\ b_1 \\ c_1 \\ d_1\n:\na_Q \\ b_Q \\ c_Q \\ d_Q\n\nOutput\n\nPrint Q lines.\nThe i-th line should contain the distance from (a_i, b_i) to (c_i, d_i).\n\nSample Input 1\n\n2\n4 2 7 4\n9 9 1 9\n\nSample Output 1\n\n5\n8", "sample_input": "2\n4 2 7 4\n9 9 1 9\n"}, "reference_outputs": ["5\n8\n"], "source_document_id": "p02746", "source_text": "Score : 600 points\n\nProblem Statement\n\nFor a non-negative integer K, we define a fractal of level K as follows:\n\nA fractal of level 0 is a grid with just one white square.\n\nWhen K > 0, a fractal of level K is a 3^K \\times 3^K grid. If we divide this grid into nine 3^{K-1} \\times 3^{K-1} subgrids:\n\nThe central subgrid consists of only black squares.\n\nEach of the other eight subgrids is a fractal of level K-1.\n\nFor example, a fractal of level 2 is as follows:\n\nIn a fractal of level 30, let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\n\nYou are given Q quadruples of integers (a_i, b_i, c_i, d_i).\nFor each quadruple, find the distance from (a_i, b_i) to (c_i, d_i).\n\nHere the distance from (a, b) to (c, d) is the minimum integer n that satisfies the following condition:\n\nThere exists a sequence of white squares (x_0, y_0), \\ldots, (x_n, y_n) satisfying the following conditions:\n\n(x_0, y_0) = (a, b)\n\n(x_n, y_n) = (c, d)\n\nFor every i (0 \\leq i \\leq n-1), (x_i, y_i) and (x_{i+1}, y_{i+1}) share a side.\n\nConstraints\n\n1 \\leq Q \\leq 10000\n\n1 \\leq a_i, b_i, c_i, d_i \\leq 3^{30}\n\n(a_i, b_i) \\neq (c_i, d_i)\n\n(a_i, b_i) and (c_i, d_i) are white squares.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\na_1 \\ b_1 \\ c_1 \\ d_1\n:\na_Q \\ b_Q \\ c_Q \\ d_Q\n\nOutput\n\nPrint Q lines.\nThe i-th line should contain the distance from (a_i, b_i) to (c_i, d_i).\n\nSample Input 1\n\n2\n4 2 7 4\n9 9 1 9\n\nSample Output 1\n\n5\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1286, "cpu_time_ms": 31, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s315869491", "group_id": "codeNet:p02746", "input_text": "var\n\tQ,i,j:Longint;\n\tT:Array[0..30]of int64;\n\ta,b,c,d,ans,plus,tmp:int64;\nbegin\n\tT[0]:=1;\n\tfor i:=1 to 30 do T[i]:=T[i-1]*3;\n\tread(Q);\n\tfor i:=1 to Q do begin\n\t\tread(a,b,c,d);\n\t\tdec(a);\n\t\tdec(b);\n\t\tdec(c);\n\t\tdec(d);\n\t\tans:=abs(a-c)+abs(b-d);\n\t\tplus:=0;\n\t\tfor j:=30 downto 1 do begin\n\t\t\tif(a div T[j-1]=c div T[j-1])and(a div T[j-1]mod 3=1)then begin\n\t\t\t\tb:=b div T[j-1];\n\t\t\t\td:=d div T[j-1];\n\t\t\t\tif b>d then begin\n\t\t\t\t\ttmp:=b;\n\t\t\t\t\tb:=d;\n\t\t\t\t\td:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile b mod 3<>1 do inc(b);\n\t\t\t\tif b<=d then begin\n\t\t\t\t\ta:=a mod T[j];\n\t\t\t\t\tc:=c mod T[j];\n\t\t\t\t\tif a>c then begin\n\t\t\t\t\t\ttmp:=a;\n\t\t\t\t\t\ta:=c;\n\t\t\t\t\t\tc:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif a+c+1<3*T[j-1]then plus:=a+1-T[j-1]else plus:=2*T[j-1]-c;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tif(b div T[j-1]=d div T[j-1])and(b div T[j-1]mod 3=1)then begin\n\t\t\t\ta:=a div T[j-1];\n\t\t\t\tc:=c div T[j-1];\n\t\t\t\tif a>c then begin\n\t\t\t\t\ttmp:=a;\n\t\t\t\t\ta:=c;\n\t\t\t\t\tc:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile a mod 3<>1 do inc(a);\n\t\t\t\tif a<=c then begin\n\t\t\t\t\tb:=b mod T[j];\n\t\t\t\t\td:=d mod T[j];\n\t\t\t\t\tif b>d then begin\n\t\t\t\t\t\ttmp:=b;\n\t\t\t\t\t\tb:=d;\n\t\t\t\t\t\td:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif b+d+1<3*T[j-1]then plus:=b+1-T[j-1]else plus:=2*T[j-1]-d;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\twriteln(ans+plus*2);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1584249720, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02746.html", "problem_id": "p02746", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02746/input.txt", "sample_output_relpath": "derived/input_output/data/p02746/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02746/Pascal/s315869491.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s315869491", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n8\n", "input_to_evaluate": "var\n\tQ,i,j:Longint;\n\tT:Array[0..30]of int64;\n\ta,b,c,d,ans,plus,tmp:int64;\nbegin\n\tT[0]:=1;\n\tfor i:=1 to 30 do T[i]:=T[i-1]*3;\n\tread(Q);\n\tfor i:=1 to Q do begin\n\t\tread(a,b,c,d);\n\t\tdec(a);\n\t\tdec(b);\n\t\tdec(c);\n\t\tdec(d);\n\t\tans:=abs(a-c)+abs(b-d);\n\t\tplus:=0;\n\t\tfor j:=30 downto 1 do begin\n\t\t\tif(a div T[j-1]=c div T[j-1])and(a div T[j-1]mod 3=1)then begin\n\t\t\t\tb:=b div T[j-1];\n\t\t\t\td:=d div T[j-1];\n\t\t\t\tif b>d then begin\n\t\t\t\t\ttmp:=b;\n\t\t\t\t\tb:=d;\n\t\t\t\t\td:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile b mod 3<>1 do inc(b);\n\t\t\t\tif b<=d then begin\n\t\t\t\t\ta:=a mod T[j];\n\t\t\t\t\tc:=c mod T[j];\n\t\t\t\t\tif a>c then begin\n\t\t\t\t\t\ttmp:=a;\n\t\t\t\t\t\ta:=c;\n\t\t\t\t\t\tc:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif a+c+1<3*T[j-1]then plus:=a+1-T[j-1]else plus:=2*T[j-1]-c;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tif(b div T[j-1]=d div T[j-1])and(b div T[j-1]mod 3=1)then begin\n\t\t\t\ta:=a div T[j-1];\n\t\t\t\tc:=c div T[j-1];\n\t\t\t\tif a>c then begin\n\t\t\t\t\ttmp:=a;\n\t\t\t\t\ta:=c;\n\t\t\t\t\tc:=tmp;\n\t\t\t\tend;\n\t\t\t\twhile a mod 3<>1 do inc(a);\n\t\t\t\tif a<=c then begin\n\t\t\t\t\tb:=b mod T[j];\n\t\t\t\t\td:=d mod T[j];\n\t\t\t\t\tif b>d then begin\n\t\t\t\t\t\ttmp:=b;\n\t\t\t\t\t\tb:=d;\n\t\t\t\t\t\td:=tmp;\n\t\t\t\t\tend;\n\t\t\t\t\tif b+d+1<3*T[j-1]then plus:=b+1-T[j-1]else plus:=2*T[j-1]-d;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\twriteln(ans+plus*2);\n\tend;\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nFor a non-negative integer K, we define a fractal of level K as follows:\n\nA fractal of level 0 is a grid with just one white square.\n\nWhen K > 0, a fractal of level K is a 3^K \\times 3^K grid. If we divide this grid into nine 3^{K-1} \\times 3^{K-1} subgrids:\n\nThe central subgrid consists of only black squares.\n\nEach of the other eight subgrids is a fractal of level K-1.\n\nFor example, a fractal of level 2 is as follows:\n\nIn a fractal of level 30, let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\n\nYou are given Q quadruples of integers (a_i, b_i, c_i, d_i).\nFor each quadruple, find the distance from (a_i, b_i) to (c_i, d_i).\n\nHere the distance from (a, b) to (c, d) is the minimum integer n that satisfies the following condition:\n\nThere exists a sequence of white squares (x_0, y_0), \\ldots, (x_n, y_n) satisfying the following conditions:\n\n(x_0, y_0) = (a, b)\n\n(x_n, y_n) = (c, d)\n\nFor every i (0 \\leq i \\leq n-1), (x_i, y_i) and (x_{i+1}, y_{i+1}) share a side.\n\nConstraints\n\n1 \\leq Q \\leq 10000\n\n1 \\leq a_i, b_i, c_i, d_i \\leq 3^{30}\n\n(a_i, b_i) \\neq (c_i, d_i)\n\n(a_i, b_i) and (c_i, d_i) are white squares.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\na_1 \\ b_1 \\ c_1 \\ d_1\n:\na_Q \\ b_Q \\ c_Q \\ d_Q\n\nOutput\n\nPrint Q lines.\nThe i-th line should contain the distance from (a_i, b_i) to (c_i, d_i).\n\nSample Input 1\n\n2\n4 2 7 4\n9 9 1 9\n\nSample Output 1\n\n5\n8", "sample_input": "2\n4 2 7 4\n9 9 1 9\n"}, "reference_outputs": ["5\n8\n"], "source_document_id": "p02746", "source_text": "Score : 600 points\n\nProblem Statement\n\nFor a non-negative integer K, we define a fractal of level K as follows:\n\nA fractal of level 0 is a grid with just one white square.\n\nWhen K > 0, a fractal of level K is a 3^K \\times 3^K grid. If we divide this grid into nine 3^{K-1} \\times 3^{K-1} subgrids:\n\nThe central subgrid consists of only black squares.\n\nEach of the other eight subgrids is a fractal of level K-1.\n\nFor example, a fractal of level 2 is as follows:\n\nIn a fractal of level 30, let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\n\nYou are given Q quadruples of integers (a_i, b_i, c_i, d_i).\nFor each quadruple, find the distance from (a_i, b_i) to (c_i, d_i).\n\nHere the distance from (a, b) to (c, d) is the minimum integer n that satisfies the following condition:\n\nThere exists a sequence of white squares (x_0, y_0), \\ldots, (x_n, y_n) satisfying the following conditions:\n\n(x_0, y_0) = (a, b)\n\n(x_n, y_n) = (c, d)\n\nFor every i (0 \\leq i \\leq n-1), (x_i, y_i) and (x_{i+1}, y_{i+1}) share a side.\n\nConstraints\n\n1 \\leq Q \\leq 10000\n\n1 \\leq a_i, b_i, c_i, d_i \\leq 3^{30}\n\n(a_i, b_i) \\neq (c_i, d_i)\n\n(a_i, b_i) and (c_i, d_i) are white squares.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\na_1 \\ b_1 \\ c_1 \\ d_1\n:\na_Q \\ b_Q \\ c_Q \\ d_Q\n\nOutput\n\nPrint Q lines.\nThe i-th line should contain the distance from (a_i, b_i) to (c_i, d_i).\n\nSample Input 1\n\n2\n4 2 7 4\n9 9 1 9\n\nSample Output 1\n\n5\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1204, "cpu_time_ms": 27, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s013386666", "group_id": "codeNet:p02750", "input_text": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = int64;\n double = extended;\n bool = boolean;\n\nconst\n inf = 1061109567;\n lnf = 4557430888798830399;\n Maxn = 200005;\n LOG = 32;\n\nvar\n i, j: int32;\n swap_tmp, x, y, z: int64;\n n, T, sza, szb, ans: int64;\n a: array [0 .. Maxn, 0 .. 1] of int64;\n b: array [0 .. Maxn] of int64;\n dp: array [0 .. LOG] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (a[j][0] * (a[i][1] + 1) < (a[i][0] * (a[j][1] + 1)));\nend;\nprocedure qsort_swap(i, j: int32);\nbegin\n a[0] := a[i];\n a[i] := a[j];\n a[j] := a[0];\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nfunction qsort2_less(i, j: int32): bool;\nbegin\n qsort2_less := (b[i] < b[j]);\nend;\nprocedure qsort2_swap(i, j: int32);\nbegin\n b[0] := b[i];\n b[i] := b[j];\n b[j] := b[0];\nend;\nprocedure qsort2(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort2_less(i, _p) do inc(i);\n while qsort2_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort2_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort2(i, _r);\n if (j > _l) then qsort2(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randomize;\n \n readln(n, T);\n sza := 0; szb := 0;\n for i := 1 to n do begin\n readln(x, y);\n if (x = 0) then begin\n inc(szb);\n b[szb] := y;\n end\n else begin\n inc(sza);\n a[sza, 0] := x;\n a[sza, 1] := y;\n end;\n end;\n \n for i := 2 to sza do begin\n x := random(i - 1) + 1;\n a[0] := a[x];\n a[x] := a[i];\n a[i] := a[0];\n end;\n qsort(1, sza);\n \n for i := 1 to LOG do dp[i] := T + 1;\n dp[0] := 0;\n for i := 1 to sza do begin\n for j := LOG - 1 downto 0 do begin\n if (dp[j] > T) then continue;\n if (dp[j + 1] > dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1]) then begin\n dp[j + 1] := dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1];\n end;\n end;\n end;\n \n for i := 2 to szb do begin\n x := random(i - 1) + 1;\n b[0] := b[x];\n b[x] := b[i];\n b[i] := b[0];\n end;\n qsort2(1, szb);\n ans := 0;\n for i := 0 to LOG do begin\n if (dp[i] > T) then continue;\n x := T - dp[i];\n y := 0;\n for j := 1 to szb do begin\n if (x > b[j]) then begin\n dec(x, b[j] + 1);\n inc(y);\n end\n else break;\n end;\n if (i + y > ans) then ans := i + y;\n end;\n \n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1583871400, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02750.html", "problem_id": "p02750", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02750/input.txt", "sample_output_relpath": "derived/input_output/data/p02750/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02750/Pascal/s013386666.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s013386666", "user_id": "u144695182"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = int64;\n double = extended;\n bool = boolean;\n\nconst\n inf = 1061109567;\n lnf = 4557430888798830399;\n Maxn = 200005;\n LOG = 32;\n\nvar\n i, j: int32;\n swap_tmp, x, y, z: int64;\n n, T, sza, szb, ans: int64;\n a: array [0 .. Maxn, 0 .. 1] of int64;\n b: array [0 .. Maxn] of int64;\n dp: array [0 .. LOG] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (a[j][0] * (a[i][1] + 1) < (a[i][0] * (a[j][1] + 1)));\nend;\nprocedure qsort_swap(i, j: int32);\nbegin\n a[0] := a[i];\n a[i] := a[j];\n a[j] := a[0];\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nfunction qsort2_less(i, j: int32): bool;\nbegin\n qsort2_less := (b[i] < b[j]);\nend;\nprocedure qsort2_swap(i, j: int32);\nbegin\n b[0] := b[i];\n b[i] := b[j];\n b[j] := b[0];\nend;\nprocedure qsort2(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort2_less(i, _p) do inc(i);\n while qsort2_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort2_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort2(i, _r);\n if (j > _l) then qsort2(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randomize;\n \n readln(n, T);\n sza := 0; szb := 0;\n for i := 1 to n do begin\n readln(x, y);\n if (x = 0) then begin\n inc(szb);\n b[szb] := y;\n end\n else begin\n inc(sza);\n a[sza, 0] := x;\n a[sza, 1] := y;\n end;\n end;\n \n for i := 2 to sza do begin\n x := random(i - 1) + 1;\n a[0] := a[x];\n a[x] := a[i];\n a[i] := a[0];\n end;\n qsort(1, sza);\n \n for i := 1 to LOG do dp[i] := T + 1;\n dp[0] := 0;\n for i := 1 to sza do begin\n for j := LOG - 1 downto 0 do begin\n if (dp[j] > T) then continue;\n if (dp[j + 1] > dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1]) then begin\n dp[j + 1] := dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1];\n end;\n end;\n end;\n \n for i := 2 to szb do begin\n x := random(i - 1) + 1;\n b[0] := b[x];\n b[x] := b[i];\n b[i] := b[0];\n end;\n qsort2(1, szb);\n ans := 0;\n for i := 0 to LOG do begin\n if (dp[i] > T) then continue;\n x := T - dp[i];\n y := 0;\n for j := 1 to szb do begin\n if (x > b[j]) then begin\n dec(x, b[j] + 1);\n inc(y);\n end\n else break;\n end;\n if (i + y > ans) then ans := i + y;\n end;\n \n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "sample_input": "3 7\n2 0\n3 2\n0 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02750", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2861, "cpu_time_ms": 195, "memory_kb": 3840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s182526100", "group_id": "codeNet:p02750", "input_text": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst\n inf = 1061109567;\n lnf = 4557430888798830399;\n Maxn = 200005;\n LOG = 32;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, T, sza, szb, ans: int64;\n a: array [0 .. Maxn, 0 .. 1] of int64;\n b: array [0 .. Maxn] of int64;\n dp: array [0 .. LOG] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (a[j][0] * (a[i][1] + 1) < (a[i][0] * (a[j][1] + 1)));\nend;\nprocedure qsort_swap(i, j: int32);\nbegin\n a[0] := a[i];\n a[i] := a[j];\n a[j] := a[0];\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nfunction qsort2_less(i, j: int32): bool;\nbegin\n qsort2_less := (b[i] < b[j]);\nend;\nprocedure qsort2_swap(i, j: int32);\nbegin\n b[0] := b[i];\n b[i] := b[j];\n b[j] := b[0];\nend;\nprocedure qsort2(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort2_less(i, _p) do inc(i);\n while qsort2_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort2_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort2(i, _r);\n if (j > _l) then qsort2(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randomize;\n \n readln(n, T);\n sza := 0; szb := 0;\n for i := 1 to n do begin\n readln(x, y);\n if (x = 0) then begin\n inc(szb);\n b[szb] := y;\n end\n else begin\n inc(sza);\n a[sza, 0] := x;\n a[sza, 1] := y;\n end;\n end;\n \n for i := 2 to sza do begin\n x := random(i - 1) + 1;\n a[0] := a[x];\n a[x] := a[i];\n a[i] := a[0];\n end;\n qsort(1, sza);\n \n for i := 1 to LOG do dp[i] := T + 1;\n dp[0] := 0;\n for i := 1 to sza do begin\n for j := LOG - 1 downto 0 do begin\n if (dp[j] > T) then continue;\n if (dp[j + 1] > dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1]) then begin\n dp[j + 1] := dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1];\n end;\n end;\n end;\n \n for i := 2 to n do begin\n x := random(i - 1) + 1;\n b[0] := b[x];\n b[x] := b[i];\n b[i] := b[0];\n end;\n qsort2(1, szb);\n ans := 0;\n for i := 0 to LOG do begin\n if (dp[i] > T) then continue;\n x := T - dp[i];\n y := 0;\n for j := 1 to szb do begin\n if (x > b[j]) then begin\n dec(x, b[j] + 1);\n inc(y);\n end\n else break;\n end;\n if (i + y > ans) then ans := i + y;\n end;\n \n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1583870169, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02750.html", "problem_id": "p02750", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02750/input.txt", "sample_output_relpath": "derived/input_output/data/p02750/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02750/Pascal/s182526100.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s182526100", "user_id": "u144695182"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst\n inf = 1061109567;\n lnf = 4557430888798830399;\n Maxn = 200005;\n LOG = 32;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, T, sza, szb, ans: int64;\n a: array [0 .. Maxn, 0 .. 1] of int64;\n b: array [0 .. Maxn] of int64;\n dp: array [0 .. LOG] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (a[j][0] * (a[i][1] + 1) < (a[i][0] * (a[j][1] + 1)));\nend;\nprocedure qsort_swap(i, j: int32);\nbegin\n a[0] := a[i];\n a[i] := a[j];\n a[j] := a[0];\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nfunction qsort2_less(i, j: int32): bool;\nbegin\n qsort2_less := (b[i] < b[j]);\nend;\nprocedure qsort2_swap(i, j: int32);\nbegin\n b[0] := b[i];\n b[i] := b[j];\n b[j] := b[0];\nend;\nprocedure qsort2(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort2_less(i, _p) do inc(i);\n while qsort2_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort2_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort2(i, _r);\n if (j > _l) then qsort2(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randomize;\n \n readln(n, T);\n sza := 0; szb := 0;\n for i := 1 to n do begin\n readln(x, y);\n if (x = 0) then begin\n inc(szb);\n b[szb] := y;\n end\n else begin\n inc(sza);\n a[sza, 0] := x;\n a[sza, 1] := y;\n end;\n end;\n \n for i := 2 to sza do begin\n x := random(i - 1) + 1;\n a[0] := a[x];\n a[x] := a[i];\n a[i] := a[0];\n end;\n qsort(1, sza);\n \n for i := 1 to LOG do dp[i] := T + 1;\n dp[0] := 0;\n for i := 1 to sza do begin\n for j := LOG - 1 downto 0 do begin\n if (dp[j] > T) then continue;\n if (dp[j + 1] > dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1]) then begin\n dp[j + 1] := dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1];\n end;\n end;\n end;\n \n for i := 2 to n do begin\n x := random(i - 1) + 1;\n b[0] := b[x];\n b[x] := b[i];\n b[i] := b[0];\n end;\n qsort2(1, szb);\n ans := 0;\n for i := 0 to LOG do begin\n if (dp[i] > T) then continue;\n x := T - dp[i];\n y := 0;\n for j := 1 to szb do begin\n if (x > b[j]) then begin\n dec(x, b[j] + 1);\n inc(y);\n end\n else break;\n end;\n if (i + y > ans) then ans := i + y;\n end;\n \n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "sample_input": "3 7\n2 0\n3 2\n0 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02750", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2852, "cpu_time_ms": 189, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s935523633", "group_id": "codeNet:p02750", "input_text": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst\n inf = 1061109567;\n lnf = 4557430888798830399;\n Maxn = 200005;\n LOG = 32;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, T, sza, szb, ans: int32;\n a: array [0 .. Maxn, 0 .. 1] of int32;\n b: array [0 .. Maxn] of int32;\n dp: array [0 .. LOG] of int32;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (a[j][0] * (a[i][1] + 1) < (a[i][0] * (a[j][1] + 1)));\nend;\nprocedure qsort_swap(i, j: int32);\nbegin\n a[0] := a[i];\n a[i] := a[j];\n a[j] := a[0];\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nfunction qsort2_less(i, j: int32): bool;\nbegin\n qsort2_less := (b[i] < b[j]);\nend;\nprocedure qsort2_swap(i, j: int32);\nbegin\n b[0] := b[i];\n b[i] := b[j];\n b[j] := b[0];\nend;\nprocedure qsort2(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort2_less(i, _p) do inc(i);\n while qsort2_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort2_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort2(i, _r);\n if (j > _l) then qsort2(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randomize;\n \n readln(n, T);\n sza := 0; szb := 0;\n for i := 1 to n do begin\n readln(x, y);\n if (x = 0) then begin\n inc(szb);\n b[szb] := y;\n end\n else begin\n inc(sza);\n a[sza, 0] := x;\n a[sza, 1] := y;\n end;\n end;\n \n for i := 2 to sza do begin\n x := random(i - 1) + 1;\n a[0] := a[x];\n a[x] := a[i];\n a[i] := a[0];\n end;\n qsort(1, sza);\n \n for i := 1 to LOG do dp[i] := T + 1;\n dp[0] := 0;\n for i := 1 to sza do begin\n for j := LOG - 1 downto 0 do begin\n if (dp[j] > T) then continue;\n if (dp[j + 1] > dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1]) then begin\n dp[j + 1] := dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1];\n end;\n end;\n end;\n \n for i := 2 to n do begin\n x := random(i - 1) + 1;\n b[0] := b[x];\n b[x] := b[i];\n b[i] := b[0];\n end;\n qsort2(1, szb);\n ans := 0;\n for i := 0 to LOG do begin\n if (dp[i] > T) then continue;\n x := T - dp[i];\n y := 0;\n for j := 1 to szb do begin\n if (x > b[j]) then begin\n dec(x, b[j] + 1);\n inc(y);\n end\n else break;\n end;\n if (i + y > ans) then ans := i + y;\n end;\n \n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1583861345, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02750.html", "problem_id": "p02750", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02750/input.txt", "sample_output_relpath": "derived/input_output/data/p02750/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02750/Pascal/s935523633.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s935523633", "user_id": "u144695182"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst\n inf = 1061109567;\n lnf = 4557430888798830399;\n Maxn = 200005;\n LOG = 32;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, T, sza, szb, ans: int32;\n a: array [0 .. Maxn, 0 .. 1] of int32;\n b: array [0 .. Maxn] of int32;\n dp: array [0 .. LOG] of int32;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (a[j][0] * (a[i][1] + 1) < (a[i][0] * (a[j][1] + 1)));\nend;\nprocedure qsort_swap(i, j: int32);\nbegin\n a[0] := a[i];\n a[i] := a[j];\n a[j] := a[0];\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nfunction qsort2_less(i, j: int32): bool;\nbegin\n qsort2_less := (b[i] < b[j]);\nend;\nprocedure qsort2_swap(i, j: int32);\nbegin\n b[0] := b[i];\n b[i] := b[j];\n b[j] := b[0];\nend;\nprocedure qsort2(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort2_less(i, _p) do inc(i);\n while qsort2_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort2_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort2(i, _r);\n if (j > _l) then qsort2(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randomize;\n \n readln(n, T);\n sza := 0; szb := 0;\n for i := 1 to n do begin\n readln(x, y);\n if (x = 0) then begin\n inc(szb);\n b[szb] := y;\n end\n else begin\n inc(sza);\n a[sza, 0] := x;\n a[sza, 1] := y;\n end;\n end;\n \n for i := 2 to sza do begin\n x := random(i - 1) + 1;\n a[0] := a[x];\n a[x] := a[i];\n a[i] := a[0];\n end;\n qsort(1, sza);\n \n for i := 1 to LOG do dp[i] := T + 1;\n dp[0] := 0;\n for i := 1 to sza do begin\n for j := LOG - 1 downto 0 do begin\n if (dp[j] > T) then continue;\n if (dp[j + 1] > dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1]) then begin\n dp[j + 1] := dp[j] + 1 + (dp[j] + 1) * a[i][0] + a[i][1];\n end;\n end;\n end;\n \n for i := 2 to n do begin\n x := random(i - 1) + 1;\n b[0] := b[x];\n b[x] := b[i];\n b[i] := b[0];\n end;\n qsort2(1, szb);\n ans := 0;\n for i := 0 to LOG do begin\n if (dp[i] > T) then continue;\n x := T - dp[i];\n y := 0;\n for j := 1 to szb do begin\n if (x > b[j]) then begin\n dec(x, b[j] + 1);\n inc(y);\n end\n else break;\n end;\n if (i + y > ans) then ans := i + y;\n end;\n \n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "sample_input": "3 7\n2 0\n3 2\n0 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02750", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2852, "cpu_time_ms": 206, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s415698733", "group_id": "codeNet:p02756", "input_text": "var s:ansistring;\n ch:string;\n i, T, opt, tp, rev: longint;\nbegin\n readln(s); readln(T);\n for i:= 1 to T do \n begin\n read(tp);\n if tp = 1 then rev := 1 - rev\n else begin\n read(opt); read(ch);\n delete(ch, 1, 1);\n if rev = 1 then opt := 3 - opt;\n if (opt = 1) then s := ch + s\n else s := s + ch;\n end;\n end;\n if (rev = 1) then \n begin\n for i:= length(s) downto 1 do write(s[i]);\n writeln;\n end else \n begin for i:= 1 to length(s) do write(s[i]);\n writeln;end;\nend.", "language": "Pascal", "metadata": {"date": 1584551642, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02756.html", "problem_id": "p02756", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02756/input.txt", "sample_output_relpath": "derived/input_output/data/p02756/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02756/Pascal/s415698733.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s415698733", "user_id": "u686986428"}, "prompt_components": {"gold_output": "cpa\n", "input_to_evaluate": "var s:ansistring;\n ch:string;\n i, T, opt, tp, rev: longint;\nbegin\n readln(s); readln(T);\n for i:= 1 to T do \n begin\n read(tp);\n if tp = 1 then rev := 1 - rev\n else begin\n read(opt); read(ch);\n delete(ch, 1, 1);\n if rev = 1 then opt := 3 - opt;\n if (opt = 1) then s := ch + s\n else s := s + ch;\n end;\n end;\n if (rev = 1) then \n begin\n for i:= length(s) downto 1 do write(s[i]);\n writeln;\n end else \n begin for i:= 1 to length(s) do write(s[i]);\n writeln;end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n\nIf T_i = 1: reverse the string S.\n\nIf T_i = 2: An integer F_i and a lowercase English letter C_i are additionally provided.\n\nIf F_i = 1 : Add C_i to the beginning of the string S.\n\nIf F_i = 2 : Add C_i to the end of the string S.\n\nHelp Takahashi by finding the final string that results from the procedure.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of lowercase English letters.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\nT_i = 1 or 2.\n\nF_i = 1 or 2, if provided.\n\nC_i is a lowercase English letter, if provided.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nQ\nQuery_1\n:\nQuery_Q\n\nIn the 3-rd through the (Q+2)-th lines, Query_i is one of the following:\n\n1\n\nwhich means T_i = 1, and:\n\n2 F_i C_i\n\nwhich means T_i = 2.\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\na\n4\n2 1 p\n1\n2 2 c\n1\n\nSample Output 1\n\ncpa\n\nThere will be Q = 4 operations. Initially, S is a.\n\nOperation 1: Add p at the beginning of S. S becomes pa.\n\nOperation 2: Reverse S. S becomes ap.\n\nOperation 3: Add c at the end of S. S becomes apc.\n\nOperation 4: Reverse S. S becomes cpa.\n\nThus, the resulting string is cpa.\n\nSample Input 2\n\na\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n\nSample Output 2\n\naabc\n\nThere will be Q = 6 operations. Initially, S is a.\n\nOperation 1: S becomes aa.\n\nOperation 2: S becomes baa.\n\nOperation 3: S becomes aab.\n\nOperation 4: S becomes aabc.\n\nOperation 5: S becomes cbaa.\n\nOperation 6: S becomes aabc.\n\nThus, the resulting string is aabc.\n\nSample Input 3\n\ny\n1\n2 1 x\n\nSample Output 3\n\nxy", "sample_input": "a\n4\n2 1 p\n1\n2 2 c\n1\n"}, "reference_outputs": ["cpa\n"], "source_document_id": "p02756", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n\nIf T_i = 1: reverse the string S.\n\nIf T_i = 2: An integer F_i and a lowercase English letter C_i are additionally provided.\n\nIf F_i = 1 : Add C_i to the beginning of the string S.\n\nIf F_i = 2 : Add C_i to the end of the string S.\n\nHelp Takahashi by finding the final string that results from the procedure.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of lowercase English letters.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\nT_i = 1 or 2.\n\nF_i = 1 or 2, if provided.\n\nC_i is a lowercase English letter, if provided.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nQ\nQuery_1\n:\nQuery_Q\n\nIn the 3-rd through the (Q+2)-th lines, Query_i is one of the following:\n\n1\n\nwhich means T_i = 1, and:\n\n2 F_i C_i\n\nwhich means T_i = 2.\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\na\n4\n2 1 p\n1\n2 2 c\n1\n\nSample Output 1\n\ncpa\n\nThere will be Q = 4 operations. Initially, S is a.\n\nOperation 1: Add p at the beginning of S. S becomes pa.\n\nOperation 2: Reverse S. S becomes ap.\n\nOperation 3: Add c at the end of S. S becomes apc.\n\nOperation 4: Reverse S. S becomes cpa.\n\nThus, the resulting string is cpa.\n\nSample Input 2\n\na\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n\nSample Output 2\n\naabc\n\nThere will be Q = 6 operations. Initially, S is a.\n\nOperation 1: S becomes aa.\n\nOperation 2: S becomes baa.\n\nOperation 3: S becomes aab.\n\nOperation 4: S becomes aabc.\n\nOperation 5: S becomes cbaa.\n\nOperation 6: S becomes aabc.\n\nThus, the resulting string is aabc.\n\nSample Input 3\n\ny\n1\n2 1 x\n\nSample Output 3\n\nxy", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 570, "cpu_time_ms": 1996, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s399540036", "group_id": "codeNet:p02763", "input_text": "type BITDataType=Longint;\ntype BinaryIndexedTree=record n:Longint;bit:Array of BITDataType;end;\nprocedure init(var bit:BinaryIndexedTree;N:Longint);\nvar i:Longint;\nbegin\n\tbit.n:=N;\n\tsetlength(bit.bit,N);\n\tfor i:=1 to N do bit.bit[i]:=0;\nend;\nfunction sum(var bit:BinaryIndexedTree;i:Longint):BITDataType;\nvar ans:BITDataType;\nbegin\n\tans:=0;\n\twhile i>0 do begin\n\t\tinc(ans,bit.bit[i]);\n\t\tdec(i,i and-i);\n\tend;\n\tsum:=ans;\nend;\nprocedure add(var bit:BinaryIndexedTree;i:Longint;a:BITDataType);\nbegin\n\twhile i<=bit.n do begin\n\t\tinc(bit.bit[i],a);\n\t\tinc(i,i and-i);\n\tend;\nend;\n\nvar\n\tN,Q,i,qt,id,l,r,cnt:Longint;\n\tS:String;\n\tc:Char;\n\tbit:Array['a'..'z']of BinaryIndexedTree;\nbegin\n\treadln(N);\n\treadln(S);\n\treadln(Q);\n\tfor c:='a' to 'z' do init(bit[c],N);\n\tfor i:=1 to N do add(bit[S[i]],i,1);\n\tfor i:=1 to Q do begin\n\t\tread(qt);\n\t\tif qt=1 then begin\n\t\t\tread(id);\n\t\t\tread(c);\n\t\t\tread(c);\n\t\t\tadd(bit[S[id]],id,-1);\n\t\t\tS[id]:=c;\n\t\t\tadd(bit[S[id]],id,1);\n\t\tend else begin\n\t\t\tread(l,r);\n\t\t\tcnt:=0;\n\t\t\tfor c:='a' to 'z' do if sum(bit[c],r)>sum(bit[c],l-1) then inc(cnt);\n\t\t\twriteln(cnt);\n\t\tend;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1583307121, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02763.html", "problem_id": "p02763", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02763/input.txt", "sample_output_relpath": "derived/input_output/data/p02763/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02763/Pascal/s399540036.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s399540036", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n1\n5\n", "input_to_evaluate": "type BITDataType=Longint;\ntype BinaryIndexedTree=record n:Longint;bit:Array of BITDataType;end;\nprocedure init(var bit:BinaryIndexedTree;N:Longint);\nvar i:Longint;\nbegin\n\tbit.n:=N;\n\tsetlength(bit.bit,N);\n\tfor i:=1 to N do bit.bit[i]:=0;\nend;\nfunction sum(var bit:BinaryIndexedTree;i:Longint):BITDataType;\nvar ans:BITDataType;\nbegin\n\tans:=0;\n\twhile i>0 do begin\n\t\tinc(ans,bit.bit[i]);\n\t\tdec(i,i and-i);\n\tend;\n\tsum:=ans;\nend;\nprocedure add(var bit:BinaryIndexedTree;i:Longint;a:BITDataType);\nbegin\n\twhile i<=bit.n do begin\n\t\tinc(bit.bit[i],a);\n\t\tinc(i,i and-i);\n\tend;\nend;\n\nvar\n\tN,Q,i,qt,id,l,r,cnt:Longint;\n\tS:String;\n\tc:Char;\n\tbit:Array['a'..'z']of BinaryIndexedTree;\nbegin\n\treadln(N);\n\treadln(S);\n\treadln(Q);\n\tfor c:='a' to 'z' do init(bit[c],N);\n\tfor i:=1 to N do add(bit[S[i]],i,1);\n\tfor i:=1 to Q do begin\n\t\tread(qt);\n\t\tif qt=1 then begin\n\t\t\tread(id);\n\t\t\tread(c);\n\t\t\tread(c);\n\t\t\tadd(bit[S[id]],id,-1);\n\t\t\tS[id]:=c;\n\t\t\tadd(bit[S[id]],id,1);\n\t\tend else begin\n\t\t\tread(l,r);\n\t\t\tcnt:=0;\n\t\t\tfor c:='a' to 'z' do if sum(bit[c],r)>sum(bit[c],l-1) then inc(cnt);\n\t\t\twriteln(cnt);\n\t\tend;\n\tend;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "sample_input": "7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n"}, "reference_outputs": ["3\n1\n5\n"], "source_document_id": "p02763", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1093, "cpu_time_ms": 165, "memory_kb": 51840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s760964621", "group_id": "codeNet:p02764", "input_text": "uses Math;\nvar\n\tN,K,i,j:Longint;\n\tx,y,c:Array[1..60]of Longint;\n\trr:Array[1..60]of double;\n\tL,R,M,a,t,d,ri,rj,yy:double;\n\tflag:Boolean;\nfunction count(tx,ty:double):Boolean;\nvar i,cnt:Longint;\nbegin\n\tcnt:=0;\n\tfor i:=1 to N do if sqr(X[i]-tx)+sqr(Y[i]-ty)=K;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(x[i],y[i],c[i]);\n\tL:=0;\n\tR:=200000;\n\twhile R-L>0.000001 do begin\n\t\tM:=(L+R)/2;\n\t\tfor i:=1 to N do rr[i]:=M/c[i];\n\t\tflag:=False;\n\t\tfor i:=1 to N do begin\n\t\t\tif count(X[i],Y[i])then begin\n\t\t\t\tflag:=True;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then begin\n\t\t\tfor i:=2 to N do begin\n\t\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\t\td:=sqr(X[i]-X[j])+sqr(Y[i]-Y[j]);\n\t\t\t\t\tri:=rr[i];\n\t\t\t\t\trj:=rr[j];\n\t\t\t\t\tyy:=4*sqr(ri)*d-sqr(sqr(ri)+d-sqr(rj));\n\t\t\t\t\tif yy<0 then continue;\n\t\t\t\t\ta:=arctan2(sqrt(yy),sqr(ri)+d-sqr(rj));\n\t\t\t\t\tt:=arctan2(Y[j]-Y[i],X[j]-X[i]);\n\t\t\t\t\tif count(X[i]+ri*cos(t+a),Y[i]+ri*sin(t+a)) then flag:=True\n\t\t\t\t\telse if count(X[i]+ri*cos(t-a),Y[i]+ri*sin(t-a))then flag:=True;\n\t\t\t\t\tif flag then break;\n\t\t\t\tend;\n\t\t\t\tif flag then break;\n\t\t\tend;\n\t\tend;\n\t\tif flag then R:=M else L:=M;\n\tend;\n\twriteln(R:0:9);\nend.\n", "language": "Pascal", "metadata": {"date": 1583239709, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02764.html", "problem_id": "p02764", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02764/input.txt", "sample_output_relpath": "derived/input_output/data/p02764/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02764/Pascal/s760964621.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s760964621", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2.4\n", "input_to_evaluate": "uses Math;\nvar\n\tN,K,i,j:Longint;\n\tx,y,c:Array[1..60]of Longint;\n\trr:Array[1..60]of double;\n\tL,R,M,a,t,d,ri,rj,yy:double;\n\tflag:Boolean;\nfunction count(tx,ty:double):Boolean;\nvar i,cnt:Longint;\nbegin\n\tcnt:=0;\n\tfor i:=1 to N do if sqr(X[i]-tx)+sqr(Y[i]-ty)=K;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(x[i],y[i],c[i]);\n\tL:=0;\n\tR:=200000;\n\twhile R-L>0.000001 do begin\n\t\tM:=(L+R)/2;\n\t\tfor i:=1 to N do rr[i]:=M/c[i];\n\t\tflag:=False;\n\t\tfor i:=1 to N do begin\n\t\t\tif count(X[i],Y[i])then begin\n\t\t\t\tflag:=True;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then begin\n\t\t\tfor i:=2 to N do begin\n\t\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\t\td:=sqr(X[i]-X[j])+sqr(Y[i]-Y[j]);\n\t\t\t\t\tri:=rr[i];\n\t\t\t\t\trj:=rr[j];\n\t\t\t\t\tyy:=4*sqr(ri)*d-sqr(sqr(ri)+d-sqr(rj));\n\t\t\t\t\tif yy<0 then continue;\n\t\t\t\t\ta:=arctan2(sqrt(yy),sqr(ri)+d-sqr(rj));\n\t\t\t\t\tt:=arctan2(Y[j]-Y[i],X[j]-X[i]);\n\t\t\t\t\tif count(X[i]+ri*cos(t+a),Y[i]+ri*sin(t+a)) then flag:=True\n\t\t\t\t\telse if count(X[i]+ri*cos(t-a),Y[i]+ri*sin(t-a))then flag:=True;\n\t\t\t\t\tif flag then break;\n\t\t\t\tend;\n\t\t\t\tif flag then break;\n\t\t\tend;\n\t\tend;\n\t\tif flag then R:=M else L:=M;\n\tend;\n\twriteln(R:0:9);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "sample_input": "4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n"}, "reference_outputs": ["2.4\n"], "source_document_id": "p02764", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1157, "cpu_time_ms": 32, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s647357764", "group_id": "codeNet:p02764", "input_text": "uses Math;\nvar\n\tN,K,i,j:Longint;\n\tx,y,c:Array[1..60]of Longint;\n\trr:Array[1..60]of double;\n\tL,R,M,a,t,d,ri,rj,yy:double;\n\tflag:Boolean;\nfunction count(tx,ty:double):Boolean;\nvar i,cnt:Longint;\nbegin\n\tcnt:=0;\n\tfor i:=1 to N do if sqr(X[i]-tx)+sqr(Y[i]-ty)=K;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(x[i],y[i],c[i]);\n\tL:=0;\n\tR:=1000000;\n\twhile R-L>0.000000001 do begin\n\t\tM:=(L+R)/2;\n\t\tfor i:=1 to N do rr[i]:=M/c[i];\n\t\tflag:=False;\n\t\tfor i:=1 to N do begin\n\t\t\tif count(X[i],Y[i])then begin\n\t\t\t\tflag:=True;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then begin\n\t\t\tfor i:=2 to N do begin\n\t\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\t\td:=sqr(X[i]-X[j])+sqr(Y[i]-Y[j]);\n\t\t\t\t\tri:=rr[i];\n\t\t\t\t\trj:=rr[j];\n\t\t\t\t\tyy:=4*sqr(ri)*d-sqr(sqr(ri)+d-sqr(rj));\n\t\t\t\t\tif yy<0 then continue;\n\t\t\t\t\ta:=arctan2(sqrt(yy),sqr(ri)+d-sqr(rj));\n\t\t\t\t\tt:=arctan2(Y[j]-Y[i],X[j]-X[i]);\n\t\t\t\t\tif count(X[i]+ri*cos(t+a),Y[i]+ri*sin(t+a)) then flag:=True\n\t\t\t\t\telse if count(X[i]+ri*cos(t-a),Y[i]+ri*sin(t-a))then flag:=True;\n\t\t\t\t\tif flag then break;\n\t\t\t\tend;\n\t\t\t\tif flag then break;\n\t\t\tend;\n\t\tend;\n\t\tif flag then R:=M else L:=M;\n\tend;\n\twriteln(R:0:9);\nend.\n", "language": "Pascal", "metadata": {"date": 1583239558, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02764.html", "problem_id": "p02764", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02764/input.txt", "sample_output_relpath": "derived/input_output/data/p02764/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02764/Pascal/s647357764.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s647357764", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2.4\n", "input_to_evaluate": "uses Math;\nvar\n\tN,K,i,j:Longint;\n\tx,y,c:Array[1..60]of Longint;\n\trr:Array[1..60]of double;\n\tL,R,M,a,t,d,ri,rj,yy:double;\n\tflag:Boolean;\nfunction count(tx,ty:double):Boolean;\nvar i,cnt:Longint;\nbegin\n\tcnt:=0;\n\tfor i:=1 to N do if sqr(X[i]-tx)+sqr(Y[i]-ty)=K;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(x[i],y[i],c[i]);\n\tL:=0;\n\tR:=1000000;\n\twhile R-L>0.000000001 do begin\n\t\tM:=(L+R)/2;\n\t\tfor i:=1 to N do rr[i]:=M/c[i];\n\t\tflag:=False;\n\t\tfor i:=1 to N do begin\n\t\t\tif count(X[i],Y[i])then begin\n\t\t\t\tflag:=True;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then begin\n\t\t\tfor i:=2 to N do begin\n\t\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\t\td:=sqr(X[i]-X[j])+sqr(Y[i]-Y[j]);\n\t\t\t\t\tri:=rr[i];\n\t\t\t\t\trj:=rr[j];\n\t\t\t\t\tyy:=4*sqr(ri)*d-sqr(sqr(ri)+d-sqr(rj));\n\t\t\t\t\tif yy<0 then continue;\n\t\t\t\t\ta:=arctan2(sqrt(yy),sqr(ri)+d-sqr(rj));\n\t\t\t\t\tt:=arctan2(Y[j]-Y[i],X[j]-X[i]);\n\t\t\t\t\tif count(X[i]+ri*cos(t+a),Y[i]+ri*sin(t+a)) then flag:=True\n\t\t\t\t\telse if count(X[i]+ri*cos(t-a),Y[i]+ri*sin(t-a))then flag:=True;\n\t\t\t\t\tif flag then break;\n\t\t\t\tend;\n\t\t\t\tif flag then break;\n\t\t\tend;\n\t\tend;\n\t\tif flag then R:=M else L:=M;\n\tend;\n\twriteln(R:0:9);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "sample_input": "4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n"}, "reference_outputs": ["2.4\n"], "source_document_id": "p02764", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1161, "cpu_time_ms": 39, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s356960549", "group_id": "codeNet:p02771", "input_text": "program main;\nvar a,b,c: integer;\n\nbegin\nreadln(a,b,c);\n\nif (a=b) or (b=c) or (a=c) then \n begin \n if (a=b) and (b=c) and (a=c) then writeln('No')\n else writeln('Yes');\n end \nelse \n writeln('No');\n\nend.\n", "language": "Pascal", "metadata": {"date": 1600268279, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Pascal/s356960549.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s356960549", "user_id": "u880893396"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar a,b,c: integer;\n\nbegin\nreadln(a,b,c);\n\nif (a=b) or (b=c) or (a=c) then \n begin \n if (a=b) and (b=c) and (a=c) then writeln('No')\n else writeln('Yes');\n end \nelse \n writeln('No');\n\nend.\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s494274449", "group_id": "codeNet:p02771", "input_text": " program main;\n var a,b,c:integer;\n begin\n readln(a,b,c);\n if((a=b) and (a<>c)) or ((a=c) and (a<>b)) or ((b=c) and (b<>a))\n then writeln ('Yes')\n else writeln('No');\n end.", "language": "Pascal", "metadata": {"date": 1600268006, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Pascal/s494274449.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s494274449", "user_id": "u324512947"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": " program main;\n var a,b,c:integer;\n begin\n readln(a,b,c);\n if((a=b) and (a<>c)) or ((a=c) and (a<>b)) or ((b=c) and (b<>a))\n then writeln ('Yes')\n else writeln('No');\n end.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 4, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s514504098", "group_id": "codeNet:p02771", "input_text": "program main;\nvar \n a,b,c : integer;\nbegin \n readln(a,b,c);\n if (( a = b ) and ( a <> c )) or (( a = c ) and ( a <> b )) or (( b = c ) and ( b <> a )) then\n writeln('Yes') \n else \n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1600267463, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Pascal/s514504098.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s514504098", "user_id": "u743163683"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar \n a,b,c : integer;\nbegin \n readln(a,b,c);\n if (( a = b ) and ( a <> c )) or (( a = c ) and ( a <> b )) or (( b = c ) and ( b <> a )) then\n writeln('Yes') \n else \n writeln('No');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 5, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s262821542", "group_id": "codeNet:p02772", "input_text": "program main;\nvar\n n, i, t : longint;\n approved : boolean;\n\nbegin\n readln(n);\n approved := true;\n for i := 1 to n do begin\n read(t);\n if (t mod 2 = 0) and not((t mod 3 = 0) or (t mod 5 = 0)) then\n approved := false;\n end;\n readln;\n if approved then writeln('APPROVED')\n else writeln('DENIED');\n \nend.", "language": "Pascal", "metadata": {"date": 1600266243, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02772.html", "problem_id": "p02772", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02772/input.txt", "sample_output_relpath": "derived/input_output/data/p02772/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02772/Pascal/s262821542.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s262821542", "user_id": "u122156580"}, "prompt_components": {"gold_output": "APPROVED\n", "input_to_evaluate": "program main;\nvar\n n, i, t : longint;\n approved : boolean;\n\nbegin\n readln(n);\n approved := true;\n for i := 1 to n do begin\n read(t);\n if (t mod 2 = 0) and not((t mod 3 = 0) or (t mod 5 = 0)) then\n approved := false;\n end;\n readln;\n if approved then writeln('APPROVED')\n else writeln('DENIED');\n \nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\n\nAccording to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:\n\nAll even numbers written on the document are divisible by 3 or 5.\n\nIf the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.\n\nNotes\n\nThe condition in the statement can be rephrased as \"If x is an even number written on the document, x is divisible by 3 or 5\".\nHere \"if\" and \"or\" are logical terms.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nIf the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.\n\nSample Input 1\n\n5\n6 7 9 10 31\n\nSample Output 1\n\nAPPROVED\n\nThe even numbers written on the document are 6 and 10.\n\nAll of them are divisible by 3 or 5, so the immigrant should be allowed entry.\n\nSample Input 2\n\n3\n28 27 24\n\nSample Output 2\n\nDENIED\n\n28 violates the condition, so the immigrant should not be allowed entry.", "sample_input": "5\n6 7 9 10 31\n"}, "reference_outputs": ["APPROVED\n"], "source_document_id": "p02772", "source_text": "Score: 200 points\n\nProblem Statement\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\n\nAccording to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:\n\nAll even numbers written on the document are divisible by 3 or 5.\n\nIf the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.\n\nNotes\n\nThe condition in the statement can be rephrased as \"If x is an even number written on the document, x is divisible by 3 or 5\".\nHere \"if\" and \"or\" are logical terms.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nIf the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.\n\nSample Input 1\n\n5\n6 7 9 10 31\n\nSample Output 1\n\nAPPROVED\n\nThe even numbers written on the document are 6 and 10.\n\nAll of them are divisible by 3 or 5, so the immigrant should be allowed entry.\n\nSample Input 2\n\n3\n28 27 24\n\nSample Output 2\n\nDENIED\n\n28 violates the condition, so the immigrant should not be allowed entry.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 320, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s214887156", "group_id": "codeNet:p02773", "input_text": "var a:array[1..200001] of string;\n n,i,dem,j,max: longint;\n tg:string;\nprocedure sort(l,r: longint);\nvar mid:string;\nbegin\n if (l >= r) then exit;\n i:=l;\n j:=r;\n mid:=a[(i+j) div 2];\n while i < j do \n begin\n while (a[i] < mid) do inc(i);\n while (mid < a[j]) do dec(j);\n if (i <= j) then \n begin\n tg:=a[i];\n a[i]:=a[j];\n a[j]:=tg;\n inc(i);\n dec(j);\n end;\n end;\n sort(i,r);\n sort(l,j);\nend;\nprocedure sx;\nbegin\n for i := 1 to n-1 do \n for j := i+1 to n do \n if (a[i] > a[j]) then \n begin\n tg:=a[i];\n a[i]:=a[j];\n a[j]:=tg;\n end;\nend;\nbegin\n readln(n);\n for i := 1 to n do readln(a[i]);\n if (n > 3000) then sort(1,n)\n else \n sx;\n dem:=1;\n a[n+1]:='!';\n for i := 2 to n+1 do \n if a[i] = a[i-1] then inc(dem)\n else \n begin\n if (dem > max) then max:=dem;\n dem:=1;\n end;\n dem:=1;\n for i := 2 to n+1 do \n if (a[i] = a[i-1]) then inc(dem)\n else \n begin\n if (dem = max) then writeln(a[i-1]);\n dem:=1;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1587202014, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Pascal/s214887156.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s214887156", "user_id": "u497946030"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "var a:array[1..200001] of string;\n n,i,dem,j,max: longint;\n tg:string;\nprocedure sort(l,r: longint);\nvar mid:string;\nbegin\n if (l >= r) then exit;\n i:=l;\n j:=r;\n mid:=a[(i+j) div 2];\n while i < j do \n begin\n while (a[i] < mid) do inc(i);\n while (mid < a[j]) do dec(j);\n if (i <= j) then \n begin\n tg:=a[i];\n a[i]:=a[j];\n a[j]:=tg;\n inc(i);\n dec(j);\n end;\n end;\n sort(i,r);\n sort(l,j);\nend;\nprocedure sx;\nbegin\n for i := 1 to n-1 do \n for j := i+1 to n do \n if (a[i] > a[j]) then \n begin\n tg:=a[i];\n a[i]:=a[j];\n a[j]:=tg;\n end;\nend;\nbegin\n readln(n);\n for i := 1 to n do readln(a[i]);\n if (n > 3000) then sort(1,n)\n else \n sx;\n dem:=1;\n a[n+1]:='!';\n for i := 2 to n+1 do \n if a[i] = a[i-1] then inc(dem)\n else \n begin\n if (dem > max) then max:=dem;\n dem:=1;\n end;\n dem:=1;\n for i := 2 to n+1 do \n if (a[i] = a[i-1]) then inc(dem)\n else \n begin\n if (dem = max) then writeln(a[i-1]);\n dem:=1;\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1386, "cpu_time_ms": 313, "memory_kb": 59904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s362981597", "group_id": "codeNet:p02773", "input_text": "var a:array[1..200001] of string;\n n,i,dem,j,max: longint;\n tg:string;\nprocedure sort(l,r: longint);\nvar mid:string;\nbegin\n if (l >= r) then exit;\n i:=l;\n j:=r;\n mid:=a[(i+j) div 2];\n while i < j do \n begin\n while (a[i] < mid) do inc(i);\n while (mid < a[j]) do dec(j);\n if (i <= j) then \n begin\n tg:=a[i];\n a[i]:=a[j];\n a[j]:=tg;\n inc(i);\n dec(j);\n end;\n end;\n sort(i,r);\n sort(l,j);\nend;\nbegin\n readln(n);\n for i := 1 to n do readln(a[i]);\n sort(1,n);\n dem:=1;\n a[n+1]:='!';\n for i := 2 to n+1 do \n if a[i] = a[i-1] then inc(dem)\n else \n begin\n if (dem > max) then max:=dem;\n dem:=1;\n end;\n dem:=1;\n for i := 2 to n+1 do \n if (a[i] = a[i-1]) then inc(dem)\n else \n begin\n if (dem = max) then writeln(a[i-1]);\n dem:=1;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1587201782, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Pascal/s362981597.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s362981597", "user_id": "u497946030"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "var a:array[1..200001] of string;\n n,i,dem,j,max: longint;\n tg:string;\nprocedure sort(l,r: longint);\nvar mid:string;\nbegin\n if (l >= r) then exit;\n i:=l;\n j:=r;\n mid:=a[(i+j) div 2];\n while i < j do \n begin\n while (a[i] < mid) do inc(i);\n while (mid < a[j]) do dec(j);\n if (i <= j) then \n begin\n tg:=a[i];\n a[i]:=a[j];\n a[j]:=tg;\n inc(i);\n dec(j);\n end;\n end;\n sort(i,r);\n sort(l,j);\nend;\nbegin\n readln(n);\n for i := 1 to n do readln(a[i]);\n sort(1,n);\n dem:=1;\n a[n+1]:='!';\n for i := 2 to n+1 do \n if a[i] = a[i-1] then inc(dem)\n else \n begin\n if (dem > max) then max:=dem;\n dem:=1;\n end;\n dem:=1;\n for i := 2 to n+1 do \n if (a[i] = a[i-1]) then inc(dem)\n else \n begin\n if (dem = max) then writeln(a[i-1]);\n dem:=1;\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1095, "cpu_time_ms": 316, "memory_kb": 59904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s119968763", "group_id": "codeNet:p02777", "input_text": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(t <> u) then\n a := a - 1\n else if(s <> u) then \n b := b - 1;\n write(a,' ');\n writeln(b);\nend.", "language": "Pascal", "metadata": {"date": 1600268003, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s119968763.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s119968763", "user_id": "u212944395"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(t <> u) then\n a := a - 1\n else if(s <> u) then \n b := b - 1;\n write(a,' ');\n writeln(b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 2, "memory_kb": 1352}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s723777261", "group_id": "codeNet:p02777", "input_text": "program main;\nvar s,t,u: string ;\na,b : integer;\n \nbegin\na:=0; b:=0;\n\nreadln(s,t);\n\nreadln(a,b);\n\nreadln(u);\n \nif u=s then \na:=a-1;\n \nif u=t then \nb:=b-1;\n \nwriteln(a,b);\n \nend. ", "language": "Pascal", "metadata": {"date": 1600267887, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s723777261.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s723777261", "user_id": "u880893396"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar s,t,u: string ;\na,b : integer;\n \nbegin\na:=0; b:=0;\n\nreadln(s,t);\n\nreadln(a,b);\n\nreadln(u);\n \nif u=s then \na:=a-1;\n \nif u=t then \nb:=b-1;\n \nwriteln(a,b);\n \nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 5, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s209017412", "group_id": "codeNet:p02777", "input_text": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(u = s)\n \tthen writeln(a-1,b);\n if(u = t)\n \tthen writeln(a,b-1);\nend. ", "language": "Pascal", "metadata": {"date": 1600267336, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s209017412.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s209017412", "user_id": "u212944395"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(u = s)\n \tthen writeln(a-1,b);\n if(u = t)\n \tthen writeln(a,b-1);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 9, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s606982320", "group_id": "codeNet:p02777", "input_text": "program main;\nvar S,T,U : string;\nvar A,B : integer;\nbegin\nreadln (S,T);\nreadln (A,B);\nreadln (U);\n\nif U=S then A:=A-1;\nif T=S then B:=B-1;\n\nwriteln (A,B);\n\nend.", "language": "Pascal", "metadata": {"date": 1600267331, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s606982320.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s606982320", "user_id": "u529554074"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar S,T,U : string;\nvar A,B : integer;\nbegin\nreadln (S,T);\nreadln (A,B);\nreadln (U);\n\nif U=S then A:=A-1;\nif T=S then B:=B-1;\n\nwriteln (A,B);\n\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 161, "cpu_time_ms": 7, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s430924368", "group_id": "codeNet:p02777", "input_text": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u)\n \tthen a := a - 1\n \telse if(t = u)\n \tthen b:= b - 1;\n write(a,' ',b);\nend. ", "language": "Pascal", "metadata": {"date": 1600267151, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s430924368.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s430924368", "user_id": "u212944395"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u)\n \tthen a := a - 1\n \telse if(t = u)\n \tthen b:= b - 1;\n write(a,' ',b);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 2, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s147840522", "group_id": "codeNet:p02777", "input_text": "program main;\nvar s,t,u: string ;\na,b : integer;\n\nbegin\nreadln(s,t);\nreadln(a,b);\nreadln(u);\n\nif (u=s) then \nbegin \na:=a-1;\nwriteln(a,b);\nend;\n\nif (u=t) then \nbegin \nb:=b-1;\nwriteln(a,b);\nend;\n\nend. \n\n\n\n\n\n", "language": "Pascal", "metadata": {"date": 1600267145, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s147840522.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s147840522", "user_id": "u880893396"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar s,t,u: string ;\na,b : integer;\n\nbegin\nreadln(s,t);\nreadln(a,b);\nreadln(u);\n\nif (u=s) then \nbegin \na:=a-1;\nwriteln(a,b);\nend;\n\nif (u=t) then \nbegin \nb:=b-1;\nwriteln(a,b);\nend;\n\nend. \n\n\n\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 6, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s901070723", "group_id": "codeNet:p02778", "input_text": "program main;\nvar\n s : string;\n i : longint;\n\n\nbegin\n readln(s);\n for i := 1 to length(s) do \n write('x');\n writeln;\n\nend.", "language": "Pascal", "metadata": {"date": 1600266064, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02778.html", "problem_id": "p02778", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02778/input.txt", "sample_output_relpath": "derived/input_output/data/p02778/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02778/Pascal/s901070723.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s901070723", "user_id": "u122156580"}, "prompt_components": {"gold_output": "xxxxxxx\n", "input_to_evaluate": "program main;\nvar\n s : string;\n i : longint;\n\n\nbegin\n readln(s);\n for i := 1 to length(s) do \n write('x');\n writeln;\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "sample_input": "sardine\n"}, "reference_outputs": ["xxxxxxx\n"], "source_document_id": "p02778", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 130, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s292252973", "group_id": "codeNet:p02779", "input_text": "var a:array[0..200001] of longint;\n n,i:longint;p:boolean;\nprocedure sort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l;j:=r;mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if il then sort(l,j);\nend;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n sort(1,n);\n p:=false;\n for i:=2 to n do if a[i]=a[i-1] then p:=true;\n if p then writeln('NO')\n else writeln('YES');\nend.", "language": "Pascal", "metadata": {"date": 1586158835, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Pascal/s292252973.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s292252973", "user_id": "u476418095"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var a:array[0..200001] of longint;\n n,i:longint;p:boolean;\nprocedure sort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l;j:=r;mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if il then sort(l,j);\nend;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n sort(1,n);\n p:=false;\n for i:=2 to n do if a[i]=a[i-1] then p:=true;\n if p then writeln('NO')\n else writeln('YES');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 535, "cpu_time_ms": 49, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s694803332", "group_id": "codeNet:p02779", "input_text": "var n,i,t,p:longint;\n res,ord:array[0..1000000]of longword;\n a,b:array[0..1000000]of word;\n cnt:array[0..65535]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(t);\n a[i]:=t>>16;\n b[i]:=t and pred(1<<16);\n inc(cnt[b[i]]);\n end;\n p:=1;\n for i:=0 to 65534 do\n begin\n inc(cnt[p],cnt[i]);\n inc(p);\n end;\n for i:=1 to n do\n begin\n ord[cnt[b[i]]]:=i;\n dec(cnt[b[i]]);\n end;\n fillchar(cnt,sizeof(cnt),0);\n for i:=1 to n do\n inc(cnt[a[i]]);\n p:=1;\n for i:=0 to 65534 do\n begin\n inc(cnt[p],cnt[i]);\n inc(p);\n end;\n for i:=n downto 1 do\n begin\n p:=a[ord[i]];\n res[cnt[p]]:=ord[i];\n dec(cnt[p]);\n end;\n for i:=1 to n-1 do\n if a[res[i]]<<16 or b[res[i]]=a[res[i+1]]<<16 or b[res[i+1]] then\n begin\n writeln('NO');\n halt;\n end;\n writeln('YES');\nend.", "language": "Pascal", "metadata": {"date": 1582323947, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Pascal/s694803332.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s694803332", "user_id": "u743614777"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var n,i,t,p:longint;\n res,ord:array[0..1000000]of longword;\n a,b:array[0..1000000]of word;\n cnt:array[0..65535]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(t);\n a[i]:=t>>16;\n b[i]:=t and pred(1<<16);\n inc(cnt[b[i]]);\n end;\n p:=1;\n for i:=0 to 65534 do\n begin\n inc(cnt[p],cnt[i]);\n inc(p);\n end;\n for i:=1 to n do\n begin\n ord[cnt[b[i]]]:=i;\n dec(cnt[b[i]]);\n end;\n fillchar(cnt,sizeof(cnt),0);\n for i:=1 to n do\n inc(cnt[a[i]]);\n p:=1;\n for i:=0 to 65534 do\n begin\n inc(cnt[p],cnt[i]);\n inc(p);\n end;\n for i:=n downto 1 do\n begin\n p:=a[ord[i]];\n res[cnt[p]]:=ord[i];\n dec(cnt[p]);\n end;\n for i:=1 to n-1 do\n if a[res[i]]<<16 or b[res[i]]=a[res[i+1]]<<16 or b[res[i+1]] then\n begin\n writeln('NO');\n halt;\n end;\n writeln('YES');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 838, "cpu_time_ms": 41, "memory_kb": 9344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s353127565", "group_id": "codeNet:p02780", "input_text": "var\n n,k,t,i:longint;\n a,sum:array[0..300000] of real;\n ans:real;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n read(t);\n a[i]:=(1+t)*t div 2/t;\n sum[i]:=sum[i-1]+a[i];\n end;\n for i:=k to n do\n if sum[i]-sum[i-k]>ans then ans:=sum[i]-sum[i-k];\n writeln(ans:0:12);\nend.", "language": "Pascal", "metadata": {"date": 1581611257, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Pascal/s353127565.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s353127565", "user_id": "u224808808"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "var\n n,k,t,i:longint;\n a,sum:array[0..300000] of real;\n ans:real;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n read(t);\n a[i]:=(1+t)*t div 2/t;\n sum[i]:=sum[i-1]+a[i];\n end;\n for i:=k to n do\n if sum[i]-sum[i-k]>ans then ans:=sum[i]-sum[i-k];\n writeln(ans:0:12);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 21, "memory_kb": 3712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s324688504", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x :integer;\nbegin\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "language": "Pascal", "metadata": {"date": 1600268154, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s324688504.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s324688504", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x :integer;\nbegin\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 138, "cpu_time_ms": 8, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s780733432", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x,i :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "language": "Pascal", "metadata": {"date": 1600268080, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s780733432.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s780733432", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x,i :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s148639024", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "language": "Pascal", "metadata": {"date": 1600267905, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s148639024.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s148639024", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 148, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s387053196", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x,i :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "language": "Pascal", "metadata": {"date": 1600267857, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s387053196.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s387053196", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x,i :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s048007110", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x,i :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n writeln(x+1);\nend.", "language": "Pascal", "metadata": {"date": 1600267659, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s048007110.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s048007110", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x,i :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=H div A;\n writeln(x+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 2, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s122010772", "group_id": "codeNet:p02783", "input_text": " program main;\n var h,a,count : integer;\n begin\n count:=0;\n readln (h,a);\n repeat \n h:=h-a;\n count:=count+1;\n until (h<=0);\n writeln (count);\n end.", "language": "Pascal", "metadata": {"date": 1600267283, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s122010772.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s122010772", "user_id": "u324512947"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": " program main;\n var h,a,count : integer;\n begin\n count:=0;\n readln (h,a);\n repeat \n h:=h-a;\n count:=count+1;\n until (h<=0);\n writeln (count);\n end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 180, "cpu_time_ms": 3, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s617061559", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,count : integer;\nbegin\n\ncount:=0;\nreadln (H,A);\nrepeat \nH:=H-A;\ncount:=count+1;\nuntil (H<=0);\n\nwriteln (count);\n\nend.", "language": "Pascal", "metadata": {"date": 1600267067, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s617061559.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s617061559", "user_id": "u529554074"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,count : integer;\nbegin\n\ncount:=0;\nreadln (H,A);\nrepeat \nH:=H-A;\ncount:=count+1;\nuntil (H<=0);\n\nwriteln (count);\n\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 139, "cpu_time_ms": 5, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s720820969", "group_id": "codeNet:p02783", "input_text": "program main;\nvar h , a , count : integer;\nbegin\n\treadln(h,a);\n repeat\n \th := h -a;\n count := count + 1;\n until(h <= 0);\n writeln(count);\nend. ", "language": "Pascal", "metadata": {"date": 1600266923, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s720820969.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s720820969", "user_id": "u212944395"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar h , a , count : integer;\nbegin\n\treadln(h,a);\n repeat\n \th := h -a;\n count := count + 1;\n until(h <= 0);\n writeln(count);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s649781643", "group_id": "codeNet:p02783", "input_text": "program main;\nvar h , a , count : integer;\nbegin\n\treadln(h,a);\n repeat\n \th := h -a;\n count := count + 1;\n until(h = 0);\n writeln(count);\nend. ", "language": "Pascal", "metadata": {"date": 1600266850, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s649781643.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s649781643", "user_id": "u212944395"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar h , a , count : integer;\nbegin\n\treadln(h,a);\n repeat\n \th := h -a;\n count := count + 1;\n until(h = 0);\n writeln(count);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 164, "cpu_time_ms": 2205, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s471179587", "group_id": "codeNet:p02783", "input_text": "program main;\nvar h,a,ans: integer;\n\nbegin\nreadln(h,a);\nans:=0;\nrepeat\nh:=h-a;\nans:=ans+1;\nuntil h<=0;\nend.", "language": "Pascal", "metadata": {"date": 1600266733, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s471179587.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s471179587", "user_id": "u880893396"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar h,a,ans: integer;\n\nbegin\nreadln(h,a);\nans:=0;\nrepeat\nh:=h-a;\nans:=ans+1;\nuntil h<=0;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s900172090", "group_id": "codeNet:p02783", "input_text": "program main;\nvar \n a,b,c : QWord;\nbegin \n readln(a,b);\n c := a div b;\n if (a mod b <> 0) then\n inc(c);\n writeln(c);\nend.", "language": "Pascal", "metadata": {"date": 1600266670, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s900172090.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900172090", "user_id": "u743163683"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar \n a,b,c : QWord;\nbegin \n readln(a,b);\n c := a div b;\n if (a mod b <> 0) then\n inc(c);\n writeln(c);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s108169092", "group_id": "codeNet:p02783", "input_text": "program main;\nvar h,a,output: integer;\n \nbegin \nreadln(h,a);\noutput:=0;\nif (h>=1) and (a>=1) then \nrepeat \nh:=h-a;\noutput:=output+1;\nuntil (h<=0);\nend.", "language": "Pascal", "metadata": {"date": 1600265878, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s108169092.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s108169092", "user_id": "u880893396"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar h,a,output: integer;\n \nbegin \nreadln(h,a);\noutput:=0;\nif (h>=1) and (a>=1) then \nrepeat \nh:=h-a;\noutput:=output+1;\nuntil (h<=0);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 3, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s064686639", "group_id": "codeNet:p02783", "input_text": "program main;\nvar\n h, a, n : longint;\n\nbegin\n readln(h, a);\n n := h div a;\n if (h mod a <> 0) then inc(n);\n writeln(n);\nend.", "language": "Pascal", "metadata": {"date": 1600265378, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s064686639.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s064686639", "user_id": "u122156580"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar\n h, a, n : longint;\n\nbegin\n readln(h, a);\n n := h div a;\n if (h mod a <> 0) then inc(n);\n writeln(n);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 129, "cpu_time_ms": 7, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s589983488", "group_id": "codeNet:p02784", "input_text": "program main;\nvar \n H,N,i,ttl,r : integer;\nbegin \n ttl := 0;\n readln(H,N);\n for i := 1 to N do\n begin\n read(r);\n inc(ttl,r);\n end;\n if ( ttl > H ) or ( ttl = H ) then \n writeln('Yes')\n else \n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1600267826, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s589983488.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s589983488", "user_id": "u743163683"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar \n H,N,i,ttl,r : integer;\nbegin \n ttl := 0;\n readln(H,N);\n for i := 1 to N do\n begin\n read(r);\n inc(ttl,r);\n end;\n if ( ttl > H ) or ( ttl = H ) then \n writeln('Yes')\n else \n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 19, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s510806969", "group_id": "codeNet:p02784", "input_text": "program main;\nvar\n h, a, n, t, i : longint;\n win : boolean;\n\n\nbegin\n readln(h, n);\n a := 0;\n for i := 1 to n do begin\n read(t);\n inc(a, t);\n end;\n readln;\n if (h-a <= 0) then win := true\n else win := false;\n if win then writeln('Yes')\n else writeln('No');\n\nend.", "language": "Pascal", "metadata": {"date": 1600266006, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s510806969.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s510806969", "user_id": "u122156580"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar\n h, a, n, t, i : longint;\n win : boolean;\n\n\nbegin\n readln(h, n);\n a := 0;\n for i := 1 to n do begin\n read(t);\n inc(a, t);\n end;\n readln;\n if (h-a <= 0) then win := true\n else win := false;\n if win then writeln('Yes')\n else writeln('No');\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 278, "cpu_time_ms": 20, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s549704381", "group_id": "codeNet:p02784", "input_text": "var h,n,i,a:Longint;\nbegin\nread(h,n);\nfor i:=1 to n do begin\nread(a);\ndec(h,a);\nend;\nif h>0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1581639704, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s549704381.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549704381", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var h,n,i,a:Longint;\nbegin\nread(h,n);\nfor i:=1 to n do begin\nread(a);\ndec(h,a);\nend;\nif h>0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 135, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s160974280", "group_id": "codeNet:p02784", "input_text": "var\n\tsum,i,h,a:Integer;\n arr:array of Integer;\nbegin\n\tread(h,a);\n\tSetLength(arr, a);\n sum := 0;\n for i := 0 to High(arr) do begin\n read(arr[i]); \n sum := sum + arr[i];\n end;\n begin\n if sum > h then\n \twrite('Yes')\n else\n write('No');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1581271153, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s160974280.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s160974280", "user_id": "u663819790"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tsum,i,h,a:Integer;\n arr:array of Integer;\nbegin\n\tread(h,a);\n\tSetLength(arr, a);\n sum := 0;\n for i := 0 to High(arr) do begin\n read(arr[i]); \n sum := sum + arr[i];\n end;\n begin\n if sum > h then\n \twrite('Yes')\n else\n write('No');\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 299, "cpu_time_ms": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s488322374", "group_id": "codeNet:p02791", "input_text": "var\n n, v, min, cnt, i:integer;\nbegin\n read(n);\n cnt := 0;\n min := n + 1;\n for i := 1 to n do begin\n read(v);\n if v < min then begin\n cnt := cnt+1;\n min := v;\n end;\n end;\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1579524393, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Pascal/s488322374.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488322374", "user_id": "u394853232"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n, v, min, cnt, i:integer;\nbegin\n read(n);\n cnt := 0;\n min := n + 1;\n for i := 1 to n do begin\n read(v);\n if v < min then begin\n cnt := cnt+1;\n min := v;\n end;\n end;\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 24, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s756856191", "group_id": "codeNet:p02791", "input_text": "Var a,n,i,min,count:Longint;\nBegin\n Readln(n); min:=200001;\n For i:=1 to n do begin\n Read(a);\n If a P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 204, "cpu_time_ms": 25, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s220028873", "group_id": "codeNet:p02802", "input_text": "var n,m,i,x,ans,ans1:longint;\nf:array[0..100000]of boolean;\ny:string;\nbegin\nreadln(n,m);\nfor i:=1 to m do\n begin\n read(x);readln(y);\n if y='AC' then \n begin\n\tif not f[x] then inc(ans);\n\tf[x]:=true;\n\tend\n else if f[x]=false then inc(ans1);\n end;\nwriteln(ans,' ',ans1);\nend.", "language": "Pascal", "metadata": {"date": 1578881899, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Pascal/s220028873.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s220028873", "user_id": "u179392973"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "var n,m,i,x,ans,ans1:longint;\nf:array[0..100000]of boolean;\ny:string;\nbegin\nreadln(n,m);\nfor i:=1 to m do\n begin\n read(x);readln(y);\n if y='AC' then \n begin\n\tif not f[x] then inc(ans);\n\tf[x]:=true;\n\tend\n else if f[x]=false then inc(ans1);\n end;\nwriteln(ans,' ',ans1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 22, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s496020196", "group_id": "codeNet:p02811", "input_text": "program main;\nvar k,x : integer;\nbegin\n\nreadln (k,x);\nif (k*500>=x) then writeln ('Yes')\nelse writeln ('No');\n\nend.\n\n", "language": "Pascal", "metadata": {"date": 1599597054, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s496020196.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s496020196", "user_id": "u529554074"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar k,x : integer;\nbegin\n\nreadln (k,x);\nif (k*500>=x) then writeln ('Yes')\nelse writeln ('No');\n\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 2, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s413982316", "group_id": "codeNet:p02811", "input_text": "program main;\nvar a,b:integer;\nbegin\nwrite('input : '); readln(a, b);\nIf(a*500 < b) then writeln('Yes') \nelse writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1599595972, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s413982316.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s413982316", "user_id": "u324512947"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar a,b:integer;\nbegin\nwrite('input : '); readln(a, b);\nIf(a*500 < b) then writeln('Yes') \nelse writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s742497344", "group_id": "codeNet:p02811", "input_text": "program main;\nvar k,x : integer;\nbegin\n readln(k,x);\n k := k*500;\n if (k >= x) then writeln('Yes');\n if (k < x) then writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1599595106, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s742497344.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s742497344", "user_id": "u289438802"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar k,x : integer;\nbegin\n readln(k,x);\n k := k*500;\n if (k >= x) then writeln('Yes');\n if (k < x) then writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s978494954", "group_id": "codeNet:p02811", "input_text": "program main;\nvar k, x : integer;\n\nbegin \n\nreadln(k,x);\nif (k>=1) and (k<=100) and (x>=1) and (x<=100000) then\nbegin \nk:=500*k;\nif k>=x then writeln('Yes') else writeln('No');\nend;\n\nend.\n\n\n\n", "language": "Pascal", "metadata": {"date": 1599594894, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s978494954.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978494954", "user_id": "u880893396"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar k, x : integer;\n\nbegin \n\nreadln(k,x);\nif (k>=1) and (k<=100) and (x>=1) and (x<=100000) then\nbegin \nk:=500*k;\nif k>=x then writeln('Yes') else writeln('No');\nend;\n\nend.\n\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 1, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s763938048", "group_id": "codeNet:p02812", "input_text": "program main;\nvar n,g,count : integer;\nvar s : string;\nbegin\n\nreadln (n);\nreadln (s);\ncount:=0;\n\nfor g:=1 to (n+2) do\nif s[g]+s[g+1]+s[g+2]='ABC'\nthen count:=count+1;\n\nwriteln (count);\nend.", "language": "Pascal", "metadata": {"date": 1599597851, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Pascal/s763938048.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s763938048", "user_id": "u529554074"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar n,g,count : integer;\nvar s : string;\nbegin\n\nreadln (n);\nreadln (s);\ncount:=0;\n\nfor g:=1 to (n+2) do\nif s[g]+s[g+1]+s[g+2]='ABC'\nthen count:=count+1;\n\nwriteln (count);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s672090907", "group_id": "codeNet:p02812", "input_text": "program main;\nvar s : array[1..100] of char;\n n,i,c : integer;\nbegin\n readln(n);\n for i := 1 to n do \n read(s[i]);\n c := 0;\n for i := 1 to n do \n if (s[i] = 'A') and (s[i+1] = 'B') and (s[i+2] = 'C') then inc(c);\n writeln(c);\nend.", "language": "Pascal", "metadata": {"date": 1599596358, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Pascal/s672090907.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s672090907", "user_id": "u289438802"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar s : array[1..100] of char;\n n,i,c : integer;\nbegin\n readln(n);\n for i := 1 to n do \n read(s[i]);\n c := 0;\n for i := 1 to n do \n if (s[i] = 'A') and (s[i+1] = 'B') and (s[i+2] = 'C') then inc(c);\n writeln(c);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 246, "cpu_time_ms": 4, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s827441128", "group_id": "codeNet:p02812", "input_text": "program main;\nvar\n i, c, n : longint;\n s : string;\n\nbegin\n readln(n);\n readln(s);\n c := 0;\n for i := 1 to n do begin\n if (s[i] + s[i+1] + s[i+2] = 'ABC') then inc(c);\n end;\n writeln(c);\nend.", "language": "Pascal", "metadata": {"date": 1599594534, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Pascal/s827441128.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s827441128", "user_id": "u122156580"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar\n i, c, n : longint;\n s : string;\n\nbegin\n readln(n);\n readln(s);\n c := 0;\n for i := 1 to n do begin\n if (s[i] + s[i+1] + s[i+2] = 'ABC') then inc(c);\n end;\n writeln(c);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 3, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s241563203", "group_id": "codeNet:p02813", "input_text": "// credit: fwho1150\nprogram main;\n\ntype\n sample = array[1..8] of longint;\n\nvar\n n, order: longint;\n p, q: sample;\n\nprocedure input (var a: sample);\nvar\n i: longint;\n\nbegin\n for i := 1 to n do\n read(a[i]);\n readln;\nend;\n\nfunction code(var a: sample): sample;\nvar \n i, j, c: longint;\n\nbegin\n for i := 1 to n do\n a[i] := a[i] - 1;\n for i := 1 to n do begin\n c := 0;\n for j := 1 to (i - 1) do\n if (a[j] < a[i]) then \n inc(c);\n code[i] := a[i] - c;\n end;\nend;\n\nfunction fact(n: longint): longint;\nbegin\n if (n = 0) or (n = 1) then \n fact := 1\n else \n fact := n * fact(n - 1);\nend;\n\nfunction rank(a: sample): longint;\nvar\n i, tmp: longint;\n\nbegin\n tmp := 0;\n for i := 1 to n do \n tmp := tmp + a[i] * fact(n - i);\n rank := tmp;\nend;\n\nbegin\n readln(n);\n input(p);\n input(q);\n order := abs(rank(code(p)) - rank(code(q)));\n writeln(order);\nend.", "language": "Pascal", "metadata": {"date": 1599618022, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02813.html", "problem_id": "p02813", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02813/input.txt", "sample_output_relpath": "derived/input_output/data/p02813/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02813/Pascal/s241563203.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s241563203", "user_id": "u051422473"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "// credit: fwho1150\nprogram main;\n\ntype\n sample = array[1..8] of longint;\n\nvar\n n, order: longint;\n p, q: sample;\n\nprocedure input (var a: sample);\nvar\n i: longint;\n\nbegin\n for i := 1 to n do\n read(a[i]);\n readln;\nend;\n\nfunction code(var a: sample): sample;\nvar \n i, j, c: longint;\n\nbegin\n for i := 1 to n do\n a[i] := a[i] - 1;\n for i := 1 to n do begin\n c := 0;\n for j := 1 to (i - 1) do\n if (a[j] < a[i]) then \n inc(c);\n code[i] := a[i] - c;\n end;\nend;\n\nfunction fact(n: longint): longint;\nbegin\n if (n = 0) or (n = 1) then \n fact := 1\n else \n fact := n * fact(n - 1);\nend;\n\nfunction rank(a: sample): longint;\nvar\n i, tmp: longint;\n\nbegin\n tmp := 0;\n for i := 1 to n do \n tmp := tmp + a[i] * fact(n - i);\n rank := tmp;\nend;\n\nbegin\n readln(n);\n input(p);\n input(q);\n order := abs(rank(code(p)) - rank(code(q)));\n writeln(order);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "sample_input": "3\n1 3 2\n3 1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02813", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 979, "cpu_time_ms": 3, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s790092234", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s,t,output : string;\nbegin\nreadln (s,t);\noutput:=t+s;\nwriteln (output);\nend.", "language": "Pascal", "metadata": {"date": 1599598401, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s790092234.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s790092234", "user_id": "u529554074"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s,t,output : string;\nbegin\nreadln (s,t);\noutput:=t+s;\nwriteln (output);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 94, "cpu_time_ms": 5, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s157209073", "group_id": "codeNet:p02817", "input_text": "program main;\nvar a,b,k :integer;\n \nbegin \nreadln(a,b,k);\nrepeat \nrepeat \nif (a>=1) then begin a:=a-1;k:=k-1;\nend;\nuntil (a=0);\nif (a=0) and (b>=1) then begin b:=b-1;\nk:=k-1;end;\nuntil (k=0); \n \nwriteln(a,b);\n \nend.", "language": "Pascal", "metadata": {"date": 1599598215, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s157209073.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s157209073", "user_id": "u880893396"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar a,b,k :integer;\n \nbegin \nreadln(a,b,k);\nrepeat \nrepeat \nif (a>=1) then begin a:=a-1;k:=k-1;\nend;\nuntil (a=0);\nif (a=0) and (b>=1) then begin b:=b-1;\nk:=k-1;end;\nuntil (k=0); \n \nwriteln(a,b);\n \nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 2, "memory_kb": 1308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s420112504", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s,t : string;\nbegin\n\treadln(s,t);\n writeln(t,s);\nend.", "language": "Pascal", "metadata": {"date": 1599596970, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s420112504.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s420112504", "user_id": "u212944395"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s,t : string;\nbegin\n\treadln(s,t);\n writeln(t,s);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 74, "cpu_time_ms": 3, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s572603532", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s, t:string;\n\nbegin \nreadln(s,t);\nwriteln(t,s);\nend.", "language": "Pascal", "metadata": {"date": 1599596206, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s572603532.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s572603532", "user_id": "u880893396"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s, t:string;\n\nbegin \nreadln(s,t);\nwriteln(t,s);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 70, "cpu_time_ms": 5, "memory_kb": 1232}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s150464875", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s,t : string;\nbegin\n\treadln(s,t);\n write(t);\n write(s);\nend.", "language": "Pascal", "metadata": {"date": 1599596027, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s150464875.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s150464875", "user_id": "u212944395"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s,t : string;\nbegin\n\treadln(s,t);\n write(t);\n write(s);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 84, "cpu_time_ms": 5, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s159402632", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s: string;\nbegin\n readln(s);\n writeln(copy(s + s, pos(' ', s) + 1, length(s)))\nend.", "language": "Pascal", "metadata": {"date": 1599595712, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s159402632.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s159402632", "user_id": "u289438802"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s: string;\nbegin\n readln(s);\n writeln(copy(s + s, pos(' ', s) + 1, length(s)))\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 103, "cpu_time_ms": 3, "memory_kb": 1352}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s382650766", "group_id": "codeNet:p02817", "input_text": "program main;\nvar \n a, b, c : string;\n i : integer;\nbegin\n readln(a);\n for i := 1 to length(a) do \n if a[i] = ' ' then \n begin \n b := copy(a,1,i-1);\n c := copy(a,i+1,(length(a)-i));\n end;\n writeln(c,b);\nend.", "language": "Pascal", "metadata": {"date": 1599594770, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s382650766.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s382650766", "user_id": "u743163683"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar \n a, b, c : string;\n i : integer;\nbegin\n readln(a);\n for i := 1 to length(a) do \n if a[i] = ' ' then \n begin \n b := copy(a,1,i-1);\n c := copy(a,i+1,(length(a)-i));\n end;\n writeln(c,b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 281, "cpu_time_ms": 2, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s029999913", "group_id": "codeNet:p02817", "input_text": "program main;\nvar \n a, b, c : string[100];\n i : integer;\nbegin\n readln(a);\n for i := 1 to length(a) do \n if a[i] = ' ' then \n begin \n b := copy(a,1,i-1);\n c := copy(a,i+1,(length(a)-i));\n end;\n writeln(c,b);\nend.", "language": "Pascal", "metadata": {"date": 1599594573, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s029999913.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s029999913", "user_id": "u743163683"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar \n a, b, c : string[100];\n i : integer;\nbegin\n readln(a);\n for i := 1 to length(a) do \n if a[i] = ' ' then \n begin \n b := copy(a,1,i-1);\n c := copy(a,i+1,(length(a)-i));\n end;\n writeln(c,b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 5, "memory_kb": 1332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s853333303", "group_id": "codeNet:p02817", "input_text": "program main;\nvar\n c : char;\n s, t : string;\n\nbegin\n c := 'A';\n s := ''; t := '';\n while c <> ' ' do begin\n read(c);\n if c <> ' ' then\n s := s + c;\n end;\n while not eoln do begin\n read(c);\n t := t + c;\n end;\n writeln(t + s);\nend.", "language": "Pascal", "metadata": {"date": 1599594328, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s853333303.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s853333303", "user_id": "u122156580"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar\n c : char;\n s, t : string;\n\nbegin\n c := 'A';\n s := ''; t := '';\n while c <> ' ' do begin\n read(c);\n if c <> ' ' then\n s := s + c;\n end;\n while not eoln do begin\n read(c);\n t := t + c;\n end;\n writeln(t + s);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 255, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s279321964", "group_id": "codeNet:p02817", "input_text": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n read(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,pos(' ',a));\n writeln(a,b);\n readln;\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1577721392, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s279321964.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s279321964", "user_id": "u684763923"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n read(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,pos(' ',a));\n writeln(a,b);\n readln;\nend.\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s959271125", "group_id": "codeNet:p02817", "input_text": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n read(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,pos(' ',a));\n writeln(b,a);\n readln;\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1577721355, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s959271125.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s959271125", "user_id": "u684763923"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n read(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,pos(' ',a));\n writeln(b,a);\n readln;\nend.\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s105455779", "group_id": "codeNet:p02818", "input_text": "program main;\nvar a,b,k : longint;\nbegin\n\treadln(a,b,k);\n while(a > 0) and (k > 0) do begin\n a := a - 1;\n k := k - 1;\n if(a = 0) then begin\n b := b - 1;\n end;\n end; \n write(a);\n writeln(b);\nend. ", "language": "Pascal", "metadata": {"date": 1599598009, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s105455779.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s105455779", "user_id": "u212944395"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar a,b,k : longint;\nbegin\n\treadln(a,b,k);\n while(a > 0) and (k > 0) do begin\n a := a - 1;\n k := k - 1;\n if(a = 0) then begin\n b := b - 1;\n end;\n end; \n write(a);\n writeln(b);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 1169, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s815623799", "group_id": "codeNet:p02818", "input_text": "program main;\nvar a,b,k : integer;\nbegin\n\treadln(a,b,k);\n while(a > 0) and (k > 0) do begin\n a := a - 1;\n k := k - 1;\n if(a = 0) then begin\n b := b - 1;\n end;\n end; \n write(a);\n writeln(b);\nend. ", "language": "Pascal", "metadata": {"date": 1599597946, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s815623799.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s815623799", "user_id": "u212944395"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar a,b,k : integer;\nbegin\n\treadln(a,b,k);\n while(a > 0) and (k > 0) do begin\n a := a - 1;\n k := k - 1;\n if(a = 0) then begin\n b := b - 1;\n end;\n end; \n write(a);\n writeln(b);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 1166, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s634663779", "group_id": "codeNet:p02818", "input_text": "program main;\nvar a,b,k : integer;\nbegin\n readln(a,b,k);\n if (a >= 1000000000000) or (b >= 1000000000000) or (k >= 1000000000000) then writeln('0 0');\n if (a >= k) then writeln(a - k, ' ', b)\n else if (a + b >= k) then writeln(0, ' ', a + b - k)\n else writeln('0 0');\nend.", "language": "Pascal", "metadata": {"date": 1599597137, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s634663779.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s634663779", "user_id": "u289438802"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar a,b,k : integer;\nbegin\n readln(a,b,k);\n if (a >= 1000000000000) or (b >= 1000000000000) or (k >= 1000000000000) then writeln('0 0');\n if (a >= k) then writeln(a - k, ' ', b)\n else if (a + b >= k) then writeln(0, ' ', a + b - k)\n else writeln('0 0');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 283, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s816755448", "group_id": "codeNet:p02818", "input_text": "program main;\nvar a,b,k:integer;\nbegin\nreadln(a,b,k);\n if(a>=k) then a:=a-k;\n if(a=k) then a:=a-k;\n if(a= k ) then \n a := a-k\n else \n begin\n a := 0;\n k := k-a;\n if ( b > k ) then \n b := b-k\n else \n b := 0; \n end;\n writeln(a,' ',b);\nend.", "language": "Pascal", "metadata": {"date": 1599596217, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s634887486.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s634887486", "user_id": "u743163683"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if ( a >= k ) then \n a := a-k\n else \n begin\n a := 0;\n k := k-a;\n if ( b > k ) then \n b := b-k\n else \n b := 0; \n end;\n writeln(a,' ',b);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 296, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s130230538", "group_id": "codeNet:p02818", "input_text": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if ( a >= k ) then \n a := a-k\n else \n if ( b > k ) then \n b := b-k\n else \n b := 0; \n writeln(a,' ',b);\nend.", "language": "Pascal", "metadata": {"date": 1599596133, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s130230538.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s130230538", "user_id": "u743163683"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if ( a >= k ) then \n a := a-k\n else \n if ( b > k ) then \n b := b-k\n else \n b := 0; \n writeln(a,' ',b);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 227, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s746647696", "group_id": "codeNet:p02818", "input_text": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if (a > 100000000000) or (b > 100000000000) or (k > 100000000000) then\n writeln('0 0')\n else \n begin \n if ( a >= k ) then \n writeln(a-k,' ',b)\n else \n if ( a < k ) then \n writeln('0',' ',b-(k-a));\n end;\nend.", "language": "Pascal", "metadata": {"date": 1599595853, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s746647696.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s746647696", "user_id": "u743163683"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if (a > 100000000000) or (b > 100000000000) or (k > 100000000000) then\n writeln('0 0')\n else \n begin \n if ( a >= k ) then \n writeln(a-k,' ',b)\n else \n if ( a < k ) then \n writeln('0',' ',b-(k-a));\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 1, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s601486362", "group_id": "codeNet:p02819", "input_text": "program hi;\nvar \n si: array[2..100010] of boolean;\n x, i, j: longint;\n\nbegin\n for i := 2 to 100010 do \n si[i] := true;\n for i := 2 to 317 do begin\n j := i * i;\n while j <= 100010 do begin\n si[j] := false;\n j := j + i;\n end;\n end;\n readln(x);\n if si[x] then \n writeln(x)\n else begin\n i := x;\n while not si[i] do \n inc(i);\n writeln(i);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1599596086, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02819.html", "problem_id": "p02819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02819/input.txt", "sample_output_relpath": "derived/input_output/data/p02819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02819/Pascal/s601486362.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s601486362", "user_id": "u051422473"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program hi;\nvar \n si: array[2..100010] of boolean;\n x, i, j: longint;\n\nbegin\n for i := 2 to 100010 do \n si[i] := true;\n for i := 2 to 317 do begin\n j := i * i;\n while j <= 100010 do begin\n si[j] := false;\n j := j + i;\n end;\n end;\n readln(x);\n if si[x] then \n writeln(x)\n else begin\n i := x;\n while not si[i] do \n inc(i);\n writeln(i);\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "sample_input": "20\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02819", "source_text": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 460, "cpu_time_ms": 10, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s547743877", "group_id": "codeNet:p02819", "input_text": "program hi;\nvar \n si: array[2..100010] of boolean;\n x, i, j: longint;\n\nbegin\n for i := 2 to 100010 do \n si[i] := true;\n for i := 2 to 317 do begin\n j := i * i;\n while j <= 100010 do begin\n si[j] := false;\n j := j + i;\n end;\n end;\n readln(x);\n if si[x] then \n writeln(x)\n else begin\n i := x;\n while not si[i] do \n inc(i);\n writeln(i);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1599596062, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02819.html", "problem_id": "p02819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02819/input.txt", "sample_output_relpath": "derived/input_output/data/p02819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02819/Pascal/s547743877.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s547743877", "user_id": "u051422473"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program hi;\nvar \n si: array[2..100010] of boolean;\n x, i, j: longint;\n\nbegin\n for i := 2 to 100010 do \n si[i] := true;\n for i := 2 to 317 do begin\n j := i * i;\n while j <= 100010 do begin\n si[j] := false;\n j := j + i;\n end;\n end;\n readln(x);\n if si[x] then \n writeln(x)\n else begin\n i := x;\n while not si[i] do \n inc(i);\n writeln(i);\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "sample_input": "20\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02819", "source_text": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 460, "cpu_time_ms": 6, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s783446675", "group_id": "codeNet:p02819", "input_text": "\nvar n,i,j,max: longint;\nsnt: array[1..1000000] of boolean;\nbegin\n\nread(n);\nmax:=n*10;\nfor j:=1 to max do snt[j]:=true;\nsnt[1]:=false;\nj:=2;\nwhile j<=trunc(sqrt(max)) do\nbegin\nwhile snt[j]=false do inc(j);\nfor i:=2 to max div j do snt[i*j]:=false;\ninc(j);\nend;\nwhile snt[n]=false do inc(n);\nwrite(n);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577674978, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02819.html", "problem_id": "p02819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02819/input.txt", "sample_output_relpath": "derived/input_output/data/p02819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02819/Pascal/s783446675.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s783446675", "user_id": "u398406871"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "\nvar n,i,j,max: longint;\nsnt: array[1..1000000] of boolean;\nbegin\n\nread(n);\nmax:=n*10;\nfor j:=1 to max do snt[j]:=true;\nsnt[1]:=false;\nj:=2;\nwhile j<=trunc(sqrt(max)) do\nbegin\nwhile snt[j]=false do inc(j);\nfor i:=2 to max div j do snt[i*j]:=false;\ninc(j);\nend;\nwhile snt[n]=false do inc(n);\nwrite(n);\n\nend.\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "sample_input": "20\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02819", "source_text": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 4, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s870808798", "group_id": "codeNet:p02821", "input_text": "\nvar n,m,count,i,j,j1,sum,x,tam,k: longint;\na: array[1..10000] of longint;\n procedure qs(l,r: longint);\nBEGIN\ni:=l;\nj:=r;\nx:=a[(i+j) div 2];\nrepeat\nwhile a[i]>x do inc(i);\nwhile a[j]j;\nif li then qs(i,r);\nend;\nbegin\n\nread(n,k);\nfor i:=1 to n do read(a[i]);\nqs(1,n);\nfor i:=1 to n do\nfor j:=i to n do\nbegin\nif i=j then begin\nsum:=sum+a[i]+a[j];\ninc(count); if count=k then begin write(sum); exit; end;\nend else for j1:=1 to 2 do begin sum:=sum+a[i]+a[j]; inc(count); if\ncount=k then begin write(sum); exit; end; end;\nend;\nend.\n", "language": "Pascal", "metadata": {"date": 1577680001, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02821.html", "problem_id": "p02821", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02821/input.txt", "sample_output_relpath": "derived/input_output/data/p02821/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02821/Pascal/s870808798.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s870808798", "user_id": "u398406871"}, "prompt_components": {"gold_output": "202\n", "input_to_evaluate": "\nvar n,m,count,i,j,j1,sum,x,tam,k: longint;\na: array[1..10000] of longint;\n procedure qs(l,r: longint);\nBEGIN\ni:=l;\nj:=r;\nx:=a[(i+j) div 2];\nrepeat\nwhile a[i]>x do inc(i);\nwhile a[j]j;\nif li then qs(i,r);\nend;\nbegin\n\nread(n,k);\nfor i:=1 to n do read(a[i]);\nqs(1,n);\nfor i:=1 to n do\nfor j:=i to n do\nbegin\nif i=j then begin\nsum:=sum+a[i]+a[j];\ninc(count); if count=k then begin write(sum); exit; end;\nend else for j1:=1 to 2 do begin sum:=sum+a[i]+a[j]; inc(count); if\ncount=k then begin write(sum); exit; end; end;\nend;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "sample_input": "5 3\n10 14 19 34 33\n"}, "reference_outputs": ["202\n"], "source_document_id": "p02821", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 650, "cpu_time_ms": 105, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s085273985", "group_id": "codeNet:p02830", "input_text": "uses crt;\nvar\n n,d,i,j:byte;\n t,a,b,c:string;\nbegin\n\n clrscr;\n readln(n);\n readln(t);\n for i:=1 to n do if t[i]<>' ' then a:=a+t[i];\n for j:=1 to n do b:=b+t[i+j+1];\n i:=0;\n while i<>n do\n begin\n if (d=0) then\n begin\n inc(i);\n c:=c+a[i];\n inc(d);\n end;\n if (d=1) then\n begin\n c:=c+b[i];\n dec(d);\n end;\n end;\n write(c);\n readln;\nend.\n\n\n\n\n\n", "language": "Pascal", "metadata": {"date": 1577313570, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02830.html", "problem_id": "p02830", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02830/input.txt", "sample_output_relpath": "derived/input_output/data/p02830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02830/Pascal/s085273985.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s085273985", "user_id": "u322930761"}, "prompt_components": {"gold_output": "icpc\n", "input_to_evaluate": "uses crt;\nvar\n n,d,i,j:byte;\n t,a,b,c:string;\nbegin\n\n clrscr;\n readln(n);\n readln(t);\n for i:=1 to n do if t[i]<>' ' then a:=a+t[i];\n for j:=1 to n do b:=b+t[i+j+1];\n i:=0;\n while i<>n do\n begin\n if (d=0) then\n begin\n inc(i);\n c:=c+a[i];\n inc(d);\n end;\n if (d=1) then\n begin\n c:=c+b[i];\n dec(d);\n end;\n end;\n write(c);\n readln;\nend.\n\n\n\n\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "sample_input": "2\nip cc\n"}, "reference_outputs": ["icpc\n"], "source_document_id": "p02830", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 635, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s996467769", "group_id": "codeNet:p02830", "input_text": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n readln(n);\n readln(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,n+1);\n for i:=1 to length(b) do\n write(a[i],b[i]);\n readln\nend.\n", "language": "Pascal", "metadata": {"date": 1577313408, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02830.html", "problem_id": "p02830", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02830/input.txt", "sample_output_relpath": "derived/input_output/data/p02830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02830/Pascal/s996467769.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s996467769", "user_id": "u684763923"}, "prompt_components": {"gold_output": "icpc\n", "input_to_evaluate": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n readln(n);\n readln(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,n+1);\n for i:=1 to length(b) do\n write(a[i],b[i]);\n readln\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "sample_input": "2\nip cc\n"}, "reference_outputs": ["icpc\n"], "source_document_id": "p02830", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s026266236", "group_id": "codeNet:p02831", "input_text": "uses crt,math;\nvar a,b:longint;\n i,j:qword;\nbegin\n clrscr;\n readln(a,b);\n i:=a;\n j:=b;\n while (true) do begin\n if (a=0) or (b=0) then break;\n if (a>b) then a := a mod b else\n if (b>a) then b := b mod a else break;\n end;\n write((i*j)div max(a,b));\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577372060, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Pascal/s026266236.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s026266236", "user_id": "u684763923"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "uses crt,math;\nvar a,b:longint;\n i,j:qword;\nbegin\n clrscr;\n readln(a,b);\n i:=a;\n j:=b;\n while (true) do begin\n if (a=0) or (b=0) then break;\n if (a>b) then a := a mod b else\n if (b>a) then b := b mod a else break;\n end;\n write((i*j)div max(a,b));\n readln\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 374, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s688070344", "group_id": "codeNet:p02831", "input_text": "var a,b:longint;\ntmp:int64;\nbegin\n readln(a, b);\n if b>a then begin\n tmp:=a;\n a:=b;\n b:=a;\n end;\n tmp:=a;\n while true do begin\n tmp:=tmp+a;\n if tmp mod b = 0 then begin\n writeln(tmp);\n break;\n end;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1577311623, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Pascal/s688070344.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s688070344", "user_id": "u635762866"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var a,b:longint;\ntmp:int64;\nbegin\n readln(a, b);\n if b>a then begin\n tmp:=a;\n a:=b;\n b:=a;\n end;\n tmp:=a;\n while true do begin\n tmp:=tmp+a;\n if tmp mod b = 0 then begin\n writeln(tmp);\n break;\n end;\n end;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 387, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s648618462", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..200000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n d:=1;\n for i:=1 to n do\n if (a[i]=d)then inc(d);\n if (d=1)then write(-1) else write(n-d+1);\n readln;\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577377747, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s648618462.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s648618462", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..200000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n d:=1;\n for i:=1 to n do\n if (a[i]=d)then inc(d);\n if (d=1)then write(-1) else write(n-d+1);\n readln;\n readln\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 27, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s462648378", "group_id": "codeNet:p02832", "input_text": "var n,k,i:longint;\n b:array[1..200001] of longint;\n f:text;\nbegin\nreadln(n);\nk:=1;\nfor i:=1 to n do\nread(b[i]);\nfor i:=1 to n do\nbegin\nif b[i]=k then inc(k);\nend;\nif k=1 then write('-1') else write(n-k+1);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577376944, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s462648378.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s462648378", "user_id": "u497047145"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,k,i:longint;\n b:array[1..200001] of longint;\n f:text;\nbegin\nreadln(n);\nk:=1;\nfor i:=1 to n do\nread(b[i]);\nfor i:=1 to n do\nbegin\nif b[i]=k then inc(k);\nend;\nif k=1 then write('-1') else write(n-k+1);\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 24, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s464986904", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..1000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n if (a[i+1]-a[i]=1)and(a[i]-d=1)then inc(d)else\n if (a[i+1]-d=1)then inc(d);\n if (d<>0)then write(n-d)else write(d);\n readln;\n readln\nend.\n\n\n\n", "language": "Pascal", "metadata": {"date": 1577376848, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s464986904.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s464986904", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..1000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n if (a[i+1]-a[i]=1)and(a[i]-d=1)then inc(d)else\n if (a[i+1]-d=1)then inc(d);\n if (d<>0)then write(n-d)else write(d);\n readln;\n readln\nend.\n\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 353, "cpu_time_ms": 99, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s302752024", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar i,n,count,j: longint;\na: array[1..300000] of longint;\nbegin\nclrscr;\nread(n);\nFOR i:=1 TO n do read(a[i]);\ni:=1; j:=1;\nwhile (i<=n) and(j<=n) do\nbegin\nwhile (a[j]<>i) and (j<=n) do begin inc(count); inc(j); end;\ninc(j);\ninc(i);\nend;\nif count=n then write('-1') else write(count);\nreadln;\nreadln;\nend.\n", "language": "Pascal", "metadata": {"date": 1577314970, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s302752024.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s302752024", "user_id": "u398406871"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar i,n,count,j: longint;\na: array[1..300000] of longint;\nbegin\nclrscr;\nread(n);\nFOR i:=1 TO n do read(a[i]);\ni:=1; j:=1;\nwhile (i<=n) and(j<=n) do\nbegin\nwhile (a[j]<>i) and (j<=n) do begin inc(count); inc(j); end;\ninc(j);\ninc(i);\nend;\nif count=n then write('-1') else write(count);\nreadln;\nreadln;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 316, "cpu_time_ms": 27, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s026439600", "group_id": "codeNet:p02837", "input_text": "var\n\tN,A,x,y,i,j,out,ans,nowt,nowf,ccc:Longint;\n\tF,T,gF,gT:Array[1..15]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(A);\n\t\tfor j:=1 to A do begin\n\t\t\tread(x,y);\n\t\t\tdec(x);\n\t\t\tif y=0 then F[i]:=F[i] or (1<>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\t\tif((out and nowt)<>0)or((nowt and nowf)<>0)then out:=out or(1<<(i-1));\n\tend;\n\ti:=((1<0 do begin\n\t\tccc:=0;\n\t\tnowt:=i;\n\t\tnowf:=0;\n\t\tfor j:=1 to N do begin\n\t\t\tif ((nowt>>(j-1))and 1)=1 then begin\n\t\t\t\tinc(ccc);\n\t\t\t\tnowt:=nowt or gT[j];\n\t\t\t\tnowf:=nowf or gF[j];\n\t\t\tend;\n\t\tend;\n\t\tif((nowt and nowf)=0)and(ans>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\t\tif((out and nowt)<>0)or((nowt and nowf)<>0)then out:=out or(1<<(i-1));\n\tend;\n\ti:=((1<0 do begin\n\t\tccc:=0;\n\t\tnowt:=i;\n\t\tnowf:=0;\n\t\tfor j:=1 to N do begin\n\t\t\tif ((nowt>>(j-1))and 1)=1 then begin\n\t\t\t\tinc(ccc);\n\t\t\t\tnowt:=nowt or gT[j];\n\t\t\t\tnowf:=nowf or gF[j];\n\t\t\tend;\n\t\tend;\n\t\tif((nowt and nowf)=0)and(ans= p then dec(x, p);\n exit(x);\nend;\nfunction mul(x, y: longint): longint; inline;\nbegin\n exit(int64(x) * y mod p);\nend;\nbegin\n read(n);\n for i := 1 to n do read(a[i]);\n for i := 0 to 59 do\n begin\n s := 0;\n for j := 1 to n do inc(s, (a[j] shr i) and 1);\n ans := add(ans, mul(mul(s, n - s), int64(1) shl i mod p));\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1575858576, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02838.html", "problem_id": "p02838", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02838/input.txt", "sample_output_relpath": "derived/input_output/data/p02838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02838/Pascal/s610194164.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s610194164", "user_id": "u214724132"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "const p = 1000000007;\nvar\n a: array [1..300000] of int64;\n n, i, j, s, ans: longint;\nfunction add(x, y: longint): longint; inline;\nbegin\n inc(x, y);\n if x >= p then dec(x, p);\n exit(x);\nend;\nfunction mul(x, y: longint): longint; inline;\nbegin\n exit(int64(x) * y mod p);\nend;\nbegin\n read(n);\n for i := 1 to n do read(a[i]);\n for i := 0 to 59 do\n begin\n s := 0;\n for j := 1 to n do inc(s, (a[j] shr i) and 1);\n ans := add(ans, mul(mul(s, n - s), int64(1) shl i mod p));\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02838", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 118, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s250220240", "group_id": "codeNet:p02842", "input_text": "var\n n, i : integer;\n ans : boolean;\nbegin\n readln(n);\n i := 1;\n while trunc(i * 1.08) < n do\n begin\n i := i + 1;\n end;\n if trunc(i * 1.08) = n then\n writeln(i)\n else\n writeln(':(');\nend.", "language": "Pascal", "metadata": {"date": 1587271121, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Pascal/s250220240.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s250220240", "user_id": "u048773461"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "var\n n, i : integer;\n ans : boolean;\nbegin\n readln(n);\n i := 1;\n while trunc(i * 1.08) < n do\n begin\n i := i + 1;\n end;\n if trunc(i * 1.08) = n then\n writeln(i)\n else\n writeln(':(');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 230, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s871756029", "group_id": "codeNet:p02848", "input_text": "var i,n,t:Longint;s:String;\nbegin\nreadln(n);\nreadln(s);\nfor i:=1 to length(s)do begin\n\tt:=ord(s[i])+n;\n\tif t>90 then t:=t-26;\n\ts[i]:=chr(t);\nend;\nwriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1574651029, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Pascal/s871756029.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s871756029", "user_id": "u657913472"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "var i,n,t:Longint;s:String;\nbegin\nreadln(n);\nreadln(s);\nfor i:=1 to length(s)do begin\n\tt:=ord(s[i])+n;\n\tif t>90 then t:=t-26;\n\ts[i]:=chr(t);\nend;\nwriteln(s);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s290428560", "group_id": "codeNet:p02848", "input_text": "Var n,i,rem:Longint;\n S:Ansistring;\nBegin\n Readln(n);\n Readln(S);\n For i:=1 to length(S) do begin\n rem:=ord(S[i])+n;\n If rem>90 then rem:=rem-26;\n S[i]:=chr(rem);\n End;\n Writeln(S);\nEnd.", "language": "Pascal", "metadata": {"date": 1574647524, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Pascal/s290428560.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s290428560", "user_id": "u866155170"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "Var n,i,rem:Longint;\n S:Ansistring;\nBegin\n Readln(n);\n Readln(S);\n For i:=1 to length(S) do begin\n rem:=ord(S[i])+n;\n If rem>90 then rem:=rem-26;\n S[i]:=chr(rem);\n End;\n Writeln(S);\nEnd.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 225, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s734609383", "group_id": "codeNet:p02854", "input_text": "var n,i:Longint;\ns,t,m:int64;\na:Array[1..200000]of Longint;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(a[i]);\ninc(s,a[i]);\nend;\nm:=s;\nfor i:=1 to n-1 do begin\ninc(t,a[i]);dec(s,a[i]);\nif(st-s)then m:=t-s else if(s>=t)and(m>s-t)then m:=s-t;\nend;\nwriteln(m);\nend.", "language": "Pascal", "metadata": {"date": 1581663250, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02854.html", "problem_id": "p02854", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02854/input.txt", "sample_output_relpath": "derived/input_output/data/p02854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02854/Pascal/s734609383.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s734609383", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i:Longint;\ns,t,m:int64;\na:Array[1..200000]of Longint;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(a[i]);\ninc(s,a[i]);\nend;\nm:=s;\nfor i:=1 to n-1 do begin\ninc(t,a[i]);dec(s,a[i]);\nif(st-s)then m:=t-s else if(s>=t)and(m>s-t)then m:=s-t;\nend;\nwriteln(m);\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "sample_input": "3\n2 4 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02854", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 36, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s475400734", "group_id": "codeNet:p02854", "input_text": "var\n s: array [0..200000] of int64;\n n, i: longint;\n x, ans: int64;\nfunction min(x, y: int64): int64; inline;\nbegin\n if x < y then exit(x) else exit(y);\nend;\nbegin\n read(n);\n for i := 1 to n do\n begin\n read(x);\n s[i] := s[i - 1] + x;\n end;\n ans := 1000000000000000000;\n for i := 1 to n - 1 do ans := min(ans, abs(s[i] shl 1 - s[n]));\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1574563174, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02854.html", "problem_id": "p02854", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02854/input.txt", "sample_output_relpath": "derived/input_output/data/p02854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02854/Pascal/s475400734.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s475400734", "user_id": "u214724132"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n s: array [0..200000] of int64;\n n, i: longint;\n x, ans: int64;\nfunction min(x, y: int64): int64; inline;\nbegin\n if x < y then exit(x) else exit(y);\nend;\nbegin\n read(n);\n for i := 1 to n do\n begin\n read(x);\n s[i] := s[i - 1] + x;\n end;\n ans := 1000000000000000000;\n for i := 1 to n - 1 do ans := min(ans, abs(s[i] shl 1 - s[n]));\n writeln(ans);\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "sample_input": "3\n2 4 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02854", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 370, "cpu_time_ms": 34, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s796985906", "group_id": "codeNet:p02854", "input_text": "var n,i,j,left,right:int64;\n A:array[1..200050] of int64;\nbegin\nread(n);\nleft:=0;\nright:=0;\nfor i := 1 to n do read(A[i]);\ni:=0;j:=0;\nwhile i+j= left then\n begin\n left := left+A[i+1];\n inc(i);\n \n end\n else \n begin\n right := right+A[N-j];\n inc(j);\n \n end;\nwrite(abs(right-left))\nend.", "language": "Pascal", "metadata": {"date": 1574562470, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02854.html", "problem_id": "p02854", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02854/input.txt", "sample_output_relpath": "derived/input_output/data/p02854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02854/Pascal/s796985906.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s796985906", "user_id": "u655683235"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,j,left,right:int64;\n A:array[1..200050] of int64;\nbegin\nread(n);\nleft:=0;\nright:=0;\nfor i := 1 to n do read(A[i]);\ni:=0;j:=0;\nwhile i+j= left then\n begin\n left := left+A[i+1];\n inc(i);\n \n end\n else \n begin\n right := right+A[N-j];\n inc(j);\n \n end;\nwrite(abs(right-left))\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "sample_input": "3\n2 4 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02854", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 320, "cpu_time_ms": 35, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s145520815", "group_id": "codeNet:p02855", "input_text": "type pair=record x,y:int64 end;\n ary1=array[1..920] of pair;\n ary2=array[1..310,1..310] of int64;\nvar h,w,k,i,j,n,last:int64;\n marker:pair;\n s:ary1;\n ans:ary2;\n c:char;\n \nprocedure update(a,b,c,d,e: int64);\nvar i1,j1:int64;\nbegin\n for i1 := a to c do\n for j1 := b to d do\n ans[i1][j1]:=e;\nend;\n\nbegin\nreadln(h,w,k);\nn:=1;\nfor i := 1 to h do\n begin\n for j := 1 to w do\n begin\n read(c);\n if c='#' then \n begin\n s[n].y:=i;\n s[n].x:=j;\n last:=i;\n inc(n)\n end;\n if n=k+1 then break;\n end;\n readln;\n end;\nn:=1;\nupdate(1,1,s[1].y,s[1].x,n);\nmarker.y:=1;marker.x:=s[1].x+1;\ninc(n);\nfor i := 2 to k do\n if s[i-1].y = s[i].y then\n begin\n if s[i].y= last then update(marker.y,marker.x,h,s[i].x,n)\n else update(marker.y,marker.x,s[i].y,s[i].x,n);\n marker.x:=s[i].x+1;\n inc(n)\n end\n else \n begin\n update(marker.y,marker.x,s[i-1].y,w,n-1);\n if s[i].y= last then update(s[i-1].y+1,1,h,s[i].x,n)\n else update(s[i-1].y+1,1,s[i].y,s[i].x,n);\n marker.y:=s[i-1].y+1;marker.x:=s[i].x+1;\n inc(n)\n end;\n\nupdate(marker.y,s[i].x+1,h,w,n-1);\n\nfor i := 1 to h do\n begin\n for j := 1 to w do\n write(ans[i][j],' ');\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1574571069, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02855.html", "problem_id": "p02855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02855/input.txt", "sample_output_relpath": "derived/input_output/data/p02855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02855/Pascal/s145520815.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s145520815", "user_id": "u655683235"}, "prompt_components": {"gold_output": "1 2 2\n1 3 4\n5 5 4\n", "input_to_evaluate": "type pair=record x,y:int64 end;\n ary1=array[1..920] of pair;\n ary2=array[1..310,1..310] of int64;\nvar h,w,k,i,j,n,last:int64;\n marker:pair;\n s:ary1;\n ans:ary2;\n c:char;\n \nprocedure update(a,b,c,d,e: int64);\nvar i1,j1:int64;\nbegin\n for i1 := a to c do\n for j1 := b to d do\n ans[i1][j1]:=e;\nend;\n\nbegin\nreadln(h,w,k);\nn:=1;\nfor i := 1 to h do\n begin\n for j := 1 to w do\n begin\n read(c);\n if c='#' then \n begin\n s[n].y:=i;\n s[n].x:=j;\n last:=i;\n inc(n)\n end;\n if n=k+1 then break;\n end;\n readln;\n end;\nn:=1;\nupdate(1,1,s[1].y,s[1].x,n);\nmarker.y:=1;marker.x:=s[1].x+1;\ninc(n);\nfor i := 2 to k do\n if s[i-1].y = s[i].y then\n begin\n if s[i].y= last then update(marker.y,marker.x,h,s[i].x,n)\n else update(marker.y,marker.x,s[i].y,s[i].x,n);\n marker.x:=s[i].x+1;\n inc(n)\n end\n else \n begin\n update(marker.y,marker.x,s[i-1].y,w,n-1);\n if s[i].y= last then update(s[i-1].y+1,1,h,s[i].x,n)\n else update(s[i-1].y+1,1,s[i].y,s[i].x,n);\n marker.y:=s[i-1].y+1;marker.x:=s[i].x+1;\n inc(n)\n end;\n\nupdate(marker.y,s[i].x+1,h,w,n-1);\n\nfor i := 1 to h do\n begin\n for j := 1 to w do\n write(ans[i][j],' ');\n writeln;\n end;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "sample_input": "3 3 5\n#.#\n.#.\n#.#\n"}, "reference_outputs": ["1 2 2\n1 3 4\n5 5 4\n"], "source_document_id": "p02855", "source_text": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1208, "cpu_time_ms": 99, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s293666372", "group_id": "codeNet:p02855", "input_text": "var\n a: array [1..300, 1..300] of boolean;\n b: array [1..300] of boolean;\n ans: array [1..300, 1..300] of longint;\n n, m, k, i, j, cnt, start: longint;\n c: char;\n f: boolean;\nbegin\n readln(n, m, k);\n for i := 1 to n do\n begin\n for j := 1 to m do\n begin\n read(c);\n if c = '#' then\n begin\n a[i, j] := true;\n b[i] := true;\n end;\n end;\n readln;\n end;\n cnt := 0;\n for i := 1 to n do\n if b[i] then\n break;\n start := i;\n for i := i to n do\n if b[i] then\n begin\n inc(cnt);\n f := false;\n for j := 1 to m + 1 do\n begin\n if j = m + 1 then\n break;\n if a[i, j] then\n if f then\n break\n else\n f := true;\n ans[i, j] := cnt;\n end; \n for j := j to m do\n begin\n if a[i, j] then\n inc(cnt);\n ans[i, j] := cnt;\n end;\n end\n else\n for j := 1 to m do\n ans[i, j] := ans[i - 1, j];\n for i := 1 to start - 1 do\n for j := 1 to m do\n ans[i, j] := ans[start, j];\n for i := 1 to n do\n begin\n for j := 1 to m do\n write(ans[i, j], ' ');\n writeln;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1574565538, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02855.html", "problem_id": "p02855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02855/input.txt", "sample_output_relpath": "derived/input_output/data/p02855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02855/Pascal/s293666372.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s293666372", "user_id": "u214724132"}, "prompt_components": {"gold_output": "1 2 2\n1 3 4\n5 5 4\n", "input_to_evaluate": "var\n a: array [1..300, 1..300] of boolean;\n b: array [1..300] of boolean;\n ans: array [1..300, 1..300] of longint;\n n, m, k, i, j, cnt, start: longint;\n c: char;\n f: boolean;\nbegin\n readln(n, m, k);\n for i := 1 to n do\n begin\n for j := 1 to m do\n begin\n read(c);\n if c = '#' then\n begin\n a[i, j] := true;\n b[i] := true;\n end;\n end;\n readln;\n end;\n cnt := 0;\n for i := 1 to n do\n if b[i] then\n break;\n start := i;\n for i := i to n do\n if b[i] then\n begin\n inc(cnt);\n f := false;\n for j := 1 to m + 1 do\n begin\n if j = m + 1 then\n break;\n if a[i, j] then\n if f then\n break\n else\n f := true;\n ans[i, j] := cnt;\n end; \n for j := j to m do\n begin\n if a[i, j] then\n inc(cnt);\n ans[i, j] := cnt;\n end;\n end\n else\n for j := 1 to m do\n ans[i, j] := ans[i - 1, j];\n for i := 1 to start - 1 do\n for j := 1 to m do\n ans[i, j] := ans[start, j];\n for i := 1 to n do\n begin\n for j := 1 to m do\n write(ans[i, j], ' ');\n writeln;\n end;\nend.\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "sample_input": "3 3 5\n#.#\n.#.\n#.#\n"}, "reference_outputs": ["1 2 2\n1 3 4\n5 5 4\n"], "source_document_id": "p02855", "source_text": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1172, "cpu_time_ms": 15, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s983846537", "group_id": "codeNet:p02855", "input_text": "var\n a: array [1..300, 1..300] of boolean;\n b: array [1..300] of boolean;\n ans: array [1..300, 1..300] of longint;\n n, m, k, i, j, cnt, start: longint;\n c: char;\n f: boolean;\nbegin\n readln(n, m, k);\n for i := 1 to n do\n begin\n for j := 1 to m do\n begin\n read(c);\n if c = '#' then\n begin\n a[i, j] := true;\n b[i] := true;\n end;\n end;\n readln;\n end;\n cnt := 0;\n for i := 1 to n do\n if b[i] then\n break;\n start := i;\n for i := i to n do\n if b[i] then\n begin\n inc(cnt);\n f := false;\n for j := 1 to m + 1 do\n begin\n if j = m + 1 then\n begin\n f := false;\n break;\n end;\n if a[i, j] then\n if f then\n break\n else\n f := true;\n ans[i, j] := cnt;\n end;\n if not f then break;\n for j := j to m do\n begin\n if a[i, j] then\n inc(cnt);\n ans[i, j] := cnt;\n end;\n end\n else\n for j := 1 to m do\n ans[i, j] := ans[i - 1, j];\n for i := 1 to start - 1 do\n for j := 1 to m do\n ans[i, j] := ans[start, j];\n for i := 1 to n do\n begin\n for j := 1 to m do\n write(ans[i, j], ' ');\n writeln;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1574565112, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02855.html", "problem_id": "p02855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02855/input.txt", "sample_output_relpath": "derived/input_output/data/p02855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02855/Pascal/s983846537.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s983846537", "user_id": "u214724132"}, "prompt_components": {"gold_output": "1 2 2\n1 3 4\n5 5 4\n", "input_to_evaluate": "var\n a: array [1..300, 1..300] of boolean;\n b: array [1..300] of boolean;\n ans: array [1..300, 1..300] of longint;\n n, m, k, i, j, cnt, start: longint;\n c: char;\n f: boolean;\nbegin\n readln(n, m, k);\n for i := 1 to n do\n begin\n for j := 1 to m do\n begin\n read(c);\n if c = '#' then\n begin\n a[i, j] := true;\n b[i] := true;\n end;\n end;\n readln;\n end;\n cnt := 0;\n for i := 1 to n do\n if b[i] then\n break;\n start := i;\n for i := i to n do\n if b[i] then\n begin\n inc(cnt);\n f := false;\n for j := 1 to m + 1 do\n begin\n if j = m + 1 then\n begin\n f := false;\n break;\n end;\n if a[i, j] then\n if f then\n break\n else\n f := true;\n ans[i, j] := cnt;\n end;\n if not f then break;\n for j := j to m do\n begin\n if a[i, j] then\n inc(cnt);\n ans[i, j] := cnt;\n end;\n end\n else\n for j := 1 to m do\n ans[i, j] := ans[i - 1, j];\n for i := 1 to start - 1 do\n for j := 1 to m do\n ans[i, j] := ans[start, j];\n for i := 1 to n do\n begin\n for j := 1 to m do\n write(ans[i, j], ' ');\n writeln;\n end;\nend.\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "sample_input": "3 3 5\n#.#\n.#.\n#.#\n"}, "reference_outputs": ["1 2 2\n1 3 4\n5 5 4\n"], "source_document_id": "p02855", "source_text": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1247, "cpu_time_ms": 15, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s441023293", "group_id": "codeNet:p02855", "input_text": "var\n a: array [1..300, 1..300] of boolean;\n b: array [1..300] of boolean;\n ans: array [1..300, 1..300] of longint;\n n, m, k, i, j, cnt, start: longint;\n c: char;\n f: boolean;\nbegin\n readln(n, m, k);\n for i := 1 to n do\n begin\n for j := 1 to m do\n begin\n read(c);\n if c = '#' then\n begin\n a[i, j] := true;\n b[i] := true;\n end;\n end;\n readln;\n end;\n cnt := 0;\n for i := 1 to n do\n if b[i] then\n break;\n start := i;\n for i := i to n do\n if b[i] then\n begin\n inc(cnt);\n f := false;\n for j := 1 to m do\n begin\n if a[i, j] then\n if f then\n break\n else\n f := true;\n ans[i, j] := cnt;\n end;\n for j := j to m do\n begin\n if a[i, j] then\n inc(cnt);\n ans[i, j] := cnt;\n end;\n end\n else\n for j := 1 to m do\n ans[i, j] := ans[i - 1, j];\n for i := 1 to start - 1 do\n for j := 1 to m do\n ans[i, j] := ans[start, j];\n for i := 1 to n do\n begin\n for j := 1 to m do\n write(ans[i, j], ' ');\n writeln;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1574564102, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02855.html", "problem_id": "p02855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02855/input.txt", "sample_output_relpath": "derived/input_output/data/p02855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02855/Pascal/s441023293.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s441023293", "user_id": "u214724132"}, "prompt_components": {"gold_output": "1 2 2\n1 3 4\n5 5 4\n", "input_to_evaluate": "var\n a: array [1..300, 1..300] of boolean;\n b: array [1..300] of boolean;\n ans: array [1..300, 1..300] of longint;\n n, m, k, i, j, cnt, start: longint;\n c: char;\n f: boolean;\nbegin\n readln(n, m, k);\n for i := 1 to n do\n begin\n for j := 1 to m do\n begin\n read(c);\n if c = '#' then\n begin\n a[i, j] := true;\n b[i] := true;\n end;\n end;\n readln;\n end;\n cnt := 0;\n for i := 1 to n do\n if b[i] then\n break;\n start := i;\n for i := i to n do\n if b[i] then\n begin\n inc(cnt);\n f := false;\n for j := 1 to m do\n begin\n if a[i, j] then\n if f then\n break\n else\n f := true;\n ans[i, j] := cnt;\n end;\n for j := j to m do\n begin\n if a[i, j] then\n inc(cnt);\n ans[i, j] := cnt;\n end;\n end\n else\n for j := 1 to m do\n ans[i, j] := ans[i - 1, j];\n for i := 1 to start - 1 do\n for j := 1 to m do\n ans[i, j] := ans[start, j];\n for i := 1 to n do\n begin\n for j := 1 to m do\n write(ans[i, j], ' ');\n writeln;\n end;\nend.\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "sample_input": "3 3 5\n#.#\n.#.\n#.#\n"}, "reference_outputs": ["1 2 2\n1 3 4\n5 5 4\n"], "source_document_id": "p02855", "source_text": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1124, "cpu_time_ms": 15, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s832993116", "group_id": "codeNet:p02860", "input_text": "uses crt;\nvar a:string;\ni,n:integer;\nok:boolean;\nbegin\nclrscr;\nread(n);\nread(a);\nok:=true;\nif length(a) mod 2<>0 then write('no') else begin\nfor i:=1 to n div 2 do\nif a[i]<>a[i+n div 2] then begin ok:=false; break; end;\nif ok then write('yes') else write('no');\nend;\nreadln;\nend.", "language": "Pascal", "metadata": {"date": 1577393513, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02860.html", "problem_id": "p02860", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02860/input.txt", "sample_output_relpath": "derived/input_output/data/p02860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02860/Pascal/s832993116.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s832993116", "user_id": "u398406871"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "uses crt;\nvar a:string;\ni,n:integer;\nok:boolean;\nbegin\nclrscr;\nread(n);\nread(a);\nok:=true;\nif length(a) mod 2<>0 then write('no') else begin\nfor i:=1 to n div 2 do\nif a[i]<>a[i+n div 2] then begin ok:=false; break; end;\nif ok then write('yes') else write('no');\nend;\nreadln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "sample_input": "6\nabcabc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02860", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s466721827", "group_id": "codeNet:p02860", "input_text": "uses crt;\nvar s:string;\ni,n:integer;\nbegin\n clrscr;\n readln(n);\n readln(s);\n if n mod 2 <> 0 then writeln('No')\n else begin\n for i:=0 to trunc(n/2)-1 do begin\n if s[i+1]<>s[trunc(n/2)+i+1] then begin\n writeln('No');\n exit;\n end;\n end;\n writeln('Yes');\n exit;\n end;\n readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1577390984, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02860.html", "problem_id": "p02860", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02860/input.txt", "sample_output_relpath": "derived/input_output/data/p02860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02860/Pascal/s466721827.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s466721827", "user_id": "u635762866"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "uses crt;\nvar s:string;\ni,n:integer;\nbegin\n clrscr;\n readln(n);\n readln(s);\n if n mod 2 <> 0 then writeln('No')\n else begin\n for i:=0 to trunc(n/2)-1 do begin\n if s[i+1]<>s[trunc(n/2)+i+1] then begin\n writeln('No');\n exit;\n end;\n end;\n writeln('Yes');\n exit;\n end;\n readln;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "sample_input": "6\nabcabc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02860", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS consists of lowercase English letters.\n\n|S| = N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 496, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s713271458", "group_id": "codeNet:p02861", "input_text": "uses crt;\nvar n : int64;\ns : string;\ni,j : longint;\ncheck : array[0..10] of boolean;\na : array[0..10] of extended;\nb : array[0..10] of extended;\nkq,cnt : extended;\nfunction kc(i,j : integer) : extended;\nbegin\n if (i=0) or (j=0) then exit(0);\n exit(sqrt(sqr(a[i]-a[j]) + sqr(b[i]-b[j])));\nend;\n\nprocedure process(m,k : integer);\nvar j : integer;\nbegin\n if (m=n+1) then begin cnt := cnt + kq; exit; end;\n for j := 1 to n do\n if (check[j]=true) then begin\n kq := kq + kc(j,k);\n check[j]:=false;\n process(m+1,j);\n kq := kq - kc(j,k);\n check[j]:=true;\n end;\nend;\n\nbegin\n clrscr;\n { assign(input,'test.inp');reset(input); }\n readln(n);\n for i := 1 to n do begin readln(a[i],b[i]); check[i]:=true; end;\n { assign(output,'test.out');rewrite(output);\n clrscr; }\n process(1,0);\n kq := 1;\n for j := 1 to n do kq := kq * j;\n write(cnt/kq : 0 : 10);\n readln;\n close(output);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577398901, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02861.html", "problem_id": "p02861", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02861/input.txt", "sample_output_relpath": "derived/input_output/data/p02861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02861/Pascal/s713271458.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s713271458", "user_id": "u684763923"}, "prompt_components": {"gold_output": "2.2761423749\n", "input_to_evaluate": "uses crt;\nvar n : int64;\ns : string;\ni,j : longint;\ncheck : array[0..10] of boolean;\na : array[0..10] of extended;\nb : array[0..10] of extended;\nkq,cnt : extended;\nfunction kc(i,j : integer) : extended;\nbegin\n if (i=0) or (j=0) then exit(0);\n exit(sqrt(sqr(a[i]-a[j]) + sqr(b[i]-b[j])));\nend;\n\nprocedure process(m,k : integer);\nvar j : integer;\nbegin\n if (m=n+1) then begin cnt := cnt + kq; exit; end;\n for j := 1 to n do\n if (check[j]=true) then begin\n kq := kq + kc(j,k);\n check[j]:=false;\n process(m+1,j);\n kq := kq - kc(j,k);\n check[j]:=true;\n end;\nend;\n\nbegin\n clrscr;\n { assign(input,'test.inp');reset(input); }\n readln(n);\n for i := 1 to n do begin readln(a[i],b[i]); check[i]:=true; end;\n { assign(output,'test.out');rewrite(output);\n clrscr; }\n process(1,0);\n kq := 1;\n for j := 1 to n do kq := kq * j;\n write(cnt/kq : 0 : 10);\n readln;\n close(output);\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "sample_input": "3\n0 0\n1 0\n0 1\n"}, "reference_outputs": ["2.2761423749\n"], "source_document_id": "p02861", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1130, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s093873925", "group_id": "codeNet:p02880", "input_text": "var\n n,i,j:byte;\n ok:boolean;\nbegin\n read(n);\n ok:=false;\n for i:=1 to 9 do\n for j:=1 to 9 do if i*j=n then ok:=true;\n if ok=true then write('Yes') else write('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1577459417, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02880.html", "problem_id": "p02880", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02880/input.txt", "sample_output_relpath": "derived/input_output/data/p02880/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02880/Pascal/s093873925.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s093873925", "user_id": "u344153701"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,j:byte;\n ok:boolean;\nbegin\n read(n);\n ok:=false;\n for i:=1 to 9 do\n for j:=1 to 9 do if i*j=n then ok:=true;\n if ok=true then write('Yes') else write('No');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "sample_input": "10\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02880", "source_text": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s782212601", "group_id": "codeNet:p02880", "input_text": " var i,n:byte;\n begin\n \treadln(n);\n for i:=1 to 9 do begin\n \tif (n mod i = 0) and (n div i <= 9) then begin\n \twriteln('Yes');\n exit();\n end;\n end;\n writeln('No');\n exit();\n end.", "language": "Pascal", "metadata": {"date": 1577458446, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02880.html", "problem_id": "p02880", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02880/input.txt", "sample_output_relpath": "derived/input_output/data/p02880/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02880/Pascal/s782212601.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s782212601", "user_id": "u635762866"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": " var i,n:byte;\n begin\n \treadln(n);\n for i:=1 to 9 do begin\n \tif (n mod i = 0) and (n div i <= 9) then begin\n \twriteln('Yes');\n exit();\n end;\n end;\n writeln('No');\n exit();\n end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "sample_input": "10\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02880", "source_text": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 261, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s817375532", "group_id": "codeNet:p02881", "input_text": "var\n i:longint;\n n:qword;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then begin write(i+n div i-2); break; end;\nend.\n", "language": "Pascal", "metadata": {"date": 1577466158, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Pascal/s817375532.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s817375532", "user_id": "u344153701"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n i:longint;\n n:qword;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then begin write(i+n div i-2); break; end;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 174, "cpu_time_ms": 11, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s389319533", "group_id": "codeNet:p02881", "input_text": "uses crt;\nvar n,a,j:qword;\ni:longword;\nbegin\n clrscr;\n readln(n);\n for i:=1 to round(sqrt(n)) do\n begin\n if n mod i=0 then begin j:=n div i;a:=j+i-2;end;\n end;\n write(a);\n readln\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1577465894, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Pascal/s389319533.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s389319533", "user_id": "u684763923"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "uses crt;\nvar n,a,j:qword;\ni:longword;\nbegin\n clrscr;\n readln(n);\n for i:=1 to round(sqrt(n)) do\n begin\n if n mod i=0 then begin j:=n div i;a:=j+i-2;end;\n end;\n write(a);\n readln\nend.\n\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s740937272", "group_id": "codeNet:p02881", "input_text": "var n,tmp:qword;\ni:longint;\nbegin\n readln(n);\n tmp:=n div trunc(sqrt(n));\n for i:=tmp downto 1 do if n mod i = 0 then break;\n writeln(i + n div i - 2); \nend.", "language": "Pascal", "metadata": {"date": 1577462528, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Pascal/s740937272.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s740937272", "user_id": "u635762866"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var n,tmp:qword;\ni:longint;\nbegin\n readln(n);\n tmp:=n div trunc(sqrt(n));\n for i:=tmp downto 1 do if n mod i = 0 then break;\n writeln(i + n div i - 2); \nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 185, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s101778544", "group_id": "codeNet:p02881", "input_text": "var\n\ti,N,q,r,ans: integer;\n \n \nbegin\n\treadln(N);\n ans := 1;\n i := N div 2;\n\n while ans = 1 do\n begin\n q := N div i;\n r := N mod i;\n if r = 0 then\n ans -= 1\n else\n i -= 1;\n end;\n\n writeln(q+i-2);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1572983346, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Pascal/s101778544.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s101778544", "user_id": "u305562584"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n\ti,N,q,r,ans: integer;\n \n \nbegin\n\treadln(N);\n ans := 1;\n i := N div 2;\n\n while ans = 1 do\n begin\n q := N div i;\n r := N mod i;\n if r = 0 then\n ans -= 1\n else\n i -= 1;\n end;\n\n writeln(q+i-2);\n\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s907269134", "group_id": "codeNet:p02888", "input_text": "var i,j,k,l,o,p,count,n,cautpetrea:longint;\ntype vector = array[1..2010] of longint;\nvar x:vector;\nfunction check(a,b:longint):boolean;\nbegin\nif ac) and (a+c>b) and (c+b>a) then begin\n // writeln(a,' ',b,' ',c);\n triunghi:=true;\n end\nelse begin\n //writeln(a,' ',b,' ',c);\n triunghi:=false;\n end;\nend;\nprocedure swap(var a,b:integer);\nvar temp:integer;\nbegin\ntemp:=a;\na:=b;\nb:=temp;\nend;\nprocedure bubleSort(var a:vector;n:longint);\nvar i,j:longint;\nisSwapped:boolean;\nbegin\nfor i:=1 to n do begin\n isSwapped:=false;\n for j:=1 to n-i do \n if a[j]> a[j+1] then begin\n swap(a[j],a[j+1]);\n isSwapped:=true;\n end;\n if not isSwapped then break;\n end;\n \n\nend;\nbegin\nread(n);\nfor i:=1 to n do \n read(x[i]);\nbublesort(x,n);\nfor i:=1 to n do\n for j:=i+1 to n do begin\n cautpetrea:=+cautbin(j,n,x[i]+x[j]);\n if cautpetrea>j then count:=count+(cautpetrea-j);\n end;\nwriteln(count);\nend.", "language": "Pascal", "metadata": {"date": 1572147115, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02888.html", "problem_id": "p02888", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02888/input.txt", "sample_output_relpath": "derived/input_output/data/p02888/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02888/Pascal/s907269134.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s907269134", "user_id": "u448096745"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var i,j,k,l,o,p,count,n,cautpetrea:longint;\ntype vector = array[1..2010] of longint;\nvar x:vector;\nfunction check(a,b:longint):boolean;\nbegin\nif ac) and (a+c>b) and (c+b>a) then begin\n // writeln(a,' ',b,' ',c);\n triunghi:=true;\n end\nelse begin\n //writeln(a,' ',b,' ',c);\n triunghi:=false;\n end;\nend;\nprocedure swap(var a,b:integer);\nvar temp:integer;\nbegin\ntemp:=a;\na:=b;\nb:=temp;\nend;\nprocedure bubleSort(var a:vector;n:longint);\nvar i,j:longint;\nisSwapped:boolean;\nbegin\nfor i:=1 to n do begin\n isSwapped:=false;\n for j:=1 to n-i do \n if a[j]> a[j+1] then begin\n swap(a[j],a[j+1]);\n isSwapped:=true;\n end;\n if not isSwapped then break;\n end;\n \n\nend;\nbegin\nread(n);\nfor i:=1 to n do \n read(x[i]);\nbublesort(x,n);\nfor i:=1 to n do\n for j:=i+1 to n do begin\n cautpetrea:=+cautbin(j,n,x[i]+x[j]);\n if cautpetrea>j then count:=count+(cautpetrea-j);\n end;\nwriteln(count);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "sample_input": "4\n3 4 2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02888", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1524, "cpu_time_ms": 104, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s362729563", "group_id": "codeNet:p02888", "input_text": "var i,j,k,l,o,p,count,n:longint;\nx:array[1..100000] of longint;\nfunction triunghi(a,b,c:longint):boolean;\nbegin\nif (a+b>c) and (a+c>b) and (c+b>a) then begin\n // writeln(a,' ',b,' ',c);\n triunghi:=true;\n end\nelse begin\n //writeln(a,' ',b,' ',c);\n triunghi:=false;\n end;\n\nend;\nbegin\nread(n);\nfor i:=1 to n do \n read(x[i]);\nfor i:=1 to n do\n for j:=i+1 to n do \n for k:=j+1 to n do \n if triunghi(x[i],x[j],x[k])then inc(count);\nwriteln(count);\nend.", "language": "Pascal", "metadata": {"date": 1572079191, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02888.html", "problem_id": "p02888", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02888/input.txt", "sample_output_relpath": "derived/input_output/data/p02888/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02888/Pascal/s362729563.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s362729563", "user_id": "u448096745"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var i,j,k,l,o,p,count,n:longint;\nx:array[1..100000] of longint;\nfunction triunghi(a,b,c:longint):boolean;\nbegin\nif (a+b>c) and (a+c>b) and (c+b>a) then begin\n // writeln(a,' ',b,' ',c);\n triunghi:=true;\n end\nelse begin\n //writeln(a,' ',b,' ',c);\n triunghi:=false;\n end;\n\nend;\nbegin\nread(n);\nfor i:=1 to n do \n read(x[i]);\nfor i:=1 to n do\n for j:=i+1 to n do \n for k:=j+1 to n do \n if triunghi(x[i],x[j],x[k])then inc(count);\nwriteln(count);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "sample_input": "4\n3 4 2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02888", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s648026581", "group_id": "codeNet:p02898", "input_text": "var N,K,i,c,A:Longint;\nbegin\nread(N,K);\nfor i:=1 to N do begin\nread(A);\nif A>=K then inc(c);\nend;\nwriteln(c);\nend.", "language": "Pascal", "metadata": {"date": 1574761513, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02898.html", "problem_id": "p02898", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02898/input.txt", "sample_output_relpath": "derived/input_output/data/p02898/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02898/Pascal/s648026581.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s648026581", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var N,K,i,c,A:Longint;\nbegin\nread(N,K);\nfor i:=1 to N do begin\nread(A);\nif A>=K then inc(c);\nend;\nwriteln(c);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "sample_input": "4 150\n150 140 100 200\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02898", "source_text": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 9, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s127570347", "group_id": "codeNet:p02899", "input_text": "var N,i,A:Longint;B:Array[1..100000]of Longint;\nbegin\nread(N);\nfor i:=1 to N do begin read(A);B[A]:=i;end;\nfor i:=1 to N do writeln(B[i]);\nend.", "language": "Pascal", "metadata": {"date": 1582030662, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Pascal/s127570347.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s127570347", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "var N,i,A:Longint;B:Array[1..100000]of Longint;\nbegin\nread(N);\nfor i:=1 to N do begin read(A);B[A]:=i;end;\nfor i:=1 to N do writeln(B[i]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 25, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s039400480", "group_id": "codeNet:p02899", "input_text": "VAR\n n, i, j : longint ;\n a, b : array [0..100000] of longint ;\nprocedure swap(var x,y : longint) ;\n var t : longint ;\n begin\n t := x ;\n x := y ;\n y :=t ;\n end ;\nBEGIN\n readln(n) ;\n for i := 1 to n do\n begin\n read(a[i]) ;\n b[i] := i ;\n end ;\n for i := 1 to n - 1 do\n for j := i + 1 to n do\n if a[i] > a[j] then\n begin\n swap(a[i],a[j]) ;\n swap(b[i],b[j]) ;\n end ;\n for i := 1 to n do write(b[i],#32) ;\n writeln ;\nEND.", "language": "Pascal", "metadata": {"date": 1569722696, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Pascal/s039400480.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s039400480", "user_id": "u731409129"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "VAR\n n, i, j : longint ;\n a, b : array [0..100000] of longint ;\nprocedure swap(var x,y : longint) ;\n var t : longint ;\n begin\n t := x ;\n x := y ;\n y :=t ;\n end ;\nBEGIN\n readln(n) ;\n for i := 1 to n do\n begin\n read(a[i]) ;\n b[i] := i ;\n end ;\n for i := 1 to n - 1 do\n for j := i + 1 to n do\n if a[i] > a[j] then\n begin\n swap(a[i],a[j]) ;\n swap(b[i],b[j]) ;\n end ;\n for i := 1 to n do write(b[i],#32) ;\n writeln ;\nEND.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 480, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s086159787", "group_id": "codeNet:p02902", "input_text": "var\n\tN,M,i,u,v,id:Longint;\n\tGv,Gp:Array[1..2000]of Longint;\n\tGi:Array[1..1000]of Longint;\n\tcnt:Array[1..1000]of Longint;\n\tQ:Array[1..1000]of Longint;\n\tQs:Longint;\nbegin\n\tread(N,M);\n\tif (N=1000)and(M>1000) then begin writeln(0);exit;end;\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tGv[i]:=v;\n\t\tif Gi[u]>0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs1000) then begin writeln(0);exit;end;\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tGv[i]:=v;\n\t\tif Gi[u]>0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;Qs:=0;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile (id<=Qs)and(Qs0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;Qs:=0;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile (id<=Qs)and(Qs0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;Qs:=0;\n\twhile (id<=Qs)and(Qs0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;Qs:=0;\n\twhile (id<=Qs)and(Qs0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif QsB)<>(j>A)then s:=s+'0' else s:=s+'1';\n\t\tend;\n\t\twriteln(s);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1569120822, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02903.html", "problem_id": "p02903", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02903/input.txt", "sample_output_relpath": "derived/input_output/data/p02903/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02903/Pascal/s846489449.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s846489449", "user_id": "u657913472"}, "prompt_components": {"gold_output": "100\n010\n001\n", "input_to_evaluate": "var\n\tH,W,A,B,i,j:Longint;\n\ts:String;\nbegin\n\tread(H,W,A,B);\n\tfor i:=1 to H do begin\n\t\ts:='';\n\t\tfor j:=1 to W do begin\n\t\t\tif (i>B)<>(j>A)then s:=s+'0' else s:=s+'1';\n\t\tend;\n\t\twriteln(s);\n\tend;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a square grid with H rows and W columns.\nSnuke wants to write 0 or 1 in each of the squares.\nHere, all of the following conditions have to be satisfied:\n\nFor every row, the smaller of the following is A: the number of 0s contained in the row, and the number of 1s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)\n\nFor every column, the smaller of the following is B: the number of 0s contained in the column, and the number of 1s contained in the column.\n\nDetermine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\n0 \\leq A\n\n2 \\times A \\leq W\n\n0 \\leq B\n\n2 \\times B \\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nIf the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1.\n\nIf the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:\n\ns_{11}s_{12}\\cdots s_{1W}\ns_{21}s_{22}\\cdots s_{2W}\n\\vdots\ns_{H1}s_{H2}\\cdots s_{HW}\n\nHere s_{ij} is the digit written in the square at the i-th row from the top and the j-th column from the left in the grid.\n\nIf multiple solutions exist, printing any of them will be accepted.\n\nSample Input 1\n\n3 3 1 1\n\nSample Output 1\n\n100\n010\n001\n\nEvery row contains two 0s and one 1, so the first condition is satisfied.\nAlso, every column contains two 0s and one 1, so the second condition is satisfied.\n\nSample Input 2\n\n1 5 2 0\n\nSample Output 2\n\n01010", "sample_input": "3 3 1 1\n"}, "reference_outputs": ["100\n010\n001\n"], "source_document_id": "p02903", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a square grid with H rows and W columns.\nSnuke wants to write 0 or 1 in each of the squares.\nHere, all of the following conditions have to be satisfied:\n\nFor every row, the smaller of the following is A: the number of 0s contained in the row, and the number of 1s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)\n\nFor every column, the smaller of the following is B: the number of 0s contained in the column, and the number of 1s contained in the column.\n\nDetermine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\n0 \\leq A\n\n2 \\times A \\leq W\n\n0 \\leq B\n\n2 \\times B \\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nIf the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1.\n\nIf the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:\n\ns_{11}s_{12}\\cdots s_{1W}\ns_{21}s_{22}\\cdots s_{2W}\n\\vdots\ns_{H1}s_{H2}\\cdots s_{HW}\n\nHere s_{ij} is the digit written in the square at the i-th row from the top and the j-th column from the left in the grid.\n\nIf multiple solutions exist, printing any of them will be accepted.\n\nSample Input 1\n\n3 3 1 1\n\nSample Output 1\n\n100\n010\n001\n\nEvery row contains two 0s and one 1, so the first condition is satisfied.\nAlso, every column contains two 0s and one 1, so the second condition is satisfied.\n\nSample Input 2\n\n1 5 2 0\n\nSample Output 2\n\n01010", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 35, "memory_kb": 1260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s821590311", "group_id": "codeNet:p02922", "input_text": " var a, b: longint;\n\n begin\n assign(input, 'powersocket.inp'); reset(input);\n assign(output, 'powersocket.out'); rewrite(output);\n\n read(a, b);\n write(b div a + ord(b mod a > 0));\n end.\n", "language": "Pascal", "metadata": {"date": 1595451456, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02922.html", "problem_id": "p02922", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02922/input.txt", "sample_output_relpath": "derived/input_output/data/p02922/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02922/Pascal/s821590311.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s821590311", "user_id": "u685831175"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": " var a, b: longint;\n\n begin\n assign(input, 'powersocket.inp'); reset(input);\n assign(output, 'powersocket.out'); rewrite(output);\n\n read(a, b);\n write(b div a + ord(b mod a > 0));\n end.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "sample_input": "4 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02922", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 1, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s196821217", "group_id": "codeNet:p02923", "input_text": "uses math;\nvar a,b,c,d,e:longint;\nbegin\n read(a,b);\n for a:=2 to a do\n begin\n read(c);\n if c>b then\n begin\n e:=max(e,d);\n d:=0;\n end\n else\n inc(d);\n b:=c;\n end;\n writeln(max(e,d));\nend.", "language": "Pascal", "metadata": {"date": 1582361940, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s196821217.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s196821217", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar a,b,c,d,e:longint;\nbegin\n read(a,b);\n for a:=2 to a do\n begin\n read(c);\n if c>b then\n begin\n e:=max(e,d);\n d:=0;\n end\n else\n inc(d);\n b:=c;\n end;\n writeln(max(e,d));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 223, "cpu_time_ms": 17, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s208720259", "group_id": "codeNet:p02923", "input_text": "var N,i,ans,cnt,pre:Longint;\nH:Array[1..100000]of Longint;\nbegin\nread(N);\nfor i:=1 to N do read(H[i]);\ni:=1;\nwhile i<=N do begin\npre:=i;\ninc(i);\nwhile(i<=N)and(H[i]<=H[i-1])do inc(i);\nif ans=next then inc(count)\nelse \nbegin \n if max <= count then max:=count;\n count:=0;\nend;\nh:=next\nend;\nif count >= max then max:=count;\nwrite(max)\nend.", "language": "Pascal", "metadata": {"date": 1567365702, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s626429730.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s626429730", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,h,next,i,count,max:int64;\nbegin\nread(n);\nread(h);\nmax:=0;\nfor i := 1 to n-1 do\nbegin\nread(next);\nif h>=next then inc(count)\nelse \nbegin \n if max <= count then max:=count;\n count:=0;\nend;\nh:=next\nend;\nif count >= max then max:=count;\nwrite(max)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 16, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s491872907", "group_id": "codeNet:p02923", "input_text": "var n,h,next,i,count,max:int64;\nbegin\nread(n);\nread(h);\nmax:=0;\nfor i := 1 to n-1 do\nbegin\nread(next);\nif h>=next then inc(count)\nelse \nbegin \n if max<= count then max:=count;\n count:=0;\nend;\nh:=next\nend;\nwrite(count)\nend.", "language": "Pascal", "metadata": {"date": 1567365471, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s491872907.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s491872907", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,h,next,i,count,max:int64;\nbegin\nread(n);\nread(h);\nmax:=0;\nfor i := 1 to n-1 do\nbegin\nread(next);\nif h>=next then inc(count)\nelse \nbegin \n if max<= count then max:=count;\n count:=0;\nend;\nh:=next\nend;\nwrite(count)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 17, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s039109011", "group_id": "codeNet:p02927", "input_text": "var m,d,i,j,ans,one,ten:integer;\nbegin\n readln(m,d);\n ans:=0;\n for i:=1 to m do\n begin\n for j:=1 to d do\n begin\n one:=j mod 10;\n ten:=j mod 10;\n if m=one*ten then inc(ans);\n end;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1566699236, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02927.html", "problem_id": "p02927", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02927/input.txt", "sample_output_relpath": "derived/input_output/data/p02927/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02927/Pascal/s039109011.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s039109011", "user_id": "u805277811"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var m,d,i,j,ans,one,ten:integer;\nbegin\n readln(m,d);\n ans:=0;\n for i:=1 to m do\n begin\n for j:=1 to d do\n begin\n one:=j mod 10;\n ten:=j mod 10;\n if m=one*ten then inc(ans);\n end;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nToday is August 24, one of the five Product Days in a year.\n\nA date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):\n\nd_1 \\geq 2\n\nd_{10} \\geq 2\n\nd_1 \\times d_{10} = m\n\nTakahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.\n\nIn Takahashi Calendar, how many Product Days does a year have?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq M \\leq 100\n\n1 \\leq D \\leq 99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM D\n\nOutput\n\nPrint the number of Product Days in a year in Takahashi Calender.\n\nSample Input 1\n\n15 40\n\nSample Output 1\n\n10\n\nThere are 10 Product Days in a year, as follows (m-d denotes Month m, Day d):\n\n4-22\n\n6-23\n\n6-32\n\n8-24\n\n9-33\n\n10-25\n\n12-26\n\n12-34\n\n14-27\n\n15-35\n\nSample Input 2\n\n12 31\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "15 40\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02927", "source_text": "Score : 200 points\n\nProblem Statement\n\nToday is August 24, one of the five Product Days in a year.\n\nA date m-d (m is the month, d is the date) is called a Product Day when d is a two-digit number, and all of the following conditions are satisfied (here d_{10} is the tens digit of the day and d_1 is the ones digit of the day):\n\nd_1 \\geq 2\n\nd_{10} \\geq 2\n\nd_1 \\times d_{10} = m\n\nTakahashi wants more Product Days, and he made a new calendar called Takahashi Calendar where a year consists of M month from Month 1 to Month M, and each month consists of D days from Day 1 to Day D.\n\nIn Takahashi Calendar, how many Product Days does a year have?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq M \\leq 100\n\n1 \\leq D \\leq 99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM D\n\nOutput\n\nPrint the number of Product Days in a year in Takahashi Calender.\n\nSample Input 1\n\n15 40\n\nSample Output 1\n\n10\n\nThere are 10 Product Days in a year, as follows (m-d denotes Month m, Day d):\n\n4-22\n\n6-23\n\n6-32\n\n8-24\n\n9-33\n\n10-25\n\n12-26\n\n12-34\n\n14-27\n\n15-35\n\nSample Input 2\n\n12 31\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 234, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s201720823", "group_id": "codeNet:p02938", "input_text": "var\n\tM,L,R,ans,ll,rr:int64;\n k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;\n dp:array[1..64,1..2,1..2]of int64;\nbegin\n\tread(L,R);\n M:=1000000007;\n ll:=1;\n rr:=2;\n for k:=1 to 60 do begin\n \tif(rr<=L)or(R>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yynow then begin\n\t\t\tpre:=now;\n\t\t\tnow:='';\n\t\t\tinc(cnt);\n\t\tend;\n\tend;\n\twriteln(cnt);\nend.\n", "language": "Pascal", "metadata": {"date": 1579688151, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02939.html", "problem_id": "p02939", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02939/input.txt", "sample_output_relpath": "derived/input_output/data/p02939/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02939/Pascal/s181351353.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s181351353", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\ti,cnt:Longint;\n\ts,pre,now:String;\nbegin\n\treadln(s);\n\tfor i:=1 to length(s)do begin\n\t\tnow:=now+s[i];\n\t\tif pre<>now then begin\n\t\t\tpre:=now;\n\t\t\tnow:='';\n\t\t\tinc(cnt);\n\t\tend;\n\tend;\n\twriteln(cnt);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\nThere exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \\neq S_{i+1} (1 \\leq i \\leq K-1).\n\nHere S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum positive integer K that satisfies the condition.\n\nSample Input 1\n\naabbaa\n\nSample Output 1\n\n4\n\nWe can, for example, divide S into four strings aa, b, ba, and a.\n\nSample Input 2\n\naaaccacabaababc\n\nSample Output 2\n\n12", "sample_input": "aabbaa\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02939", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\nThere exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \\neq S_{i+1} (1 \\leq i \\leq K-1).\n\nHere S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum positive integer K that satisfies the condition.\n\nSample Input 1\n\naabbaa\n\nSample Output 1\n\n4\n\nWe can, for example, divide S into four strings aa, b, ba, and a.\n\nSample Input 2\n\naaaccacabaababc\n\nSample Output 2\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 14, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s292109775", "group_id": "codeNet:p02939", "input_text": "const nmax=200010;\nvar S:array[1..nmax] of char;\n save,c:char;\n count,i,len:int64;\n flag:boolean;\nbegin\nread(c);\ni:=1;\nrepeat \ns[i]:=c;\ninc(i);\nread(c);\nuntil ord(c) in [26,32,10];\nlen:=i-1;\n\nflag:=false;\nsave:=s[1];\ncount:=1;\ni:=1;\nwhile i<=len do\nbegin\nc:=s[i];\nif flag then flag:=false \nelse \n if save=c then\n if i=len then break\n else\n begin inc(i);\n flag:=true end;\n inc(count); \n save:=c;\n inc(i)\nend;\n\nwrite(count-1)\nend.", "language": "Pascal", "metadata": {"date": 1566098977, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02939.html", "problem_id": "p02939", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02939/input.txt", "sample_output_relpath": "derived/input_output/data/p02939/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02939/Pascal/s292109775.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s292109775", "user_id": "u655683235"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const nmax=200010;\nvar S:array[1..nmax] of char;\n save,c:char;\n count,i,len:int64;\n flag:boolean;\nbegin\nread(c);\ni:=1;\nrepeat \ns[i]:=c;\ninc(i);\nread(c);\nuntil ord(c) in [26,32,10];\nlen:=i-1;\n\nflag:=false;\nsave:=s[1];\ncount:=1;\ni:=1;\nwhile i<=len do\nbegin\nc:=s[i];\nif flag then flag:=false \nelse \n if save=c then\n if i=len then break\n else\n begin inc(i);\n flag:=true end;\n inc(count); \n save:=c;\n inc(i)\nend;\n\nwrite(count-1)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\nThere exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \\neq S_{i+1} (1 \\leq i \\leq K-1).\n\nHere S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum positive integer K that satisfies the condition.\n\nSample Input 1\n\naabbaa\n\nSample Output 1\n\n4\n\nWe can, for example, divide S into four strings aa, b, ba, and a.\n\nSample Input 2\n\naaaccacabaababc\n\nSample Output 2\n\n12", "sample_input": "aabbaa\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02939", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\nThere exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \\neq S_{i+1} (1 \\leq i \\leq K-1).\n\nHere S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum positive integer K that satisfies the condition.\n\nSample Input 1\n\naabbaa\n\nSample Output 1\n\n4\n\nWe can, for example, divide S into four strings aa, b, ba, and a.\n\nSample Input 2\n\naaaccacabaababc\n\nSample Output 2\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 457, "cpu_time_ms": 5, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s123761341", "group_id": "codeNet:p02946", "input_text": "var k,x,i:longint;\nbegin\n read(k,x);\n for i:=-1000000 to 1000000 do\n if abs(i-x) Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1565587111, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Pascal/s865431753.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s865431753", "user_id": "u492212770"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "type\n pair = record\n a : longint;\n b : longint;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar i,j,n,m:longint;\n ans:int64;\n input:pairArray;\n heap:array[0..100000] of longint;\n\nprocedure swap(var X, Y: longint);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1808, "cpu_time_ms": 39, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s788491297", "group_id": "codeNet:p02948", "input_text": "type\n pair = record\n a : longint;\n b : longint;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:longint;\n input:pairArray;\n heap:array[0..100000] of longint;\n\nprocedure swap(var X, Y: longint);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1565582233, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Pascal/s788491297.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s788491297", "user_id": "u492212770"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "type\n pair = record\n a : longint;\n b : longint;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:longint;\n input:pairArray;\n heap:array[0..100000] of longint;\n\nprocedure swap(var X, Y: longint);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1797, "cpu_time_ms": 39, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s916185583", "group_id": "codeNet:p02948", "input_text": "type\n pair = record\n a : int64;\n b : integer;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:integer;\n input:pairArray;\n heap:array[0..100000] of integer;\n\nprocedure swap(var X, Y: integer);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:integer;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and ((heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1565538085, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Pascal/s916185583.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s916185583", "user_id": "u492212770"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "type\n pair = record\n a : int64;\n b : integer;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:integer;\n input:pairArray;\n heap:array[0..100000] of integer;\n\nprocedure swap(var X, Y: integer);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:integer;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and ((heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1762, "cpu_time_ms": 40, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s543022663", "group_id": "codeNet:p02952", "input_text": "var\n\tn,i,sum:integer;\n \nbegin\n\tsum := 0;\n\tread(n);\n \n for i := 1 to n do begin\n \t\n begin\n \tif i <= 9 then\n \t Inc(sum);\n end;\n \n begin\n \tif (i >= 100) and (i <= 999) then\n \tInc(sum);\n end;\n \n begin\n \tif (i >= 10000) and (i <= 99999) then\n \tInc(sum);\n end;\n \n end;\n \n writeln(sum);\n\nend.", "language": "Pascal", "metadata": {"date": 1582000614, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Pascal/s543022663.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s543022663", "user_id": "u663819790"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n\tn,i,sum:integer;\n \nbegin\n\tsum := 0;\n\tread(n);\n \n for i := 1 to n do begin\n \t\n begin\n \tif i <= 9 then\n \t Inc(sum);\n end;\n \n begin\n \tif (i >= 100) and (i <= 999) then\n \tInc(sum);\n end;\n \n begin\n \tif (i >= 10000) and (i <= 99999) then\n \tInc(sum);\n end;\n \n end;\n \n writeln(sum);\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 423, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s345905930", "group_id": "codeNet:p02952", "input_text": "var\n\tn,i,sum:integer;\n \nbegin\n\tsum := 0;\n\tread(n);\n \n for i := 1 to n do begin\n \t\n begin\n \tif i <= 9 then\n \t Inc(sum);\n end;\n \n begin\n \tif (i >= 100) and (i <= 999) then\n \tInc(sum);\n end;\n \n begin\n \tif (i >= 100000) and (i <= 99999) then\n \tInc(sum);\n end;\n \n end;\n \n writeln(sum);\n\nend.", "language": "Pascal", "metadata": {"date": 1582000368, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Pascal/s345905930.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s345905930", "user_id": "u663819790"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n\tn,i,sum:integer;\n \nbegin\n\tsum := 0;\n\tread(n);\n \n for i := 1 to n do begin\n \t\n begin\n \tif i <= 9 then\n \t Inc(sum);\n end;\n \n begin\n \tif (i >= 100) and (i <= 999) then\n \tInc(sum);\n end;\n \n begin\n \tif (i >= 100000) and (i <= 99999) then\n \tInc(sum);\n end;\n \n end;\n \n writeln(sum);\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 424, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s023961176", "group_id": "codeNet:p02963", "input_text": "const side=1000000000;\n sq=1000000000000000000;\nvar s,i,j,x,y:int64;\n ans:array[1..3,1..2] of int64;\nbegin\nread(s);\nfor i :=1 to 3 do\n for j :=1 to 2 do ans[i,j]:=0;\nif s<=side then begin\nans[2,1]:=1;ans[3,2]:=s end\nelse \nfor i := 1 to side div 2 do\nbegin\n x:=s-i*i;\n y:=trunc(sqrt(x));\n if y*y=x then begin\n ans[2,1]:=x;ans[2,2]:=y;\n ans[3,1]:=x-y;ans[3,2]:=x+y;\n break;\n end;\n \nend;\nfor i := 1 to 3 do \n for j := 1 to 2 do write(ans[i,j],' ');\nend.", "language": "Pascal", "metadata": {"date": 1563762460, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02963.html", "problem_id": "p02963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02963/input.txt", "sample_output_relpath": "derived/input_output/data/p02963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02963/Pascal/s023961176.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s023961176", "user_id": "u655683235"}, "prompt_components": {"gold_output": "1 0 2 2 0 1\n", "input_to_evaluate": "const side=1000000000;\n sq=1000000000000000000;\nvar s,i,j,x,y:int64;\n ans:array[1..3,1..2] of int64;\nbegin\nread(s);\nfor i :=1 to 3 do\n for j :=1 to 2 do ans[i,j]:=0;\nif s<=side then begin\nans[2,1]:=1;ans[3,2]:=s end\nelse \nfor i := 1 to side div 2 do\nbegin\n x:=s-i*i;\n y:=trunc(sqrt(x));\n if y*y=x then begin\n ans[2,1]:=x;ans[2,2]:=y;\n ans[3,1]:=x-y;ans[3,2]:=x+y;\n break;\n end;\n \nend;\nfor i := 1 to 3 do \n for j := 1 to 2 do write(ans[i,j],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "sample_input": "3\n"}, "reference_outputs": ["1 0 2 2 0 1\n"], "source_document_id": "p02963", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 458, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s824155533", "group_id": "codeNet:p02971", "input_text": "var\n\tN,i:Longint;\n\tA,L,R:Array[1..200000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tfor i:=2 to N do begin\n\t\tL[i]:=L[i-1];\n\t\tif A[i-1]>L[i] then L[i]:=A[i-1];\n\tend;\n\tfor i:=N-1 downto 1 do begin\n\t\tR[i]:=R[i+1];\n\t\tif A[i+1]>R[i] then R[i]:=A[i+1];\n\tend;\n\tfor i:=1 to N do if L[i]>R[i] then writeln(L[i]) else writeln(R[i]);\nend.\n", "language": "Pascal", "metadata": {"date": 1582030172, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02971.html", "problem_id": "p02971", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02971/input.txt", "sample_output_relpath": "derived/input_output/data/p02971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02971/Pascal/s824155533.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824155533", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n3\n4\n", "input_to_evaluate": "var\n\tN,i:Longint;\n\tA,L,R:Array[1..200000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tfor i:=2 to N do begin\n\t\tL[i]:=L[i-1];\n\t\tif A[i-1]>L[i] then L[i]:=A[i-1];\n\tend;\n\tfor i:=N-1 downto 1 do begin\n\t\tR[i]:=R[i+1];\n\t\tif A[i+1]>R[i] then R[i]:=A[i+1];\n\tend;\n\tfor i:=1 to N do if L[i]>R[i] then writeln(L[i]) else writeln(R[i]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "sample_input": "3\n1\n4\n3\n"}, "reference_outputs": ["4\n3\n4\n"], "source_document_id": "p02971", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 60, "memory_kb": 3840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s540153721", "group_id": "codeNet:p02971", "input_text": "program ABC134C;\nvar\n\tn, i, m0, m1, x: integer;\n\tA: array[0..200000] of integer;\nbegin\n\tread(n);\n\tm0 := 0;\n\tm1 := 0;\n\tfor i := 1 to n do begin\n\t\tread(x);\n\t\tif x > m0 then begin\n\t\t\tm1 := m0;\n\t\t\tm0 := x;\n\t\tend\n\t\telse if x > m1 then begin\n\t\t\tm1 := x;\n\t\tend;\n\t\tA[i] := x;\n\tend;\n\tfor i := 1 to n do begin\n\t\tif A[i] = m0 then begin\n\t\t\twriteln(m1);\n\t\tend\n\t\telse begin\n\t\t\twriteln(m0);\n\t\tend;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1564358091, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02971.html", "problem_id": "p02971", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02971/input.txt", "sample_output_relpath": "derived/input_output/data/p02971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02971/Pascal/s540153721.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s540153721", "user_id": "u019489252"}, "prompt_components": {"gold_output": "4\n3\n4\n", "input_to_evaluate": "program ABC134C;\nvar\n\tn, i, m0, m1, x: integer;\n\tA: array[0..200000] of integer;\nbegin\n\tread(n);\n\tm0 := 0;\n\tm1 := 0;\n\tfor i := 1 to n do begin\n\t\tread(x);\n\t\tif x > m0 then begin\n\t\t\tm1 := m0;\n\t\t\tm0 := x;\n\t\tend\n\t\telse if x > m1 then begin\n\t\t\tm1 := x;\n\t\tend;\n\t\tA[i] := x;\n\tend;\n\tfor i := 1 to n do begin\n\t\tif A[i] = m0 then begin\n\t\t\twriteln(m1);\n\t\tend\n\t\telse begin\n\t\t\twriteln(m0);\n\t\tend;\n\tend;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "sample_input": "3\n1\n4\n3\n"}, "reference_outputs": ["4\n3\n4\n"], "source_document_id": "p02971", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 395, "cpu_time_ms": 56, "memory_kb": 2176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s101190930", "group_id": "codeNet:p02972", "input_text": "var a, ck: array[1..200001] of longint;\n i, j, n, x, ans: longint;\nbegin\n read(n);\n for i := 1 to n do read(a[i]);\n for i := n downto 1 do \n begin\n x := 0;\n j := 2 * i;\n while j <= n do\n begin\n x := x + ck[j];\n j := j + i;\n end;\n if x mod 2 <> a[i] then ck[i] := 1;\n end;\n for i := 1 to n do if ck[i] = 1 then ans := ans + 1;\n writeln(ans);\n for i := 1 to n do if ck[i] = 1 then write(i, ' ');\nend.", "language": "Pascal", "metadata": {"date": 1567481146, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02972.html", "problem_id": "p02972", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02972/input.txt", "sample_output_relpath": "derived/input_output/data/p02972/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02972/Pascal/s101190930.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s101190930", "user_id": "u073463809"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "var a, ck: array[1..200001] of longint;\n i, j, n, x, ans: longint;\nbegin\n read(n);\n for i := 1 to n do read(a[i]);\n for i := n downto 1 do \n begin\n x := 0;\n j := 2 * i;\n while j <= n do\n begin\n x := x + ck[j];\n j := j + i;\n end;\n if x mod 2 <> a[i] then ck[i] := 1;\n end;\n for i := 1 to n do if ck[i] = 1 then ans := ans + 1;\n writeln(ans);\n for i := 1 to n do if ck[i] = 1 then write(i, ' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "sample_input": "3\n1 0 0\n"}, "reference_outputs": ["1\n1\n"], "source_document_id": "p02972", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 489, "cpu_time_ms": 39, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s964892979", "group_id": "codeNet:p02972", "input_text": "const maxn = trunc(2e5);\nvar a,b:array[1..maxn] of longint;\n n,m,s,i,j:longint;\n check:boolean;\n\nbegin\n\treadln(n); \n\tfor i:=1 to n do read(a[i]);\n\tm:=0; check:=true;\n\tfor i:=1 to n do\n\t begin\n\t s:=a[i];\n\t j:= 2 * i;\n\t while j<=n do\n\t begin\n\t s:=s + a[j];\n\t j:=j +i;\n\t end;\n\t if (s mod 2 = a[i]) and (a[i] = 1) then \n\t begin\n\t inc(m); b[m]:=i;\n\t end;\n\t if s mod 2 <> a[i] then check:=false;\n\t if not check then break;\n\t end;\n\tif not check then write(-1)\n\telse \n\t begin\n \twriteln(m);\n \tfor i:=1 to m do write(b[i],' ');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1563675458, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02972.html", "problem_id": "p02972", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02972/input.txt", "sample_output_relpath": "derived/input_output/data/p02972/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02972/Pascal/s964892979.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s964892979", "user_id": "u017143931"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "const maxn = trunc(2e5);\nvar a,b:array[1..maxn] of longint;\n n,m,s,i,j:longint;\n check:boolean;\n\nbegin\n\treadln(n); \n\tfor i:=1 to n do read(a[i]);\n\tm:=0; check:=true;\n\tfor i:=1 to n do\n\t begin\n\t s:=a[i];\n\t j:= 2 * i;\n\t while j<=n do\n\t begin\n\t s:=s + a[j];\n\t j:=j +i;\n\t end;\n\t if (s mod 2 = a[i]) and (a[i] = 1) then \n\t begin\n\t inc(m); b[m]:=i;\n\t end;\n\t if s mod 2 <> a[i] then check:=false;\n\t if not check then break;\n\t end;\n\tif not check then write(-1)\n\telse \n\t begin\n \twriteln(m);\n \tfor i:=1 to m do write(b[i],' ');\n end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "sample_input": "3\n1 0 0\n"}, "reference_outputs": ["1\n1\n"], "source_document_id": "p02972", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 605, "cpu_time_ms": 15, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s416525568", "group_id": "codeNet:p02972", "input_text": "const maxn = trunc(2e5);\nvar a,b:array[1..maxn] of longint;\n n,m,s,i,j:longint;\n \nbegin\n\treadln(n); \n\tfor i:=1 to n do read(a[i]);\n\tm:=0;\n\tfor i:=1 to n do\n\t begin\n\t s:=a[i];\n\t j:= 2 * i;\n\t while j<=n do\n\t begin\n\t s:=s + a[j];\n\t j:=j +i;\n\t end;\n\t if (s mod 2 = a[i]) and (a[i] = 1) then \n\t begin\n\t inc(m); b[m]:=i;\n\t end;\n\t end;\n\twriteln(m);\n\tfor i:=1 to m do write(b[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1563675110, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02972.html", "problem_id": "p02972", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02972/input.txt", "sample_output_relpath": "derived/input_output/data/p02972/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02972/Pascal/s416525568.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s416525568", "user_id": "u017143931"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "const maxn = trunc(2e5);\nvar a,b:array[1..maxn] of longint;\n n,m,s,i,j:longint;\n \nbegin\n\treadln(n); \n\tfor i:=1 to n do read(a[i]);\n\tm:=0;\n\tfor i:=1 to n do\n\t begin\n\t s:=a[i];\n\t j:= 2 * i;\n\t while j<=n do\n\t begin\n\t s:=s + a[j];\n\t j:=j +i;\n\t end;\n\t if (s mod 2 = a[i]) and (a[i] = 1) then \n\t begin\n\t inc(m); b[m]:=i;\n\t end;\n\t end;\n\twriteln(m);\n\tfor i:=1 to m do write(b[i],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "sample_input": "3\n1 0 0\n"}, "reference_outputs": ["1\n1\n"], "source_document_id": "p02972", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 40, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s065945061", "group_id": "codeNet:p02972", "input_text": "const nmax=200010;\ntype ary=array[1..nmax] of 0..1;\nvar N,i,j,k,latter,sum,count:int64;\n a,ans:ary;\nbegin\nread(N);\nfor i := 1 to N do \n begin read(a[i]);\n if i > N div 2 then \n begin \n ans[i]:=a[i];inc(latter)\n end\n end;\nfor i := N-latter downto 1 do\n begin\n sum:=0;\n for j := 1 to N do\n if i*j > N then break \n else sum:=sum+a[i*j];\n ans[i]:=sum mod 2;\n if ans[i]=1 then inc(count)\n end;\nwriteln(count);\nfor i := 1 to N do\n if ans[i]=1 then write(i,' ');\nend.", "language": "Pascal", "metadata": {"date": 1563674893, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02972.html", "problem_id": "p02972", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02972/input.txt", "sample_output_relpath": "derived/input_output/data/p02972/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02972/Pascal/s065945061.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s065945061", "user_id": "u655683235"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "const nmax=200010;\ntype ary=array[1..nmax] of 0..1;\nvar N,i,j,k,latter,sum,count:int64;\n a,ans:ary;\nbegin\nread(N);\nfor i := 1 to N do \n begin read(a[i]);\n if i > N div 2 then \n begin \n ans[i]:=a[i];inc(latter)\n end\n end;\nfor i := N-latter downto 1 do\n begin\n sum:=0;\n for j := 1 to N do\n if i*j > N then break \n else sum:=sum+a[i*j];\n ans[i]:=sum mod 2;\n if ans[i]=1 then inc(count)\n end;\nwriteln(count);\nfor i := 1 to N do\n if ans[i]=1 then write(i,' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "sample_input": "3\n1 0 0\n"}, "reference_outputs": ["1\n1\n"], "source_document_id": "p02972", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 480, "cpu_time_ms": 37, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s619447248", "group_id": "codeNet:p02984", "input_text": "var i,n:longint;\n a,b:array[1..100000] of longint;\nbegin\n\treadln(n); b[1]:=0;\n\tfor i:=1 to n do read(a[i]);\n\tfor i:=1 to n do \n\t if i mod 2 = 0 then b[1]:= b[1] - a[i]\n\t else b[1]:=b[1] + a[i];\n\tfor i:=2 to n do\n b[i]:= (a[i-1] - b[i - 1] div 2) * 2;\n\tfor i:=1 to n do write(b[i],' ');\nend. ", "language": "Pascal", "metadata": {"date": 1563153558, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Pascal/s619447248.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s619447248", "user_id": "u861796923"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "var i,n:longint;\n a,b:array[1..100000] of longint;\nbegin\n\treadln(n); b[1]:=0;\n\tfor i:=1 to n do read(a[i]);\n\tfor i:=1 to n do \n\t if i mod 2 = 0 then b[1]:= b[1] - a[i]\n\t else b[1]:=b[1] + a[i];\n\tfor i:=2 to n do\n b[i]:= (a[i-1] - b[i - 1] div 2) * 2;\n\tfor i:=1 to n do write(b[i],' ');\nend. ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 305, "cpu_time_ms": 41, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s111402409", "group_id": "codeNet:p02984", "input_text": "var\n a,ans:array[1..100000]of int64;\n i,n:longint;\n o:int64;\nbegin\n read(n);\n for i:=1 to n do\n begin\n read(a[i]);\n if i mod 2=1 then o:=o+a[i] else o:=o-a[i];\n end;\n ans[1]:=o div 2;\n for i:=2 to n do ans[i]:=a[i-1]-ans[i-1];\n for i:=1 to n-1 do write(2*ans[i],' ');\n writeln(2*ans[n]);\nend.", "language": "Pascal", "metadata": {"date": 1562723467, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Pascal/s111402409.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s111402409", "user_id": "u970050572"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "var\n a,ans:array[1..100000]of int64;\n i,n:longint;\n o:int64;\nbegin\n read(n);\n for i:=1 to n do\n begin\n read(a[i]);\n if i mod 2=1 then o:=o+a[i] else o:=o-a[i];\n end;\n ans[1]:=o div 2;\n for i:=2 to n do ans[i]:=a[i-1]-ans[i-1];\n for i:=1 to n-1 do write(2*ans[i],' ');\n writeln(2*ans[n]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 399, "cpu_time_ms": 41, "memory_kb": 2688}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s144770022", "group_id": "codeNet:p02984", "input_text": "var i,n:longint;\n a,b:array[1..100000] of longint;\nbegin\n\treadln(n); b[1]:=0;\n\tfor i:=1 to n do read(a[i]);\n\tfor i:=1 to n do \n\t if i mod 2 = 0 then b[1]:= b[1] - a[i]\n\t else b[1]:=b[1] + a[i];\n\tfor i:=2 to n do b[i]:= (a[i-1] - b[i - 1] div 2) * 2;\n\tfor i:=1 to n do write(b[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1562714084, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Pascal/s144770022.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s144770022", "user_id": "u017143931"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "var i,n:longint;\n a,b:array[1..100000] of longint;\nbegin\n\treadln(n); b[1]:=0;\n\tfor i:=1 to n do read(a[i]);\n\tfor i:=1 to n do \n\t if i mod 2 = 0 then b[1]:= b[1] - a[i]\n\t else b[1]:=b[1] + a[i];\n\tfor i:=2 to n do b[i]:= (a[i-1] - b[i - 1] div 2) * 2;\n\tfor i:=1 to n do write(b[i],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 295, "cpu_time_ms": 41, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s282243132", "group_id": "codeNet:p02989", "input_text": "type ary=array[1..100010] of int64;\nvar n,k,i:int64;\n d:ary;\nprocedure sort(p,q :int64; var d:ary);\n var i, j, k, w :int64;\nbegin i := p; j := q; k:=d[(p+q) div 2];\n repeat\n while d[i] < k do i := i+1;\n while k < d[j] do j := j-1;\n if i <= j then begin\n w := d[i]; d[i] := d[j]; d[j] := w;\n i := i+1; j := j-1\n end\n until i > j;\n if p < j then sort(p,j,d);\n if i < q then sort(i,q,d)\nend;\nbegin\nread(n);\nfor i := 1 to n do read(d[i]);\nsort(1,n,d);\nwrite(d[(n div 2)+1]-d[n div 2])\nend.\n \n\n", "language": "Pascal", "metadata": {"date": 1561858212, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Pascal/s282243132.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s282243132", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "type ary=array[1..100010] of int64;\nvar n,k,i:int64;\n d:ary;\nprocedure sort(p,q :int64; var d:ary);\n var i, j, k, w :int64;\nbegin i := p; j := q; k:=d[(p+q) div 2];\n repeat\n while d[i] < k do i := i+1;\n while k < d[j] do j := j-1;\n if i <= j then begin\n w := d[i]; d[i] := d[j]; d[j] := w;\n i := i+1; j := j-1\n end\n until i > j;\n if p < j then sort(p,j,d);\n if i < q then sort(i,q,d)\nend;\nbegin\nread(n);\nfor i := 1 to n do read(d[i]);\nsort(1,n,d);\nwrite(d[(n div 2)+1]-d[n div 2])\nend.\n \n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 523, "cpu_time_ms": 20, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s147888583", "group_id": "codeNet:p02989", "input_text": "const NMAX=1000010;\ntype ary=array[1..NMAX]of int64;\nvar n,i,j,k,ans :int64;\n d :ary;\n \nprocedure sort(p,q :int64; var a :ary);\n var i, j, k, w :int64;\nbegin i := p; j := q; k:=a[(p+q) div 2];\n repeat\n while a[i] < k do i := i+1;\n while k < a[j] do j := j-1;\n if i <= j then begin\n w := a[i]; a[i] := a[j]; a[j] := w;\n i := i+1; j := j-1\n end\n until i > j;\n if p < j then sort(p,j,a);\n if i < q then sort(i,q,a)\nend;\n\nbegin\n readln(n);\n for i:=1 to n do read(d[i]);\n sort(1,n,d);\n j:=d[(n div 2)+1];\n writeln(j-d[n div 2]);\nend.", "language": "Pascal", "metadata": {"date": 1561858188, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Pascal/s147888583.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s147888583", "user_id": "u805277811"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const NMAX=1000010;\ntype ary=array[1..NMAX]of int64;\nvar n,i,j,k,ans :int64;\n d :ary;\n \nprocedure sort(p,q :int64; var a :ary);\n var i, j, k, w :int64;\nbegin i := p; j := q; k:=a[(p+q) div 2];\n repeat\n while a[i] < k do i := i+1;\n while k < a[j] do j := j-1;\n if i <= j then begin\n w := a[i]; a[i] := a[j]; a[j] := w;\n i := i+1; j := j-1\n end\n until i > j;\n if p < j then sort(p,j,a);\n if i < q then sort(i,q,a)\nend;\n\nbegin\n readln(n);\n for i:=1 to n do read(d[i]);\n sort(1,n,d);\n j:=d[(n div 2)+1];\n writeln(j-d[n div 2]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 570, "cpu_time_ms": 20, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s951668717", "group_id": "codeNet:p02989", "input_text": "var n,re,t,i:longint;\n a:array[1..100000] of longint;\n\n\nprocedure sort(l,r:longint);\nvar x,tmp,i,j:longint;\nbegin\n\ti:=l; j:=r;\n\tx:=a[(l + r) shr 1];\n\trepeat\n\t while a[i] < x do inc(i);\n\t while a[j] > x do dec(j);\n\t if i <= j then\n\t begin\n\t tmp:=a[i];\n\t a[i]:=a[j];\n\t a[j]:=tmp;\n\t inc(i);\n\t dec(j);\n\t end;\n\tuntil i > j;\n\tif l < j then sort(l,j);\n\tif i < r then sort(i,r);\nend;\n\nbegin\n\treadln(n);\n\tfor i:=1 to n do read(a[i]);\n\tsort(1,n);\n t:= n shr 1;\n if a[t] = a[t + 1] then re:=0\n else re:=a[t + 1] - a[t];\n write(re);\nend.", "language": "Pascal", "metadata": {"date": 1561858070, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Pascal/s951668717.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s951668717", "user_id": "u017143931"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,re,t,i:longint;\n a:array[1..100000] of longint;\n\n\nprocedure sort(l,r:longint);\nvar x,tmp,i,j:longint;\nbegin\n\ti:=l; j:=r;\n\tx:=a[(l + r) shr 1];\n\trepeat\n\t while a[i] < x do inc(i);\n\t while a[j] > x do dec(j);\n\t if i <= j then\n\t begin\n\t tmp:=a[i];\n\t a[i]:=a[j];\n\t a[j]:=tmp;\n\t inc(i);\n\t dec(j);\n\t end;\n\tuntil i > j;\n\tif l < j then sort(l,j);\n\tif i < r then sort(i,r);\nend;\n\nbegin\n\treadln(n);\n\tfor i:=1 to n do read(a[i]);\n\tsort(1,n);\n t:= n shr 1;\n if a[t] = a[t + 1] then re:=0\n else re:=a[t + 1] - a[t];\n write(re);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 574, "cpu_time_ms": 20, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s346499339", "group_id": "codeNet:p02990", "input_text": "const modP = 1000000007;\nvar Kcomb,NKcomb,inv:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n \n inv[1]:=1;\n for i:=2 to k do begin\n inv[i]:=1;\n p:=modP-2;\n j:=i;\n while p>0 do begin\n if (p and 1)>0 then inv[i]:=inv[i]*j mod modP;\n j:=j*j mod modP;\n p:=p >> 1;\n end;\n end;\n \n m:=n-k+1;\n NKcomb[0]:=1; NKcomb[m]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n Kcomb[i]:=Kcomb[i-1]*(k-i)mod modP*inv[i] mod modP ;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n for i:=1 to (m+1)div 2 do begin\n NKcomb[i]:=NKcomb[i-1]*(m-i+1)mod modP*inv[i] mod modP;\n NKcomb[m-i]:=NKcomb[i];\n end;\n \n for i:=1 to k do begin\n if i<=n-k+1 then begin\n b:=NKcomb[i] * Kcomb[i-1] mod modP;\n writeln(b);\n end else writeln(0);\n end;\n \nend.\n", "language": "Pascal", "metadata": {"date": 1562168371, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s346499339.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s346499339", "user_id": "u805277811"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const modP = 1000000007;\nvar Kcomb,NKcomb,inv:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n \n inv[1]:=1;\n for i:=2 to k do begin\n inv[i]:=1;\n p:=modP-2;\n j:=i;\n while p>0 do begin\n if (p and 1)>0 then inv[i]:=inv[i]*j mod modP;\n j:=j*j mod modP;\n p:=p >> 1;\n end;\n end;\n \n m:=n-k+1;\n NKcomb[0]:=1; NKcomb[m]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n Kcomb[i]:=Kcomb[i-1]*(k-i)mod modP*inv[i] mod modP ;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n for i:=1 to (m+1)div 2 do begin\n NKcomb[i]:=NKcomb[i-1]*(m-i+1)mod modP*inv[i] mod modP;\n NKcomb[m-i]:=NKcomb[i];\n end;\n \n for i:=1 to k do begin\n if i<=n-k+1 then begin\n b:=NKcomb[i] * Kcomb[i-1] mod modP;\n writeln(b);\n end else writeln(0);\n end;\n \nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 819, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s125941129", "group_id": "codeNet:p02990", "input_text": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\nif k>n-k+1 then begin\n for i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to k do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1562120880, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s125941129.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s125941129", "user_id": "u805277811"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\nif k>n-k+1 then begin\n for i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to k do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s750049032", "group_id": "codeNet:p02990", "input_text": "var\n\tN,K,i:Longint;\n\tinv:Array[1..2002]of Longint=(1,500000004,333333336,250000002,400000003,166666668,142857144,125000001,111111112,700000005,818181824,83333334,153846155,71428572,466666670,562500004,352941179,55555556,157894738,850000006,47619048,409090912,739130440,41666667,280000002,576923081,370370373,35714286,758620695,233333335,129032259,281250002,939393946,676470593,628571433,27777778,621621626,78947369,717948723,425000003,658536590,23809524,395348840,204545456,822222228,369565220,404255322,520833337,448979595,140000001,784313731,788461544,56603774,685185190,763636369,17857143,385964915,879310351,50847458,616666671,688524595,564516133,15873016,140625001,30769231,469696973,686567169,838235300,579710149,814285720,98591550,13888889,410958907,310810813,93333334,539473688,831168837,858974365,202531647,712500005,123456791,329268295,84337350,11904762,670588240,197674420,252873565,102272728,415730340,411111114,164835166,184782610,43010753,202127661,231578949,760416672,268041239,724489801,646464651,570000004,940594066,892156869,572815538,394230772,209523811,28301887,224299067,342592595,9174312,881818188,873873880,508928575,893805316,692982461,147826088,939655179,239316241,25423729,478991600,808333339,438016532,844262301,886178868,782258070,856000006,7936508,480314964,570312504,798449618,515384619,190839696,734848490,165413535,843283588,274074076,419117650,58394161,789855078,604316551,407142860,134751774,49295775,832167838,506944448,151724139,705479457,149659865,655405410,530201346,46666667,483443712,269736844,594771246,915584422,625806456,929487186,343949047,601265827,685534596,856250006,962732926,561728399,116564418,664634151,587878792,42168675,5988024,5952381,242603552,335294120,795321643,98837210,791907520,626436786,325714288,51136364,683615824,207865170,435754193,205555557,933701664,82417583,562841534,92391305,524324328,521505380,577540111,601063834,338624341,615789478,439790579,380208336,694300523,634020623,343589746,862244904,969543154,823232329,507537692,285000002,228855723,470297033,108374385,946078438,131707318,286407769,526570052,197115386,832535891,604761909,90047394,514150947,32863850,612149537,79069768,671296301,875576043,4587156,470319638,440909094,950226251,436936940,125560539,754464291,364444447,446902658,35242291,846491234,711790398,73913044,277056279,969827593,90128756,619658124,880851070,512711868,67510549,239495800,280334730,904166673,406639007,219008266,707818935,922131154,89795919,443089434,165991904,391129035,28112450,428000003,912350604,3968254,339920951,240157482,556862749,285156252,70038911,399224809,517374521,757692313,417624524,95419848,836501907,367424245,611320759,582706771,138576780,421641794,743494429,137037038,450184505,209558825,388278391,529197084,752727278,394927539,252707583,802158279,681003589,203571430,718861215,67375887,650176683,524647891,77192983,416083919,808362375,253472224,961937723,575862073,756013751,852739732,522184304,574829936,210169493,327702705,215488217,265100673,441471575,523333337,770764125,241721856,646864691,134868422,137704919,297385623,749185673,457792211,857605184,312903228,787781356,464743593,492012783,671974527,403174606,800632917,652996850,342767298,614420067,428125003,741433027,481366463,597523224,780864203,406153849,58282209,3058104,832317079,343465048,293939396,631419944,521084341,624624629,2994012,737313438,502976194,41543027,121301776,631268441,167647060,284457480,897660825,206997086,49418605,715942034,395953760,985590785,313218393,521489975,162857144,413105416,25568182,175637395,341807912,19718310,103932585,826330538,717877100,713091927,602777782,113573408,466850832,812672182,541208795,882191787,281420767,376021801,546195656,295392956,262162164,436657685,260752690,16085791,788770059,618666671,300531917,212201593,669312174,195250661,307894739,160104988,719895293,172323761,190104168,966233773,847150265,932816544,817010315,951156819,171794873,102301791,431122452,63613232,484771577,840506335,911616168,760705295,253768846,55137845,142500001,855361602,614427865,779156333,735148520,424691361,554187196,238329240,473039219,188264060,65853659,352798056,643203888,578692498,263285026,16867470,98557693,534772186,916267949,844868741,802380958,966745850,45023697,44917258,757075477,134117648,16431925,526932088,806074772,610722615,39534884,761020887,835648154,614318711,937788025,50574713,2293578,354691078,235159819,642369025,220454547,716553293,975113129,88036118,218468470,83146068,562780273,176733782,877232149,285077953,682222227,605321512,223451329,161147904,517621149,432967036,423245617,172866522,355895199,198257082,36956522,321041217,638528143,820734347,984913800,208602152,45064378,775160605,309829062,240938168,440425535,447983018,256355934,763213536,533755278,646315794,119747900,228511532,140167365,206680586,952083340,355509358,703319507,654244311,109504133,653608252,853909471,607802879,461065577,38854806,544897963,641547866,221544717,632860045,82995952,529292933,695564521,156941651,14056225,266533068,714000005,1996008,456175302,282306165,1984127,588118816,669960479,747534522,120078741,491159139,778431378,344422703,142578126,598440550,535019459,314563109,699612408,400386850,758687264,597302509,878846160,191938581,208812262,921606125,47709924,441904765,918250957,301707782,683712126,510396979,805660383,561205277,791353389,589118203,69288390,844859819,210820897,811918069,871747218,404452693,68518519,60998152,725092256,311233888,604779416,801834868,694139199,541133459,264598542,854280516,376363639,39927405,697463773,457504524,626353795,174774776,901079143,457809698,840501798,491949914,101785715,525846706,859430611,433392543,533687947,578761066,825088345,446208116,762323949,732864680,538596495,334500878,708041963,813263531,904181191,229565219,126736112,771230508,980968865,898100179,787931040,869191056,878006879,732418530,426369866,447863251,261092152,724020448,287414968,585738544,605084750,656514387,663851356,160202362,607744112,95798320,632550340,835845902,720735791,410684477,761666672,296173047,885382066,76285241,120860928,887603312,823432349,729818786,67434211,36124795,568852463,492635028,648692815,696574230,874592840,377235775,728896109,716369535,428802592,953150249,156451614,842190022,393890678,630818624,732371800,571200004,746006395,944178635,835987267,36565978,201587303,438985740,900316462,30015798,326498425,696062997,171383649,880690744,807210037,677621288,714062505,720748835,870716517,43545879,740683235,359689925,298761612,119010820,890432105,640986137,703076928,291858681,529141108,29096478,1529052,438167942,916158543,823439884,171732524,698027319,146969698,216338882,315709972,983408755,760542174,33082707,812312318,163418292,1497006,41853513,368656719,62593145,251488097,493313525,520771517,454814818,60650888,320531760,815634224,609720181,83823530,345080766,142228740,530014645,948830416,411678835,103498543,237263466,524709306,927431066,357971017,444283650,197976880,92352093,992795396,520863313,656609200,862266864,760744991,696709590,81428572,489301002,206552708,85348507,12784091,626950359,587818701,991513444,170903956,385049368,9859155,355836852,551966296,701262277,413165269,366433569,358938550,93444910,856545967,318497916,301388891,224687935,56786704,802213007,233425416,630344832,406336091,696011009,770604401,235939645,941095897,729138172,640710387,66848568,688010904,29931973,273097828,698778838,147696478,538565633,131081082,721997306,718328846,590847918,130376345,506040272,508042899,676037488,894385033,889185587,809333339,215712385,650265962,304116868,606100800,896688748,334656087,952443864,597625334,779973655,653947373,582128782,80052494,1310616,859947650,518954252,586161884,850065195,95052084,855656703,983116890,690012975,923575136,648124196,466408272,525161294,908505161,839124845,975578413,613607193,585897440,645326509,551150899,805874846,215561226,868789815,31806616,419313853,742385792,278833969,920253171,841972193,455808084,822194205,880352651,537106922,126884423,877038902,527568926,964956202,571250004,46192260,427680801,764632633,807213936,592546588,889578170,581164812,367574260,102595798,712345684,755856972,277093598,816728173,119164620,223312885,736519613,73439413,94132030,462759466,532926833,618757617,176399028,52247874,321601944,917575764,289346249,617896014,131642513,712907122,8433735,84235861,549278850,496998803,267386093,601197609,958133978,560334532,922434374,696066751,401190479,853745547,483372925,239620405,522511852,848520716,22458629,348288078,878537742,216725561,67058824,722679206,508215966,690504108,263466044,359064330,403037386,792298722,805361311,67520373,19767442,269454125,880510447,718424107,417824077,158381504,807159359,987312579,968894016,200230151,525287360,360505169,1146789,918671255,177345539,265142859,617579913,891676175,821184516,840728106,610227277,759364364,858276650,612684036,987556568,736723169,44018059,559188279,109234235,497187855,41573034,738496077,781390140,705487127,88366891,287150840,938616078,813823863,642538980,314794218,841111117,591564932,302660756,256921375,611725668,786740337,80573952,324145537,758810578,882288235,216483518,963776077,711622812,371303398,86433261,712568311,677947603,741548533,99128541,41349293,18478261,916395229,660520612,776814740,819264075,304864867,910367177,952535066,492456900,252960174,104301076,23630505,22532189,595927121,887580306,515508025,154914531,16008538,120469084,164004261,720212771,568544106,223991509,115588548,128177967,467724871,381606768,551214365,266877639,262381456,323157897,884332288,59873950,383001052,114255766,687958120,570083686,204806689,103340293,8342023,476041670,746097820,177754679,580477678,851659757,338860106,827122159,260599795,554752070,199174408,326804126,669412981,926954739,943473799,803901443,468717952,730532792,584442174,19427403,492339125,772448985,1019368,320773933,399796544,610772362,793908635,816430026,447821685,41497976,17189080,764646470,172552978,847782264,877139986,578470829,901507544,507028116,911735212,133266534,874874881,857000006,833166839,998004,650049855,228087651,245771146,641153086,2979146,500992067,222993064,294059408,680514347,834980243,896347489,373767261,21674877,560039374,877089485,745579573,676153096,389215689,369245840,672211355,94819160,71289063,226341465,299220275,938656287,767509733,735665700,657281558,747817658,349806204,97773476,200193425,905314016,379343632,628736745,798651258,483156885,439423080,995196933,595969294,504314481,104406131,566507181,960803066,840496663,23854962,551954246,720952386,564224552,959125482,471035141,150853891,618009483,341856063,497634819,755198493,391879134,902830195,762488224,780602642,544684858,895676698,6572770,794559105,297094660,34644195,705332091,922429913,942110184,605410452,642124888,905959038,215813955,435873609,237697309,702226350,929564418,534259263,930619803,30499076,704524474,362546128,375115210,155616944,92916284,302389708,604224063,400917434,621448217,847069603,867337609,770566733,294063929,132299271,394712856,427140258,191992722,688181823,458673936,519963706,977334549,848731890,590045253,228752262,765130990,813176901,686203792,87387388,176417643,950539575,812219233,228904849,625112112,420250899,494180845,245974957,338695266,550892861,2676182,262923353,755120219,929715309,872888895,716696275,280390419,766843977,143489815,289380533,404067200,912544176,415710506,223104058,407048461,881161978,731750225,366432340,393327483,769298251,730937779,167250439,386701665,854020985,342358081,906631769,84568440,952090599,724107925,614782613,508253696,63368056,360797921,385615254,655411260,990484436,878133109,949050093,773080247,393965520,310938848,434595528,893379198,939003443,418025754,366209265,317052273,213184933,855432,723931629,264731001,130546076,34100597,362010224,176170214,143707484,474936282,292869272,687871082,302542375,119390348,828257197,320371938,331925678,613502114,80101181,230834037,303872056,91673676,47899160,920235103,316275170,218776196,417922951,56066946,860367899,685045953,705342242,273561303,380833336,353871776,648086527,285120534,442691033,881327807,538142624,652858331,60430464,926385449,443801656,827415365,911716178,128606761,364909393,141563787,533717109,831553005,518062401,89417556,784426235,79443080,246317514,733442360,824346411,617959188,348287115,729421358,437296420,825061031,688617891,965881404,864448058,117599352,858184771,633198385,214401296,687954734,976575128,526230835,78225807,141821113,421095011,626709578,196945339,5622490,315409312,668805137,366185900,177742195,285600002,511590731,873003201,62250599,972089321,782470125,917993637,948289585,18282989,100873710,600793655,712926254,219492870,988915288,450158231,467984193,15007899,133385952,663249216,348305755,848031502,247049569,585691828,509819328,440345372,711372554,903605022,192638999,338810644,570758409,857031256,508977365,860374421,439594703,935358262,414007785,521772943,203574205,870341621,448409623,679844966,853601865,149380806,253673629,59505410,503474907,945216056,513492679,820493072,871439575,351538464,342813223,645929344,201074445,264570554,683524909,14548239,957153794,764526,225362874,219083971,451563695,958079275,456968777,411719942,967300387,85866262,547456344,849013663,31842305,73484849,57532173,108169441,905517769,157854986,722264156,991704381,523737758,380271087,696012044,516541357,585274234,406156159,561140289,81709146,27715356,748503,634255801,520926760,428678121,684328363,725577932,531296576,776619514,625744052,748698890,746656766,428359320,760385762,847294298,227407409,99185789,30325444,535107173,160265880,90036901,407817112,741341199,804860094,53715968,41911765,903747251,172540383,186353633,71114370,477655681,765007326,713240678,474415208,205989775,705839421,57622174,551749275,801165337,118631733,350545457,262354653,66085694,463715533,995649028,678985512,978276618,222141825,107013739,98988440,250541518,546176050,495313630,496397698,940244787,760431660,786484549,328304600,643933960,431133432,736200722,880372499,589119546,348354795,173695498,40714286,591720204,244650501,290805419,103276354,143772243,542674257,746979394,506392049,296664303,813475183,534372789,793909354,815994344,495756722,330035338,85451978,616090336,192524684,254404512,504929581,15482055,177918426,791286021,275983148,215438598,850631142,604765246,706582638,422673201,683216788,742837182,179469275,31402652,46722455,161672475,928272987,735560200,159248958,314801948,650694449,471894521,612343971,451836455,28393352,392387546,901106507,583275747,116712708,218081437,315172416,820813238,703168049,332415694,848005508,551202753,885302204,45298559,617969826,326936260,970547952,869267631,364569086,833219418,820355197,704436865,33424284,12951602,344005452,222600410,514965990,552685252,136548914,880515960,349389419,242033900,73848239,441435345,769282820,544286684,65540541,193112763,360998653,720836148,359164423,843097649,295423959,810356428,565188176,239086637,253020136,718980555,754021453,943737448,338018744,88294315,947192520,88844356,944592797,76050701,904666673,115922719,607856196,665336,325132981,154152825,152058434,823490384,303050400,94102055,448344374,381204503,667328047,318572375,476221932,529372941,298812667,990771266,889986831,982225155,826973690,249178174,291064391,381483916,40026247,627540988,655308,163719713,429973825,509483326,259477126,233834097,293080942,781474239,925032601,349837136,47526042,70917372,927828355,532813519,491558445,160285530,845006491,721970193,461787568,771521041,324062098,421460895,233204136,653970308,262580647,466795619,954252584,416613010,919562426,557556274,987789210,532434172,806803600,134060296,292948720,875080083,822663258,63979527,775575453,298402558,402937423,594767075,107780613,973868713,934394911,607893066,15903308,802924354,709656930,480634924,371192896,688649339,639416988,328689046,960126589,767235932,920986100,842703733,227904042,130599370,911097106,503465662,940176329,5034613,268553461,37712131,563442215,853735097,438519451,922884019,263784463,612398251,482478101,529706070,285625002,524047474,23096130,673112918,713840404,948286611,882316320,542626015,403606968,957737732,296273294,603972692,444789085,830130198,290582406,719504649,183787130,468150900,51297899,190858556,356172842,528686000,377928486,353666053,138546799,681230774,908364090,776889987,59582310,437077965,611656446,584304112,868259810,221677895,536719710,600611625,47066015,548564451,231379733,320927397,766463420,847044491,809378812,776019482,88199514,268693011,26123937,284760172,160800972,251061251,458787882,883101157,644673128,13309135,308948007,726283993,565821260,919130966,356453561,152501508,504216871,316676703,542117934,683102831,274639425,724924930,748499405,319136175,633693050,16776513,800598808,819269904,479066989,611476394,280167266,347462689,461217187,830649976,848033379,626563435,700595243,333135041,926872777,508615571,741686466,808308611,619810206,772377006,261255926,144464181,424260358,653459496,511229318,985823988,174144039,526253691,439268871,27106659,608362784,805179523,33529412,815402710,361339603,245449209,254107983,56891496,345252054,910954898,131733022,564072561,179532165,656925779,201518693,778166964,396149361,441399420,902680659,290623182,533760190,937754515,9883721,737362004,634727066,438769591,940255227,743188411,859212057,667631736,708912042,166570273,79190752,257076836,903579683,788228511,993656293,197118157,484447008,632700062,600115079,821736636,262643680,255025849,680252588,289730352,500573398,104297995,959335631,53234116,588672773,244139510,632571433,916047979,808789960,971477474,945838091,482621086,410592258,701764376,420364053,225696420,805113642,574673485,379682182,131593875,429138325,35127479,306342018,528579517,493778284,127190504,868361588,905702999,522009033,218838129,779594143,3943662,554617121,104108048,748593931,386734123,20786517,81414936,869248042,1121705,390695070,365266109,852743567,65472860,544183449,230855228,143575420,945281972,469308039,465142223,906911935,942618391,321269490,803561497,157397109,724291278,920555562,756246535,295782466,98724349,151330378,222714683,628460691,123408966,305862834,692095085,893370172,939812265,40286976,931053509,662072772,962534442,379405289,313153552,941144121,601429361,108241759,909939600,981888042,620954475,355811406,976438363,185651699,345374934,543216634,324220888,856284159,581649376,838973805,164211676,870774270,475204363,549564274,364180732,520674650,232191410,509239134,548071704,958197618,908844282,330260306,459078594,388407370,213318897,909632041,195240672,652432437,238789845,955183592,471127904,476267533,87331537,246228450,984383421,126480087,294782143,52150538,412681357,511815256,614063343,511266098,403217161,797963564,908409219,443790153,876939546,757754016,920897922,577457269,996796590,8004269,523733337,60234542,49014385,582002134,457158066,860106389,981392883,284272053,963356353,611995758,242440320,57794274,345521995,564088987,78348333,733862439,248016924,190803384,146328580,775607186,439050135,633438823,207169216,131190728,10005266,661578952,962125204,442166144,617446142,29936975,232020999,191500526,316727847,57127883,177579886,343979060,626896917,285041843,256664926,602403348,434464755,551670150,892540434,504171015,575820744,238020835,817282671,373048910,906916283,588877343,393246756,290238839,375713547,925829882,14515293,169430053,298291043,913561083,425245735,630299901,786563313,277376035,886938571,99587204,321815371,163402063,373003609,834706494,265054042,963477373,790231368,971736903,880328717,901950725,668547978,234358976,500768840,365266396,97286227,292221087,420460361,509713705,661727138,746169566,9698826,886224496,785313621,509684,729495675,660386970,812722652,199898272,388408747,305386181,948704933,896954321,607813297,408215013,443993921,723910846,168101267,20748988,232675773,8594540,636685199,382323235,378596671,86276489,738779632,423891132,152141059,438569993,496225469,789235418,661136254,450753772,175791061,253514058,989964884,455867606,11027569,66633267,819228849,937437444,35017509,428500003,54472764,916583423);\n\tB,R,M:int64;\nbegin\n\tread(N,K);\n\tM:=1000000007;\n\tB:=1;\n\tR:=N-K+1;\n\tfor i:=0 to K-1 do begin\n\t\twriteln(B*R mod M);\n\t\tB:=B*(K-i-1)mod M*inv[i+1]mod M;\n\t\tR:=R*(N-K-i)mod M*inv[i+2]mod M;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1561863285, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s750049032.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s750049032", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "var\n\tN,K,i:Longint;\n\tinv:Array[1..2002]of Longint=(1,500000004,333333336,250000002,400000003,166666668,142857144,125000001,111111112,700000005,818181824,83333334,153846155,71428572,466666670,562500004,352941179,55555556,157894738,850000006,47619048,409090912,739130440,41666667,280000002,576923081,370370373,35714286,758620695,233333335,129032259,281250002,939393946,676470593,628571433,27777778,621621626,78947369,717948723,425000003,658536590,23809524,395348840,204545456,822222228,369565220,404255322,520833337,448979595,140000001,784313731,788461544,56603774,685185190,763636369,17857143,385964915,879310351,50847458,616666671,688524595,564516133,15873016,140625001,30769231,469696973,686567169,838235300,579710149,814285720,98591550,13888889,410958907,310810813,93333334,539473688,831168837,858974365,202531647,712500005,123456791,329268295,84337350,11904762,670588240,197674420,252873565,102272728,415730340,411111114,164835166,184782610,43010753,202127661,231578949,760416672,268041239,724489801,646464651,570000004,940594066,892156869,572815538,394230772,209523811,28301887,224299067,342592595,9174312,881818188,873873880,508928575,893805316,692982461,147826088,939655179,239316241,25423729,478991600,808333339,438016532,844262301,886178868,782258070,856000006,7936508,480314964,570312504,798449618,515384619,190839696,734848490,165413535,843283588,274074076,419117650,58394161,789855078,604316551,407142860,134751774,49295775,832167838,506944448,151724139,705479457,149659865,655405410,530201346,46666667,483443712,269736844,594771246,915584422,625806456,929487186,343949047,601265827,685534596,856250006,962732926,561728399,116564418,664634151,587878792,42168675,5988024,5952381,242603552,335294120,795321643,98837210,791907520,626436786,325714288,51136364,683615824,207865170,435754193,205555557,933701664,82417583,562841534,92391305,524324328,521505380,577540111,601063834,338624341,615789478,439790579,380208336,694300523,634020623,343589746,862244904,969543154,823232329,507537692,285000002,228855723,470297033,108374385,946078438,131707318,286407769,526570052,197115386,832535891,604761909,90047394,514150947,32863850,612149537,79069768,671296301,875576043,4587156,470319638,440909094,950226251,436936940,125560539,754464291,364444447,446902658,35242291,846491234,711790398,73913044,277056279,969827593,90128756,619658124,880851070,512711868,67510549,239495800,280334730,904166673,406639007,219008266,707818935,922131154,89795919,443089434,165991904,391129035,28112450,428000003,912350604,3968254,339920951,240157482,556862749,285156252,70038911,399224809,517374521,757692313,417624524,95419848,836501907,367424245,611320759,582706771,138576780,421641794,743494429,137037038,450184505,209558825,388278391,529197084,752727278,394927539,252707583,802158279,681003589,203571430,718861215,67375887,650176683,524647891,77192983,416083919,808362375,253472224,961937723,575862073,756013751,852739732,522184304,574829936,210169493,327702705,215488217,265100673,441471575,523333337,770764125,241721856,646864691,134868422,137704919,297385623,749185673,457792211,857605184,312903228,787781356,464743593,492012783,671974527,403174606,800632917,652996850,342767298,614420067,428125003,741433027,481366463,597523224,780864203,406153849,58282209,3058104,832317079,343465048,293939396,631419944,521084341,624624629,2994012,737313438,502976194,41543027,121301776,631268441,167647060,284457480,897660825,206997086,49418605,715942034,395953760,985590785,313218393,521489975,162857144,413105416,25568182,175637395,341807912,19718310,103932585,826330538,717877100,713091927,602777782,113573408,466850832,812672182,541208795,882191787,281420767,376021801,546195656,295392956,262162164,436657685,260752690,16085791,788770059,618666671,300531917,212201593,669312174,195250661,307894739,160104988,719895293,172323761,190104168,966233773,847150265,932816544,817010315,951156819,171794873,102301791,431122452,63613232,484771577,840506335,911616168,760705295,253768846,55137845,142500001,855361602,614427865,779156333,735148520,424691361,554187196,238329240,473039219,188264060,65853659,352798056,643203888,578692498,263285026,16867470,98557693,534772186,916267949,844868741,802380958,966745850,45023697,44917258,757075477,134117648,16431925,526932088,806074772,610722615,39534884,761020887,835648154,614318711,937788025,50574713,2293578,354691078,235159819,642369025,220454547,716553293,975113129,88036118,218468470,83146068,562780273,176733782,877232149,285077953,682222227,605321512,223451329,161147904,517621149,432967036,423245617,172866522,355895199,198257082,36956522,321041217,638528143,820734347,984913800,208602152,45064378,775160605,309829062,240938168,440425535,447983018,256355934,763213536,533755278,646315794,119747900,228511532,140167365,206680586,952083340,355509358,703319507,654244311,109504133,653608252,853909471,607802879,461065577,38854806,544897963,641547866,221544717,632860045,82995952,529292933,695564521,156941651,14056225,266533068,714000005,1996008,456175302,282306165,1984127,588118816,669960479,747534522,120078741,491159139,778431378,344422703,142578126,598440550,535019459,314563109,699612408,400386850,758687264,597302509,878846160,191938581,208812262,921606125,47709924,441904765,918250957,301707782,683712126,510396979,805660383,561205277,791353389,589118203,69288390,844859819,210820897,811918069,871747218,404452693,68518519,60998152,725092256,311233888,604779416,801834868,694139199,541133459,264598542,854280516,376363639,39927405,697463773,457504524,626353795,174774776,901079143,457809698,840501798,491949914,101785715,525846706,859430611,433392543,533687947,578761066,825088345,446208116,762323949,732864680,538596495,334500878,708041963,813263531,904181191,229565219,126736112,771230508,980968865,898100179,787931040,869191056,878006879,732418530,426369866,447863251,261092152,724020448,287414968,585738544,605084750,656514387,663851356,160202362,607744112,95798320,632550340,835845902,720735791,410684477,761666672,296173047,885382066,76285241,120860928,887603312,823432349,729818786,67434211,36124795,568852463,492635028,648692815,696574230,874592840,377235775,728896109,716369535,428802592,953150249,156451614,842190022,393890678,630818624,732371800,571200004,746006395,944178635,835987267,36565978,201587303,438985740,900316462,30015798,326498425,696062997,171383649,880690744,807210037,677621288,714062505,720748835,870716517,43545879,740683235,359689925,298761612,119010820,890432105,640986137,703076928,291858681,529141108,29096478,1529052,438167942,916158543,823439884,171732524,698027319,146969698,216338882,315709972,983408755,760542174,33082707,812312318,163418292,1497006,41853513,368656719,62593145,251488097,493313525,520771517,454814818,60650888,320531760,815634224,609720181,83823530,345080766,142228740,530014645,948830416,411678835,103498543,237263466,524709306,927431066,357971017,444283650,197976880,92352093,992795396,520863313,656609200,862266864,760744991,696709590,81428572,489301002,206552708,85348507,12784091,626950359,587818701,991513444,170903956,385049368,9859155,355836852,551966296,701262277,413165269,366433569,358938550,93444910,856545967,318497916,301388891,224687935,56786704,802213007,233425416,630344832,406336091,696011009,770604401,235939645,941095897,729138172,640710387,66848568,688010904,29931973,273097828,698778838,147696478,538565633,131081082,721997306,718328846,590847918,130376345,506040272,508042899,676037488,894385033,889185587,809333339,215712385,650265962,304116868,606100800,896688748,334656087,952443864,597625334,779973655,653947373,582128782,80052494,1310616,859947650,518954252,586161884,850065195,95052084,855656703,983116890,690012975,923575136,648124196,466408272,525161294,908505161,839124845,975578413,613607193,585897440,645326509,551150899,805874846,215561226,868789815,31806616,419313853,742385792,278833969,920253171,841972193,455808084,822194205,880352651,537106922,126884423,877038902,527568926,964956202,571250004,46192260,427680801,764632633,807213936,592546588,889578170,581164812,367574260,102595798,712345684,755856972,277093598,816728173,119164620,223312885,736519613,73439413,94132030,462759466,532926833,618757617,176399028,52247874,321601944,917575764,289346249,617896014,131642513,712907122,8433735,84235861,549278850,496998803,267386093,601197609,958133978,560334532,922434374,696066751,401190479,853745547,483372925,239620405,522511852,848520716,22458629,348288078,878537742,216725561,67058824,722679206,508215966,690504108,263466044,359064330,403037386,792298722,805361311,67520373,19767442,269454125,880510447,718424107,417824077,158381504,807159359,987312579,968894016,200230151,525287360,360505169,1146789,918671255,177345539,265142859,617579913,891676175,821184516,840728106,610227277,759364364,858276650,612684036,987556568,736723169,44018059,559188279,109234235,497187855,41573034,738496077,781390140,705487127,88366891,287150840,938616078,813823863,642538980,314794218,841111117,591564932,302660756,256921375,611725668,786740337,80573952,324145537,758810578,882288235,216483518,963776077,711622812,371303398,86433261,712568311,677947603,741548533,99128541,41349293,18478261,916395229,660520612,776814740,819264075,304864867,910367177,952535066,492456900,252960174,104301076,23630505,22532189,595927121,887580306,515508025,154914531,16008538,120469084,164004261,720212771,568544106,223991509,115588548,128177967,467724871,381606768,551214365,266877639,262381456,323157897,884332288,59873950,383001052,114255766,687958120,570083686,204806689,103340293,8342023,476041670,746097820,177754679,580477678,851659757,338860106,827122159,260599795,554752070,199174408,326804126,669412981,926954739,943473799,803901443,468717952,730532792,584442174,19427403,492339125,772448985,1019368,320773933,399796544,610772362,793908635,816430026,447821685,41497976,17189080,764646470,172552978,847782264,877139986,578470829,901507544,507028116,911735212,133266534,874874881,857000006,833166839,998004,650049855,228087651,245771146,641153086,2979146,500992067,222993064,294059408,680514347,834980243,896347489,373767261,21674877,560039374,877089485,745579573,676153096,389215689,369245840,672211355,94819160,71289063,226341465,299220275,938656287,767509733,735665700,657281558,747817658,349806204,97773476,200193425,905314016,379343632,628736745,798651258,483156885,439423080,995196933,595969294,504314481,104406131,566507181,960803066,840496663,23854962,551954246,720952386,564224552,959125482,471035141,150853891,618009483,341856063,497634819,755198493,391879134,902830195,762488224,780602642,544684858,895676698,6572770,794559105,297094660,34644195,705332091,922429913,942110184,605410452,642124888,905959038,215813955,435873609,237697309,702226350,929564418,534259263,930619803,30499076,704524474,362546128,375115210,155616944,92916284,302389708,604224063,400917434,621448217,847069603,867337609,770566733,294063929,132299271,394712856,427140258,191992722,688181823,458673936,519963706,977334549,848731890,590045253,228752262,765130990,813176901,686203792,87387388,176417643,950539575,812219233,228904849,625112112,420250899,494180845,245974957,338695266,550892861,2676182,262923353,755120219,929715309,872888895,716696275,280390419,766843977,143489815,289380533,404067200,912544176,415710506,223104058,407048461,881161978,731750225,366432340,393327483,769298251,730937779,167250439,386701665,854020985,342358081,906631769,84568440,952090599,724107925,614782613,508253696,63368056,360797921,385615254,655411260,990484436,878133109,949050093,773080247,393965520,310938848,434595528,893379198,939003443,418025754,366209265,317052273,213184933,855432,723931629,264731001,130546076,34100597,362010224,176170214,143707484,474936282,292869272,687871082,302542375,119390348,828257197,320371938,331925678,613502114,80101181,230834037,303872056,91673676,47899160,920235103,316275170,218776196,417922951,56066946,860367899,685045953,705342242,273561303,380833336,353871776,648086527,285120534,442691033,881327807,538142624,652858331,60430464,926385449,443801656,827415365,911716178,128606761,364909393,141563787,533717109,831553005,518062401,89417556,784426235,79443080,246317514,733442360,824346411,617959188,348287115,729421358,437296420,825061031,688617891,965881404,864448058,117599352,858184771,633198385,214401296,687954734,976575128,526230835,78225807,141821113,421095011,626709578,196945339,5622490,315409312,668805137,366185900,177742195,285600002,511590731,873003201,62250599,972089321,782470125,917993637,948289585,18282989,100873710,600793655,712926254,219492870,988915288,450158231,467984193,15007899,133385952,663249216,348305755,848031502,247049569,585691828,509819328,440345372,711372554,903605022,192638999,338810644,570758409,857031256,508977365,860374421,439594703,935358262,414007785,521772943,203574205,870341621,448409623,679844966,853601865,149380806,253673629,59505410,503474907,945216056,513492679,820493072,871439575,351538464,342813223,645929344,201074445,264570554,683524909,14548239,957153794,764526,225362874,219083971,451563695,958079275,456968777,411719942,967300387,85866262,547456344,849013663,31842305,73484849,57532173,108169441,905517769,157854986,722264156,991704381,523737758,380271087,696012044,516541357,585274234,406156159,561140289,81709146,27715356,748503,634255801,520926760,428678121,684328363,725577932,531296576,776619514,625744052,748698890,746656766,428359320,760385762,847294298,227407409,99185789,30325444,535107173,160265880,90036901,407817112,741341199,804860094,53715968,41911765,903747251,172540383,186353633,71114370,477655681,765007326,713240678,474415208,205989775,705839421,57622174,551749275,801165337,118631733,350545457,262354653,66085694,463715533,995649028,678985512,978276618,222141825,107013739,98988440,250541518,546176050,495313630,496397698,940244787,760431660,786484549,328304600,643933960,431133432,736200722,880372499,589119546,348354795,173695498,40714286,591720204,244650501,290805419,103276354,143772243,542674257,746979394,506392049,296664303,813475183,534372789,793909354,815994344,495756722,330035338,85451978,616090336,192524684,254404512,504929581,15482055,177918426,791286021,275983148,215438598,850631142,604765246,706582638,422673201,683216788,742837182,179469275,31402652,46722455,161672475,928272987,735560200,159248958,314801948,650694449,471894521,612343971,451836455,28393352,392387546,901106507,583275747,116712708,218081437,315172416,820813238,703168049,332415694,848005508,551202753,885302204,45298559,617969826,326936260,970547952,869267631,364569086,833219418,820355197,704436865,33424284,12951602,344005452,222600410,514965990,552685252,136548914,880515960,349389419,242033900,73848239,441435345,769282820,544286684,65540541,193112763,360998653,720836148,359164423,843097649,295423959,810356428,565188176,239086637,253020136,718980555,754021453,943737448,338018744,88294315,947192520,88844356,944592797,76050701,904666673,115922719,607856196,665336,325132981,154152825,152058434,823490384,303050400,94102055,448344374,381204503,667328047,318572375,476221932,529372941,298812667,990771266,889986831,982225155,826973690,249178174,291064391,381483916,40026247,627540988,655308,163719713,429973825,509483326,259477126,233834097,293080942,781474239,925032601,349837136,47526042,70917372,927828355,532813519,491558445,160285530,845006491,721970193,461787568,771521041,324062098,421460895,233204136,653970308,262580647,466795619,954252584,416613010,919562426,557556274,987789210,532434172,806803600,134060296,292948720,875080083,822663258,63979527,775575453,298402558,402937423,594767075,107780613,973868713,934394911,607893066,15903308,802924354,709656930,480634924,371192896,688649339,639416988,328689046,960126589,767235932,920986100,842703733,227904042,130599370,911097106,503465662,940176329,5034613,268553461,37712131,563442215,853735097,438519451,922884019,263784463,612398251,482478101,529706070,285625002,524047474,23096130,673112918,713840404,948286611,882316320,542626015,403606968,957737732,296273294,603972692,444789085,830130198,290582406,719504649,183787130,468150900,51297899,190858556,356172842,528686000,377928486,353666053,138546799,681230774,908364090,776889987,59582310,437077965,611656446,584304112,868259810,221677895,536719710,600611625,47066015,548564451,231379733,320927397,766463420,847044491,809378812,776019482,88199514,268693011,26123937,284760172,160800972,251061251,458787882,883101157,644673128,13309135,308948007,726283993,565821260,919130966,356453561,152501508,504216871,316676703,542117934,683102831,274639425,724924930,748499405,319136175,633693050,16776513,800598808,819269904,479066989,611476394,280167266,347462689,461217187,830649976,848033379,626563435,700595243,333135041,926872777,508615571,741686466,808308611,619810206,772377006,261255926,144464181,424260358,653459496,511229318,985823988,174144039,526253691,439268871,27106659,608362784,805179523,33529412,815402710,361339603,245449209,254107983,56891496,345252054,910954898,131733022,564072561,179532165,656925779,201518693,778166964,396149361,441399420,902680659,290623182,533760190,937754515,9883721,737362004,634727066,438769591,940255227,743188411,859212057,667631736,708912042,166570273,79190752,257076836,903579683,788228511,993656293,197118157,484447008,632700062,600115079,821736636,262643680,255025849,680252588,289730352,500573398,104297995,959335631,53234116,588672773,244139510,632571433,916047979,808789960,971477474,945838091,482621086,410592258,701764376,420364053,225696420,805113642,574673485,379682182,131593875,429138325,35127479,306342018,528579517,493778284,127190504,868361588,905702999,522009033,218838129,779594143,3943662,554617121,104108048,748593931,386734123,20786517,81414936,869248042,1121705,390695070,365266109,852743567,65472860,544183449,230855228,143575420,945281972,469308039,465142223,906911935,942618391,321269490,803561497,157397109,724291278,920555562,756246535,295782466,98724349,151330378,222714683,628460691,123408966,305862834,692095085,893370172,939812265,40286976,931053509,662072772,962534442,379405289,313153552,941144121,601429361,108241759,909939600,981888042,620954475,355811406,976438363,185651699,345374934,543216634,324220888,856284159,581649376,838973805,164211676,870774270,475204363,549564274,364180732,520674650,232191410,509239134,548071704,958197618,908844282,330260306,459078594,388407370,213318897,909632041,195240672,652432437,238789845,955183592,471127904,476267533,87331537,246228450,984383421,126480087,294782143,52150538,412681357,511815256,614063343,511266098,403217161,797963564,908409219,443790153,876939546,757754016,920897922,577457269,996796590,8004269,523733337,60234542,49014385,582002134,457158066,860106389,981392883,284272053,963356353,611995758,242440320,57794274,345521995,564088987,78348333,733862439,248016924,190803384,146328580,775607186,439050135,633438823,207169216,131190728,10005266,661578952,962125204,442166144,617446142,29936975,232020999,191500526,316727847,57127883,177579886,343979060,626896917,285041843,256664926,602403348,434464755,551670150,892540434,504171015,575820744,238020835,817282671,373048910,906916283,588877343,393246756,290238839,375713547,925829882,14515293,169430053,298291043,913561083,425245735,630299901,786563313,277376035,886938571,99587204,321815371,163402063,373003609,834706494,265054042,963477373,790231368,971736903,880328717,901950725,668547978,234358976,500768840,365266396,97286227,292221087,420460361,509713705,661727138,746169566,9698826,886224496,785313621,509684,729495675,660386970,812722652,199898272,388408747,305386181,948704933,896954321,607813297,408215013,443993921,723910846,168101267,20748988,232675773,8594540,636685199,382323235,378596671,86276489,738779632,423891132,152141059,438569993,496225469,789235418,661136254,450753772,175791061,253514058,989964884,455867606,11027569,66633267,819228849,937437444,35017509,428500003,54472764,916583423);\n\tB,R,M:int64;\nbegin\n\tread(N,K);\n\tM:=1000000007;\n\tB:=1;\n\tR:=N-K+1;\n\tfor i:=0 to K-1 do begin\n\t\twriteln(B*R mod M);\n\t\tB:=B*(K-i-1)mod M*inv[i+1]mod M;\n\t\tR:=R*(N-K-i)mod M*inv[i+2]mod M;\n\tend;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 19962, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s268128617", "group_id": "codeNet:p02990", "input_text": "var\n\tN,K,i:Longint;\n\tinv:Array[1..2002]of Longint;\n\tB,R,M:int64;\nbegin\n\tread(N,K);\n\tinv[1]:=1;\n\tM:=1000000007;\n\tfor i:=2 to K+2 do begin\n\t\tinv[i]:=M-M div i*inv[M mod i] mod M;\n\tend;\n\tB:=1;\n\tR:=N-K+1;\n\tfor i:=0 to K-1 do begin\n\t\twriteln(B*R mod M);\n\t\tB:=B*(K-i-1)mod M*inv[i+1]mod M;\n\t\tif R<>0 then R:=R*(N-K-i)mod M*inv[i+2]mod M;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1561863182, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s268128617.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s268128617", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "var\n\tN,K,i:Longint;\n\tinv:Array[1..2002]of Longint;\n\tB,R,M:int64;\nbegin\n\tread(N,K);\n\tinv[1]:=1;\n\tM:=1000000007;\n\tfor i:=2 to K+2 do begin\n\t\tinv[i]:=M-M div i*inv[M mod i] mod M;\n\tend;\n\tB:=1;\n\tR:=N-K+1;\n\tfor i:=0 to K-1 do begin\n\t\twriteln(B*R mod M);\n\t\tB:=B*(K-i-1)mod M*inv[i+1]mod M;\n\t\tif R<>0 then R:=R*(N-K-i)mod M*inv[i+2]mod M;\n\tend;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 343, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s310470079", "group_id": "codeNet:p02990", "input_text": "var\n\tN,K,i:Longint;\n\tinv:Array[1..2002]of Longint;\n\tB,R,M:int64;\nbegin\n\tread(N,K);\n\tinv[1]:=1;\n\tM:=1000000007;\n\tfor i:=2 to K+2 do begin\n\t\tinv[i]:=M-M div i*inv[M mod i] mod M;\n\tend;\n\tB:=1;\n\tR:=N-K+1;\n\tfor i:=0 to K-1 do begin\n\t\twriteln(B*R mod M);\n\t\tB:=B*(K-i-1)mod M*inv[i+1]mod M;\n\t\tR:=R*(N-K-i)mod M*inv[i+2]mod M;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1561863143, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s310470079.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s310470079", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "var\n\tN,K,i:Longint;\n\tinv:Array[1..2002]of Longint;\n\tB,R,M:int64;\nbegin\n\tread(N,K);\n\tinv[1]:=1;\n\tM:=1000000007;\n\tfor i:=2 to K+2 do begin\n\t\tinv[i]:=M-M div i*inv[M mod i] mod M;\n\tend;\n\tB:=1;\n\tR:=N-K+1;\n\tfor i:=0 to K-1 do begin\n\t\twriteln(B*R mod M);\n\t\tB:=B*(K-i-1)mod M*inv[i+1]mod M;\n\t\tR:=R*(N-K-i)mod M*inv[i+2]mod M;\n\tend;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 330, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s516324026", "group_id": "codeNet:p02990", "input_text": "const base = trunc(1e9) + 7;\nvar f:array[0..2000] of int64;\n n,k,i:integer;\n re:int64;\n\nprocedure init;\nvar i:integer;\nbegin\n\tf[0]:=1;\n\tf[1]:=1;\n\tfor i:=2 to 2000 do f[i]:= (f[i - 1] * i) mod base;\nend;\n\nfunction power(a,b:int64):int64;\nvar tmp:int64;\nbegin\n\tif b = 0 then exit(1);\n\tif b = 1 then exit(a);\n\ttmp:= power(a,b shr 1);\n\tif b mod 2 = 0 then power:= (tmp * tmp) mod base\n\telse power:= (((tmp * tmp) mod base) * a) mod base;\nend;\n\nfunction calc(n,k:integer):int64;\nbegin\n\tcalc:= (f[n] * power(f[k] * f[n - k], base - 2) mod base) mod base;\nend;\n\nbegin\n\treadln(n,k);\n\tinit;\n\tfor i:=1 to k do \n\t begin\n\t writeln((calc(k-1,i-1) * calc(n-k+1,i)) mod base);\n\t end;\nend.", "language": "Pascal", "metadata": {"date": 1561862873, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s516324026.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s516324026", "user_id": "u017143931"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const base = trunc(1e9) + 7;\nvar f:array[0..2000] of int64;\n n,k,i:integer;\n re:int64;\n\nprocedure init;\nvar i:integer;\nbegin\n\tf[0]:=1;\n\tf[1]:=1;\n\tfor i:=2 to 2000 do f[i]:= (f[i - 1] * i) mod base;\nend;\n\nfunction power(a,b:int64):int64;\nvar tmp:int64;\nbegin\n\tif b = 0 then exit(1);\n\tif b = 1 then exit(a);\n\ttmp:= power(a,b shr 1);\n\tif b mod 2 = 0 then power:= (tmp * tmp) mod base\n\telse power:= (((tmp * tmp) mod base) * a) mod base;\nend;\n\nfunction calc(n,k:integer):int64;\nbegin\n\tcalc:= (f[n] * power(f[k] * f[n - k], base - 2) mod base) mod base;\nend;\n\nbegin\n\treadln(n,k);\n\tinit;\n\tfor i:=1 to k do \n\t begin\n\t writeln((calc(k-1,i-1) * calc(n-k+1,i)) mod base);\n\t end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 685, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s938542180", "group_id": "codeNet:p02990", "input_text": "const base = trunc(1e9) + 7;\nvar f:array[0..2000] of int64;\n n,k,i:integer;\n re,x1,x2:int64;\n\nprocedure init;\nvar i:integer;\nbegin\n\tf[0]:=1;\n\tf[1]:=1;\n\tfor i:=2 to 2000 do f[i]:= (f[i - 1] * i) mod base;\nend;\n\nfunction power(a,b:int64):int64;\nvar tmp:int64;\nbegin\n\tif b = 0 then exit(1);\n\tif b = 1 then exit(a);\n\ttmp:= power(a,b shr 1);\n\tif b mod 2 = 0 then power:= (tmp * tmp) mod base\n\telse power:= (((tmp * tmp) mod base) * a) mod base;\nend;\n\nfunction calc(n,k:integer):int64;\nbegin\n\tcalc:= (f[n] * power(f[k] * f[n - k], base - 2) mod base) mod base;\nend;\n\nbegin\n\treadln(n,k);\n\tinit;\n\tfor i:=1 to k do \n\t begin\n\t x1:=calc(k - 1, i - 1);\n\t x2:= calc(n - k + 1, i);\n\t re:=(x1 * x2) mod base;\n\t writeln(re);\n\t end;\nend.", "language": "Pascal", "metadata": {"date": 1561862723, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s938542180.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s938542180", "user_id": "u017143931"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const base = trunc(1e9) + 7;\nvar f:array[0..2000] of int64;\n n,k,i:integer;\n re,x1,x2:int64;\n\nprocedure init;\nvar i:integer;\nbegin\n\tf[0]:=1;\n\tf[1]:=1;\n\tfor i:=2 to 2000 do f[i]:= (f[i - 1] * i) mod base;\nend;\n\nfunction power(a,b:int64):int64;\nvar tmp:int64;\nbegin\n\tif b = 0 then exit(1);\n\tif b = 1 then exit(a);\n\ttmp:= power(a,b shr 1);\n\tif b mod 2 = 0 then power:= (tmp * tmp) mod base\n\telse power:= (((tmp * tmp) mod base) * a) mod base;\nend;\n\nfunction calc(n,k:integer):int64;\nbegin\n\tcalc:= (f[n] * power(f[k] * f[n - k], base - 2) mod base) mod base;\nend;\n\nbegin\n\treadln(n,k);\n\tinit;\n\tfor i:=1 to k do \n\t begin\n\t x1:=calc(k - 1, i - 1);\n\t x2:= calc(n - k + 1, i);\n\t re:=(x1 * x2) mod base;\n\t writeln(re);\n\t end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 741, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s282081914", "group_id": "codeNet:p02996", "input_text": "{$mode Delphi}\nuses Classes, SysUtils, Fgl;\n \ntype \n pair = record first : int64; \n second : int64;\n class operator = (p1, p2 : pair) : boolean;\n end;\n pairList = TFPGList;\n \nclass operator pair.=(p1, p2 : pair): boolean;\nbegin\n result := (p1.first = p2.first) and (p1.second = p2.second);\nend;\n\nvar arr : pairList;\n n, i : integer;\n p : pair; \n now_time : int64;\n can : boolean;\n\nfunction pairCompare(const p1, p2 : pair) : int64;\nbegin\n if p1.first = p2.first then result := p1.second - p2.second\n else result := p1.first - p2.first;\nend;\n\nbegin\n arr := TFPGList.Create();\n read(n);\n for i := 0 to n-1 do begin\n read(p.second, p.first);\n arr.Add(p);\n end;\n arr.Sort(@pairCompare);\n can := true;\n for i := 0 to n-1 do begin\n now_time := now_time + arr[i].second;\n if now_time > arr[i].first then begin\n can := false;\n break;\n end;\n end;\n if can then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1562320795, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Pascal/s282081914.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s282081914", "user_id": "u878615689"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "{$mode Delphi}\nuses Classes, SysUtils, Fgl;\n \ntype \n pair = record first : int64; \n second : int64;\n class operator = (p1, p2 : pair) : boolean;\n end;\n pairList = TFPGList;\n \nclass operator pair.=(p1, p2 : pair): boolean;\nbegin\n result := (p1.first = p2.first) and (p1.second = p2.second);\nend;\n\nvar arr : pairList;\n n, i : integer;\n p : pair; \n now_time : int64;\n can : boolean;\n\nfunction pairCompare(const p1, p2 : pair) : int64;\nbegin\n if p1.first = p2.first then result := p1.second - p2.second\n else result := p1.first - p2.first;\nend;\n\nbegin\n arr := TFPGList.Create();\n read(n);\n for i := 0 to n-1 do begin\n read(p.second, p.first);\n arr.Add(p);\n end;\n arr.Sort(@pairCompare);\n can := true;\n for i := 0 to n-1 do begin\n now_time := now_time + arr[i].second;\n if now_time > arr[i].first then begin\n can := false;\n break;\n end;\n end;\n if can then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1027, "cpu_time_ms": 130, "memory_kb": 7136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s251833038", "group_id": "codeNet:p02997", "input_text": "var\n\tN,K,i,u,v:Longint;\n\tS:String;\nprocedure f(u:Longint);\nbegin\n\tif u=100 then S:=S+'100'\n\telse begin\n\t\tif u>9 then S:=S+chr(u div 10+48);\n\t\tS:=S+chr(u mod 10+48);\n\tend;\nend;\nbegin\n\tread(N,K);\n\tif (N-1)*(N-2)9 then S:=S+chr(u div 10+48);\n\t\tS:=S+chr(u mod 10+48);\n\tend;\nend;\nbegin\n\tread(N,K);\n\tif (N-1)*(N-2)s[k+1])or((s[k]=s[k+1])and(t[k]>t[k+1]))then begin\n\t\t\t\tans:=s[k];\n\t\t\t\ts[k]:=s[k+1];\n\t\t\t\ts[k+1]:=ans;\n\t\t\t\tans:=t[k];\n\t\t\t\tt[k]:=t[k+1];\n\t\t\t\tt[k+1]:=ans;\n\t\t\tend else break;\n\t\tend;\n\tend;\n\tans:=0;\n\ti:=1;\n\twhile i<=id do begin\n\t\tk:=1;\n\t\twhile(i+1<=id)and(s[i]=s[i+1])and(t[i]=t[i+1])do begin\n\t\t\tinc(k);\n\t\t\tinc(i);\n\t\tend;\n\t\tif anss[k+1])or((s[k]=s[k+1])and(t[k]>t[k+1]))then begin\n\t\t\t\tans:=s[k];\n\t\t\t\ts[k]:=s[k+1];\n\t\t\t\ts[k+1]:=ans;\n\t\t\t\tans:=t[k];\n\t\t\t\tt[k]:=t[k+1];\n\t\t\t\tt[k+1]:=ans;\n\t\t\tend else break;\n\t\tend;\n\tend;\n\tans:=0;\n\ti:=1;\n\twhile i<=id do begin\n\t\tk:=1;\n\t\twhile(i+1<=id)and(s[i]=s[i+1])and(t[i]=t[i+1])do begin\n\t\t\tinc(k);\n\t\t\tinc(i);\n\t\tend;\n\t\tif ans -1 then dp[i+1] := (dp[i+1] + dp[i]) mod remainder;\n if dp[i+2] <> -1 then dp[i+2] := (dp[i+2] + dp[i]) mod remainder;\n end;\n writeln(dp[n]);\nend.\n", "language": "Pascal", "metadata": {"date": 1560139498, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Pascal/s408362353.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s408362353", "user_id": "u878615689"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "Uses math;\nvar n, m, i, a : int64;\n dp : array[1..100010] of int64;\n remainder : int64;\nbegin\n remainder := 1000000007;\n readln(n, m);\n \n for i := 1 to 100010 do dp[i] := 0;\n for i := 1 to m do begin\n read(a);\n dp[a] := -1;\n end;\n dp[0] := 1;\n \n for i := 0 to 100005 do begin\n if dp[i] = -1 then Continue;\n if dp[i+1] <> -1 then dp[i+1] := (dp[i+1] + dp[i]) mod remainder;\n if dp[i+2] <> -1 then dp[i+2] := (dp[i+2] + dp[i]) mod remainder;\n end;\n writeln(dp[n]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 500, "cpu_time_ms": 11, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s327623918", "group_id": "codeNet:p03017", "input_text": "var\n\tN,A,B,C,D,i:Longint;\n\tS:String;\nbegin\n\treadln(N,A,B,C,D);\n\treadln(S);\n\tfor i:=A to C-1 do if(S[i]='#')and(S[i+1]='#')then begin\n\t\twriteln('No');\n\t\texit;\n\tend;\n\tfor i:=B to D-1 do if(S[i]='#')and(S[i+1]='#')then begin\n\t\twriteln('No');\n\t\texit;\n\tend;\n\tif C D then \n begin\n x:=0;\n for i := B to N-2 do\n begin \n if (S[i]=0) and (S[i+1]=0) and (S[i+2]=0) then x:=1;\n end;\n end;\n if C < D then x:=1;\n \n if x=0 then write('No') else write('Yes');\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1560883606, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Pascal/s320560127.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s320560127", "user_id": "u655683235"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "Uses math;\nvar p:char;\n A,B,C,D,N,i,x,y:integer;\n S:array[0..200010] of integer;\nbegin\nread(N,A,B,C,D);\n\nfor i := 1 to N do \n begin \n read(p); if ord(p) < 40 then S[i]:=1 else S[i]:=0; \n end;\n\nx:=1;\nfor i := 1 to max(C,D)-1 do \n begin \n if (S[i]=1) and (S[i+1]=1) then x:=0;\n end;\n \nif x=0 then write('No')\n else\n begin\n if C > D then \n begin\n x:=0;\n for i := B to N-2 do\n begin \n if (S[i]=0) and (S[i+1]=0) and (S[i+2]=0) then x:=1;\n end;\n end;\n if C < D then x:=1;\n \n if x=0 then write('No') else write('Yes');\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 574, "cpu_time_ms": 6, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s498987636", "group_id": "codeNet:p03017", "input_text": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n read(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do begin\n read(s);\n if (a<=i) and (c>=i) and (d>=i) then begin\n if (v=0) and (s='#') then ans := false;\n if s='.' then v := v + 1 else v := 0;\n if (b<=i) and (d>=i) then mv := max(v,mv)\n end\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1559529369, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Pascal/s498987636.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s498987636", "user_id": "u492212770"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n read(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do begin\n read(s);\n if (a<=i) and (c>=i) and (d>=i) then begin\n if (v=0) and (s='#') then ans := false;\n if s='.' then v := v + 1 else v := 0;\n if (b<=i) and (d>=i) then mv := max(v,mv)\n end\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 539, "cpu_time_ms": 5, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s484357739", "group_id": "codeNet:p03017", "input_text": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n read(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do\n if (a<=i) and (c>=i) and (d>=i)then begin\n read(s);\n if (v=0) and (s='#') then ans := false;\n if s='.' then v := v + 1 else v := 0;\n if (b<=i) and (d>=i) then mv := max(v,mv)\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1559528063, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Pascal/s484357739.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s484357739", "user_id": "u492212770"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n read(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do\n if (a<=i) and (c>=i) and (d>=i)then begin\n read(s);\n if (v=0) and (s='#') then ans := false;\n if s='.' then v := v + 1 else v := 0;\n if (b<=i) and (d>=i) then mv := max(v,mv)\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 528, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s490569440", "group_id": "codeNet:p03031", "input_text": "var\n\tcnt,N,M,i,j,k,s:Longint;\n\tA:array[1..10,1..10]of Boolean;\n\tP:array[1..10]of Boolean;\n\tflag,now:Boolean;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(k);\n\t\tfor j:=1 to k do begin\n\t\t\tread(s);\n\t\t\tA[i,s]:=True;\n\t\tend;\n\tend;\n\tfor i:=1 to M do begin\n\t\tread(s);\n\t\tP[i]:=s=1;\n\tend;\n\tfor i:=0 to (1<>(k-1))and 1)=1)and A[j,k]);\n\t\t\tend;\n\t\t\tif now xor P[j]then begin\n\t\t\t\tflag:=False;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif flag then inc(cnt);\n\tend;\n\twriteln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1558941542, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03031.html", "problem_id": "p03031", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03031/input.txt", "sample_output_relpath": "derived/input_output/data/p03031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03031/Pascal/s490569440.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490569440", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tcnt,N,M,i,j,k,s:Longint;\n\tA:array[1..10,1..10]of Boolean;\n\tP:array[1..10]of Boolean;\n\tflag,now:Boolean;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(k);\n\t\tfor j:=1 to k do begin\n\t\t\tread(s);\n\t\t\tA[i,s]:=True;\n\t\tend;\n\tend;\n\tfor i:=1 to M do begin\n\t\tread(s);\n\t\tP[i]:=s=1;\n\tend;\n\tfor i:=0 to (1<>(k-1))and 1)=1)and A[j,k]);\n\t\t\tend;\n\t\t\tif now xor P[j]then begin\n\t\t\t\tflag:=False;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif flag then inc(cnt);\n\tend;\n\twriteln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "sample_input": "2 2\n2 1 2\n1 2\n0 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03031", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 575, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s313856849", "group_id": "codeNet:p03031", "input_text": "var\n\tnow,cnt,N,M,i,j,k,s:Longint;\n\tA:array[1..10,1..10]of Boolean;\n\tP:array[1..10]of Longint;\n\tflag:Boolean;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(k);\n\t\tfor j:=1 to k do begin\n\t\t\tread(s);\n\t\t\tA[i,s]:=True;\n\t\tend;\n\tend;\n\tfor i:=1 to M do begin\n\t\tread(P[i]);\n\tend;\n\tfor i:=0 to (1<>k-1)mod 2=1)and A[j,k]then inc(now);\n\t\t\tend;\n\t\t\tif now mod 2<>P[j]mod 2 then begin\n\t\t\t\tflag:=False;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif flag then inc(cnt);\n\tend;\n\twriteln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1558941390, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03031.html", "problem_id": "p03031", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03031/input.txt", "sample_output_relpath": "derived/input_output/data/p03031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03031/Pascal/s313856849.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s313856849", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tnow,cnt,N,M,i,j,k,s:Longint;\n\tA:array[1..10,1..10]of Boolean;\n\tP:array[1..10]of Longint;\n\tflag:Boolean;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(k);\n\t\tfor j:=1 to k do begin\n\t\t\tread(s);\n\t\t\tA[i,s]:=True;\n\t\tend;\n\tend;\n\tfor i:=1 to M do begin\n\t\tread(P[i]);\n\tend;\n\tfor i:=0 to (1<>k-1)mod 2=1)and A[j,k]then inc(now);\n\t\t\tend;\n\t\t\tif now mod 2<>P[j]mod 2 then begin\n\t\t\t\tflag:=False;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif flag then inc(cnt);\n\tend;\n\twriteln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "sample_input": "2 2\n2 1 2\n1 2\n0 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03031", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 567, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s562713687", "group_id": "codeNet:p03032", "input_text": "var\n\tN,K,i,L,R,Lsum,Rsum,now,ans,tmp,lim:Longint;\n\tV:array[1..50]of Longint;\n\tLsorted:array[1..50]of Longint;\n\tLRsorted:array[1..50]of Longint;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(V[i]);\n\tfor L:=0 to N do begin\n\t\tif L>0 then begin\n\t\t\tLsorted[L]:=V[L];\n\t\t\tinc(Lsum,V[L]);\n\t\t\tfor i:=L-1 downto 1 do begin\n\t\t\t\tif Lsorted[i]>Lsorted[i+1]then begin\n\t\t\t\t\ttmp:=Lsorted[i];\n\t\t\t\t\tLsorted[i]:=Lsorted[i+1];\n\t\t\t\t\tLsorted[i+1]:=tmp;\n\t\t\t\tend else break;\n\t\t\tend;\n\t\tend;\n\t\tfor i:=1 to L do LRsorted[i]:=Lsorted[i];\n\t\tRsum:=Lsum;\n\t\tfor R:=N+1 downto L+1 do begin\n\t\t\tlim:=K-L-(N-R+1);\n\t\t\tif lim<0 then break;\n\t\t\tif R<=N then begin\n\t\t\t\tLRsorted[L+(N-R)+1]:=V[R];\n\t\t\t\tinc(Rsum,V[R]);\n\t\t\t\tfor i:=L+(N-R)downto 1 do begin\n\t\t\t\t\tif LRsorted[i]>LRsorted[i+1]then begin\n\t\t\t\t\t\ttmp:=LRsorted[i];\n\t\t\t\t\t\tLRsorted[i]:=LRsorted[i+1];\n\t\t\t\t\t\tLRsorted[i+1]:=tmp;\n\t\t\t\t\tend else break;\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tnow:=Rsum;\n\t\t\tfor i:=1 to lim do begin\n\t\t\t\tif LRsorted[i]<0 then dec(now,LRsorted[i])\n\t\t\t\telse break;\n\t\t\tend;\n\t\t\tif ans0 then begin\n\t\t\tLsorted[L]:=V[L];\n\t\t\tinc(Lsum,V[L]);\n\t\t\tfor i:=L-1 downto 1 do begin\n\t\t\t\tif Lsorted[i]>Lsorted[i+1]then begin\n\t\t\t\t\ttmp:=Lsorted[i];\n\t\t\t\t\tLsorted[i]:=Lsorted[i+1];\n\t\t\t\t\tLsorted[i+1]:=tmp;\n\t\t\t\tend else break;\n\t\t\tend;\n\t\tend;\n\t\tfor i:=1 to L do LRsorted[i]:=Lsorted[i];\n\t\tRsum:=Lsum;\n\t\tfor R:=N+1 downto L+1 do begin\n\t\t\tlim:=K-L-(N-R+1);\n\t\t\tif lim<0 then break;\n\t\t\tif R<=N then begin\n\t\t\t\tLRsorted[L+(N-R)+1]:=V[R];\n\t\t\t\tinc(Rsum,V[R]);\n\t\t\t\tfor i:=L+(N-R)downto 1 do begin\n\t\t\t\t\tif LRsorted[i]>LRsorted[i+1]then begin\n\t\t\t\t\t\ttmp:=LRsorted[i];\n\t\t\t\t\t\tLRsorted[i]:=LRsorted[i+1];\n\t\t\t\t\t\tLRsorted[i+1]:=tmp;\n\t\t\t\t\tend else break;\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tnow:=Rsum;\n\t\t\tfor i:=1 to lim do begin\n\t\t\t\tif LRsorted[i]<0 then dec(now,LRsorted[i])\n\t\t\t\telse break;\n\t\t\tend;\n\t\t\tif ansR then aR:=R;\nend;\nif aL>aR then writeln(0)else writeln(aR-aL+1);\nend.", "language": "Pascal", "metadata": {"date": 1582029402, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03037.html", "problem_id": "p03037", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03037/input.txt", "sample_output_relpath": "derived/input_output/data/p03037/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03037/Pascal/s318552226.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s318552226", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var N,M,i,L,R,aL,aR:Longint;\nbegin\nread(N,M);\naL:=1;\naR:=N;\nfor i:=1 to M do begin\nread(L,R);\nif aLR then aR:=R;\nend;\nif aL>aR then writeln(0)else writeln(aR-aL+1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "sample_input": "4 2\n1 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03037", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 21, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s857129427", "group_id": "codeNet:p03037", "input_text": "var N,M,x,y,z,w,i:integer;\nbegin\n read(N,M);\n x:=0;y:=0;\nfor i := 1 to M do\nbegin\n read(z,w);\n if x <= z then x:= z;\n if w <= y then y:= w;\n end;\n if y >=x then write(y-x+1);\nend.", "language": "Pascal", "metadata": {"date": 1559838336, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03037.html", "problem_id": "p03037", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03037/input.txt", "sample_output_relpath": "derived/input_output/data/p03037/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03037/Pascal/s857129427.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s857129427", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var N,M,x,y,z,w,i:integer;\nbegin\n read(N,M);\n x:=0;y:=0;\nfor i := 1 to M do\nbegin\n read(z,w);\n if x <= z then x:= z;\n if w <= y then y:= w;\n end;\n if y >=x then write(y-x+1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "sample_input": "4 2\n1 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03037", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 179, "cpu_time_ms": 21, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s441032483", "group_id": "codeNet:p03037", "input_text": "var N,M,x,y,z,w,i:integer;\nbegin\n read(N,M);\n x:=0;y:=0;\nfor i := 1 to M do\nbegin\n read(z,w);\n if x <= z then x:= z;\n if w <= y then w:= w;\n end;\n if y >=x then write(y-x+1);\nend.", "language": "Pascal", "metadata": {"date": 1559831666, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03037.html", "problem_id": "p03037", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03037/input.txt", "sample_output_relpath": "derived/input_output/data/p03037/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03037/Pascal/s441032483.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s441032483", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var N,M,x,y,z,w,i:integer;\nbegin\n read(N,M);\n x:=0;y:=0;\nfor i := 1 to M do\nbegin\n read(z,w);\n if x <= z then x:= z;\n if w <= y then w:= w;\n end;\n if y >=x then write(y-x+1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "sample_input": "4 2\n1 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03037", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 179, "cpu_time_ms": 21, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s033716407", "group_id": "codeNet:p03037", "input_text": "var i,n,m,l,r,min,max:longint;\n\nbegin\n readln(n,m);\n min:=1;\n max:=n;\n for i:=1 to m do begin\n readln(l,r);\n if l>min then min:=l;\n if rmin then min:=l;\n if r=K then begin\n\t\tans:=(N-K+1)/N;\n\t\tq:=K-1;\n\tend\n\telse q:=N;\n\tmake:=1;\n\tget:=1;\n\tfor i:=1 to 1 do begin\n\t\tif q=0 then break;\n\t\tget:=get*2;\n\t\tmake:=make*0.5;\n\t\tp:=K div get;\n\t\tif px do begin\n\t\t\tnow:=now*0.5;\n\t\t\tx:=x*2;\n\t\tend;\n\t\tans:=ans+now;\n\tend;\n\twriteln(ans:0:9);\nend.", "language": "Pascal", "metadata": {"date": 1558332192, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03043.html", "problem_id": "p03043", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03043/input.txt", "sample_output_relpath": "derived/input_output/data/p03043/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03043/Pascal/s989741637.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s989741637", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0.145833333333\n", "input_to_evaluate": "var\n\tN,K,i,p,q,x,tmp,get:Longint;\n\tans,now,make:double;\nbegin\n\tread(N,K);\n\tif N>=K then begin\n\t\tans:=(N-K+1)/N;\n\t\tq:=K-1;\n\tend\n\telse q:=N;\n\tmake:=1;\n\tget:=1;\n\tfor i:=1 to 1 do begin\n\t\tif q=0 then break;\n\t\tget:=get*2;\n\t\tmake:=make*0.5;\n\t\tp:=K div get;\n\t\tif px do begin\n\t\t\tnow:=now*0.5;\n\t\t\tx:=x*2;\n\t\tend;\n\t\tans:=ans+now;\n\tend;\n\twriteln(ans:0:9);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n\nThrow the die. The current score is the result of the die.\n\nAs long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.\n\nThe game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.\n\nYou are given N and K. Find the probability that Snuke wins the game.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n3 10\n\nSample Output 1\n\n0.145833333333\n\nIf the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^4 = \\frac{1}{48}.\n\nIf the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^3 = \\frac{1}{24}.\n\nIf the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^2 = \\frac{1}{12}.\n\nThus, the probability that Snuke wins is \\frac{1}{48} + \\frac{1}{24} + \\frac{1}{12} = \\frac{7}{48} \\simeq 0.1458333333.\n\nSample Input 2\n\n100000 5\n\nSample Output 2\n\n0.999973749998", "sample_input": "3 10\n"}, "reference_outputs": ["0.145833333333\n"], "source_document_id": "p03043", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n\nThrow the die. The current score is the result of the die.\n\nAs long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.\n\nThe game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.\n\nYou are given N and K. Find the probability that Snuke wins the game.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n3 10\n\nSample Output 1\n\n0.145833333333\n\nIf the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^4 = \\frac{1}{48}.\n\nIf the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^3 = \\frac{1}{24}.\n\nIf the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^2 = \\frac{1}{12}.\n\nThus, the probability that Snuke wins is \\frac{1}{48} + \\frac{1}{24} + \\frac{1}{12} = \\frac{7}{48} \\simeq 0.1458333333.\n\nSample Input 2\n\n100000 5\n\nSample Output 2\n\n0.999973749998", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 492, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s123091241", "group_id": "codeNet:p03048", "input_text": "var s,r,g,b,n,t:Longint;\nbegin\nread(r,g,b,n);\nif r=0 do begin\n\t\tinc(s,t div g+1);\n\t\tdec(t,b);\n\tend;\n\twriteln(s);\n\texit;\nend;\nt:=n;\nwhile True do begin\nif t<0 then begin\ndec(n,b);\nt:=n;\nif t<0 then begin\nwriteln(s);\nexit;\nend;\nend;\nif t mod r=0 then inc(s);\ndec(t,g);\nend;\nend.", "language": "Pascal", "metadata": {"date": 1576749260, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03048.html", "problem_id": "p03048", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03048/input.txt", "sample_output_relpath": "derived/input_output/data/p03048/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03048/Pascal/s123091241.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s123091241", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s,r,g,b,n,t:Longint;\nbegin\nread(r,g,b,n);\nif r=0 do begin\n\t\tinc(s,t div g+1);\n\t\tdec(t,b);\n\tend;\n\twriteln(s);\n\texit;\nend;\nt:=n;\nwhile True do begin\nif t<0 then begin\ndec(n,b);\nt:=n;\nif t<0 then begin\nwriteln(s);\nexit;\nend;\nend;\nif t mod r=0 then inc(s);\ndec(t,g);\nend;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "sample_input": "1 2 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03048", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 394, "cpu_time_ms": 12, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s430898055", "group_id": "codeNet:p03048", "input_text": "var s,r,g,b,n,t:Longint;\nbegin\nread(r,g,b,n);\nif r=0 do begin\n\t\tinc(s,t div g);\n\t\tdec(t,b);\n\tend;\n\twriteln(s);\n\texit;\nend;\nt:=n;\nwhile True do begin\nif t<0 then begin\ndec(n,b);\nt:=n;\nif t<0 then begin\nwriteln(s);\nexit;\nend;\nend;\nif t mod r=0 then inc(s);\ndec(t,g);\nend;\nend.", "language": "Pascal", "metadata": {"date": 1576749189, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03048.html", "problem_id": "p03048", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03048/input.txt", "sample_output_relpath": "derived/input_output/data/p03048/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03048/Pascal/s430898055.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s430898055", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s,r,g,b,n,t:Longint;\nbegin\nread(r,g,b,n);\nif r=0 do begin\n\t\tinc(s,t div g);\n\t\tdec(t,b);\n\tend;\n\twriteln(s);\n\texit;\nend;\nt:=n;\nwhile True do begin\nif t<0 then begin\ndec(n,b);\nt:=n;\nif t<0 then begin\nwriteln(s);\nexit;\nend;\nend;\nif t mod r=0 then inc(s);\ndec(t,g);\nend;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "sample_input": "1 2 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03048", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 392, "cpu_time_ms": 12, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s027702758", "group_id": "codeNet:p03062", "input_text": "var a:array[1..100010]of integer;\n n,i,j,m,maxm:integer;\n ans:int64;\n zero:boolean;\nbegin\n readln(n);\n m:=0;\n zero:=false;\n maxm:=-100000010;\n for i:=1 to n do begin\n read(a[i]);\n if a[i]<0 then begin\n inc(m);\n if maxmb then min:=b\n else min:=a\nend;\n\nbegin\n readln(n);\n s[0]:=0;\n for i:=1 to n do begin\n read(a);\n if a='#' then s[i]:=s[i-1]+1\n else s[i]:=s[i-1];\n end;\n ans:=210000;\n for i:=1 to n do t[i]:=s[i]+n+s[i]-i-s[n];\n for i:=1 to n do ans:=min(ans,t[i]);\n writeln(ans)\nend.\n", "language": "Pascal", "metadata": {"date": 1555868610, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Pascal/s756140995.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s756140995", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a :char;\n s,t :array[0..200010]of integer;\n n,i,j,k,ans :integer;\n \nfunction min(a,b:integer):integer;\nbegin\n if a>b then min:=b\n else min:=a\nend;\n\nbegin\n readln(n);\n s[0]:=0;\n for i:=1 to n do begin\n read(a);\n if a='#' then s[i]:=s[i-1]+1\n else s[i]:=s[i-1];\n end;\n ans:=210000;\n for i:=1 to n do t[i]:=s[i]+n+s[i]-i-s[n];\n for i:=1 to n do ans:=min(ans,t[i]);\n writeln(ans)\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 418, "cpu_time_ms": 7, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s559460093", "group_id": "codeNet:p03069", "input_text": "var a :char;\n s :array[0..200010]of integer;\n n,i,j,k,ans :integer;\n \nfunction min(a,b:integer):integer;\nbegin\n if a>b then min:=b\n else min:=a\nend;\n\nbegin\n readln(n);\n s[0]:=0;\n for i:=1 to n do begin\n read(a);\n if a='#' then s[i]:=s[i-1]+1\n else s[i]:=s[i-1];\n end;\n ans:=210000;\n j:=ans;\n for i:=2 to n do begin\n if s[i]=s[i-1] then begin\n j:=s[i]+n+s[i]-i-s[n];\n ans:=min(ans,j)\n end\n end;\n writeln(ans)\nend.\n", "language": "Pascal", "metadata": {"date": 1555868591, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Pascal/s559460093.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s559460093", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a :char;\n s :array[0..200010]of integer;\n n,i,j,k,ans :integer;\n \nfunction min(a,b:integer):integer;\nbegin\n if a>b then min:=b\n else min:=a\nend;\n\nbegin\n readln(n);\n s[0]:=0;\n for i:=1 to n do begin\n read(a);\n if a='#' then s[i]:=s[i-1]+1\n else s[i]:=s[i-1];\n end;\n ans:=210000;\n j:=ans;\n for i:=2 to n do begin\n if s[i]=s[i-1] then begin\n j:=s[i]+n+s[i]-i-s[n];\n ans:=min(ans,j)\n end\n end;\n writeln(ans)\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 467, "cpu_time_ms": 7, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s755462981", "group_id": "codeNet:p03069", "input_text": "var a :char;\n s :array[0..200010]of integer;\n n,i,j,k,ans :integer;\n \nfunction min(a,b:integer):integer;\nbegin\n if a>b then min:=b\n else min:=a\nend;\n\nbegin\n readln(n);\n s[0]:=0;\n for i:=1 to n do begin\n read(a);\n if a='#' then s[i]:=s[i-1]+1\n else s[i]:=s[i-1];\n end;\n ans:=210000;\n j:=ans;\n for i:=2 to n do begin\n if s[i]=s[i-1] then begin\n j:=s[i]+n+s[i]-i-s[n];\n ans:=min(ans,j)\n end\n end;\n writeln(ans);\n for i:=1 to n do write(s[i])\nend.", "language": "Pascal", "metadata": {"date": 1555868212, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Pascal/s755462981.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s755462981", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a :char;\n s :array[0..200010]of integer;\n n,i,j,k,ans :integer;\n \nfunction min(a,b:integer):integer;\nbegin\n if a>b then min:=b\n else min:=a\nend;\n\nbegin\n readln(n);\n s[0]:=0;\n for i:=1 to n do begin\n read(a);\n if a='#' then s[i]:=s[i-1]+1\n else s[i]:=s[i-1];\n end;\n ans:=210000;\n j:=ans;\n for i:=2 to n do begin\n if s[i]=s[i-1] then begin\n j:=s[i]+n+s[i]-i-s[n];\n ans:=min(ans,j)\n end\n end;\n writeln(ans);\n for i:=1 to n do write(s[i])\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 500, "cpu_time_ms": 31, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s094244206", "group_id": "codeNet:p03069", "input_text": "var s,t:char;\n n,i,b,w,ans:integer;\nbegin\n readln(n);\n s:='.';\n b:=0; w:=0;\n ans:=0;\n for i:=1 to n do begin\n read(t);\n if (s=t) and (t='#') then inc(b);\n if (s=t) and (t='.') then inc(w);\n if (s<>t) and (t='#') then begin\n if bt) and (t='.')then inc(w);\n s:=t\n end;\n write(ans)\n \nend.", "language": "Pascal", "metadata": {"date": 1555823468, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Pascal/s094244206.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s094244206", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s,t:char;\n n,i,b,w,ans:integer;\nbegin\n readln(n);\n s:='.';\n b:=0; w:=0;\n ans:=0;\n for i:=1 to n do begin\n read(t);\n if (s=t) and (t='#') then inc(b);\n if (s=t) and (t='.') then inc(w);\n if (s<>t) and (t='#') then begin\n if bt) and (t='.')then inc(w);\n s:=t\n end;\n write(ans)\n \nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 403, "cpu_time_ms": 6, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s683155478", "group_id": "codeNet:p03069", "input_text": "var a:char;\n flag:boolean;\n i,n,k:integer;\nbegin \n readln(n);\n k:=0;\n flag:=false;\n {for i:=1 to n do begin\n read(a);\n if a='#' then flag:=true\n else if flag then inc(k)\n end;\n }repeat\n read(a);\n if a='#' then flag:=true\n else if flag then inc(k);\n until eoln;\n write(k)\nend.\n\n", "language": "Pascal", "metadata": {"date": 1555811509, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Pascal/s683155478.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s683155478", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a:char;\n flag:boolean;\n i,n,k:integer;\nbegin \n readln(n);\n k:=0;\n flag:=false;\n {for i:=1 to n do begin\n read(a);\n if a='#' then flag:=true\n else if flag then inc(k)\n end;\n }repeat\n read(a);\n if a='#' then flag:=true\n else if flag then inc(k);\n until eoln;\n write(k)\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 7, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s776601431", "group_id": "codeNet:p03073", "input_text": "var c:char;\n n,ans:integer;\n\nfunction ifThen(p:boolean;t,f:integer):integer;\nbegin\n if p then ifThen := t else ifThen := f\nend;\n\nfunction CharToInt(c:char):integer;\nbegin\n CharToInt := Ord(c)-Ord('0')\nend;\n\nfunction eolnread:boolean;\nbegin\n if eoln then eolnread:=false else begin\n read(c);\n eolnread:=true\n end\nend;\n\nbegin\n n := 0;\n ans := 0;\n while eolnread do begin\n n := n + 1;\n ans := ans + (CharToInt(c) xor n mod 2);\n end;\n writeln(ifThen(ans*2y then write(y) else write(x);\nend.", "language": "Pascal", "metadata": {"date": 1555187410, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03073.html", "problem_id": "p03073", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03073/input.txt", "sample_output_relpath": "derived/input_output/data/p03073/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03073/Pascal/s350414463.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s350414463", "user_id": "u517105326"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a,i,n,x,y:longint;\n ch:char;\n s:string;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n do\n begin\n ch:=s[i];\n a:=ord(ch)-ord('0');\n if a=i mod 2 then inc(x) else inc(y);\n end;\n if x>y then write(y) else write(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03073", "source_text": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 250, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s217208874", "group_id": "codeNet:p03090", "input_text": "var\nn,i,j,cnt,t:Longint;\na,b:array[1..10000]of Byte;\nbegin\nread(n);\nt:=n+1-n mod 2;\nfor i:=1 to n do begin\nfor j:=i+1 to t-i-1 do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nif(j=t-i-1)or(j=t-i)then j:=t-i+1;\nfor j:=j to n do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nend;\nwriteln(cnt);\nfor i:=1 to cnt do writeln(a[i],' ',b[i]);\nend.", "language": "Pascal", "metadata": {"date": 1553383804, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03090.html", "problem_id": "p03090", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03090/input.txt", "sample_output_relpath": "derived/input_output/data/p03090/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03090/Pascal/s217208874.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s217208874", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n1 3\n2 3\n", "input_to_evaluate": "var\nn,i,j,cnt,t:Longint;\na,b:array[1..10000]of Byte;\nbegin\nread(n);\nt:=n+1-n mod 2;\nfor i:=1 to n do begin\nfor j:=i+1 to t-i-1 do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nif(j=t-i-1)or(j=t-i)then j:=t-i+1;\nfor j:=j to n do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nend;\nwriteln(cnt);\nfor i:=1 to cnt do writeln(a[i],' ',b[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "sample_input": "3\n"}, "reference_outputs": ["2\n1 3\n2 3\n"], "source_document_id": "p03090", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 334, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s382812835", "group_id": "codeNet:p03090", "input_text": "var\nn,i,j,cnt,t:Longint;\na,b:array[1..10000]of Longint;\nbegin\nread(n);\nt:=n+1-n mod 2;\nfor i:=1 to n do begin\nfor j:=i+1 to t-i-1 do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nif(j=t-i-1)or(j=t-i)then j:=t-i+1;\nfor j:=j to n do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nend;\nwriteln(cnt);\nfor i:=1 to cnt do writeln(a[i],' ',b[i]);\nend.", "language": "Pascal", "metadata": {"date": 1553383755, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03090.html", "problem_id": "p03090", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03090/input.txt", "sample_output_relpath": "derived/input_output/data/p03090/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03090/Pascal/s382812835.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s382812835", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n1 3\n2 3\n", "input_to_evaluate": "var\nn,i,j,cnt,t:Longint;\na,b:array[1..10000]of Longint;\nbegin\nread(n);\nt:=n+1-n mod 2;\nfor i:=1 to n do begin\nfor j:=i+1 to t-i-1 do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nif(j=t-i-1)or(j=t-i)then j:=t-i+1;\nfor j:=j to n do begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nend;\nwriteln(cnt);\nfor i:=1 to cnt do writeln(a[i],' ',b[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "sample_input": "3\n"}, "reference_outputs": ["2\n1 3\n2 3\n"], "source_document_id": "p03090", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 337, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s445033580", "group_id": "codeNet:p03090", "input_text": "var\nn,i,j,cnt,t:Longint;\na,b:array[1..10000]of Longint;\nbegin\nread(n);\nt:=n+1-n mod 2;\nfor i:=1 to n do begin\nfor j:=i+1 to n do begin\nif i+j<>t then begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nend;\nend;\nwriteln(cnt);\nfor i:=1 to cnt do writeln(a[i],' ',b[i]);\nend.", "language": "Pascal", "metadata": {"date": 1553383461, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03090.html", "problem_id": "p03090", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03090/input.txt", "sample_output_relpath": "derived/input_output/data/p03090/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03090/Pascal/s445033580.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s445033580", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n1 3\n2 3\n", "input_to_evaluate": "var\nn,i,j,cnt,t:Longint;\na,b:array[1..10000]of Longint;\nbegin\nread(n);\nt:=n+1-n mod 2;\nfor i:=1 to n do begin\nfor j:=i+1 to n do begin\nif i+j<>t then begin\ninc(cnt);\na[cnt]:=i;\nb[cnt]:=j;\nend;\nend;\nend;\nwriteln(cnt);\nfor i:=1 to cnt do writeln(a[i],' ',b[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "sample_input": "3\n"}, "reference_outputs": ["2\n1 3\n2 3\n"], "source_document_id": "p03090", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 264, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s993355169", "group_id": "codeNet:p03096", "input_text": "const\n MD=1000000007;\nvar\n i,n:longint;\n a,ys,xg,f:array[0..200010] of int64;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n begin\n if ys[a[i]]<>0 then xg[ys[a[i]]]:=i;\n ys[a[i]]:=i;\n end;\n f[1]:=1;\n for i:=1 to n-1 do\n begin\n f[i+1]:=(f[i+1]+f[i]) mod MD;\n if xg[i]>i+1 then f[xg[i]]:=(f[xg[i]]+f[i]) mod MD;\n end;\n writeln(f[n]);\nend.", "language": "Pascal", "metadata": {"date": 1569840751, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03096.html", "problem_id": "p03096", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03096/input.txt", "sample_output_relpath": "derived/input_output/data/p03096/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03096/Pascal/s993355169.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s993355169", "user_id": "u005813231"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n MD=1000000007;\nvar\n i,n:longint;\n a,ys,xg,f:array[0..200010] of int64;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n begin\n if ys[a[i]]<>0 then xg[ys[a[i]]]:=i;\n ys[a[i]]:=i;\n end;\n f[1]:=1;\n for i:=1 to n-1 do\n begin\n f[i+1]:=(f[i+1]+f[i]) mod MD;\n if xg[i]>i+1 then f[xg[i]]:=(f[xg[i]]+f[i]) mod MD;\n end;\n writeln(f[n]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N stones arranged in a row. The i-th stone from the left is painted in the color C_i.\n\nSnuke will perform the following operation zero or more times:\n\nChoose two stones painted in the same color. Repaint all the stones between them, with the color of the chosen stones.\n\nFind the number of possible final sequences of colors of the stones, modulo 10^9+7.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq C_i \\leq 2\\times 10^5(1\\leq i\\leq N)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nC_1\n:\nC_N\n\nOutput\n\nPrint the number of possible final sequences of colors of the stones, modulo 10^9+7.\n\nSample Input 1\n\n5\n1\n2\n1\n2\n2\n\nSample Output 1\n\n3\n\nWe can make three sequences of colors of stones, as follows:\n\n(1,2,1,2,2), by doing nothing.\n\n(1,1,1,2,2), by choosing the first and third stones to perform the operation.\n\n(1,2,2,2,2), by choosing the second and fourth stones to perform the operation.\n\nSample Input 2\n\n6\n4\n2\n5\n4\n2\n4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1\n3\n1\n2\n3\n3\n2\n\nSample Output 3\n\n5", "sample_input": "5\n1\n2\n1\n2\n2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03096", "source_text": "Score : 700 points\n\nProblem Statement\n\nThere are N stones arranged in a row. The i-th stone from the left is painted in the color C_i.\n\nSnuke will perform the following operation zero or more times:\n\nChoose two stones painted in the same color. Repaint all the stones between them, with the color of the chosen stones.\n\nFind the number of possible final sequences of colors of the stones, modulo 10^9+7.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq C_i \\leq 2\\times 10^5(1\\leq i\\leq N)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nC_1\n:\nC_N\n\nOutput\n\nPrint the number of possible final sequences of colors of the stones, modulo 10^9+7.\n\nSample Input 1\n\n5\n1\n2\n1\n2\n2\n\nSample Output 1\n\n3\n\nWe can make three sequences of colors of stones, as follows:\n\n(1,2,1,2,2), by doing nothing.\n\n(1,1,1,2,2), by choosing the first and third stones to perform the operation.\n\n(1,2,2,2,2), by choosing the second and fourth stones to perform the operation.\n\nSample Input 2\n\n6\n4\n2\n5\n4\n2\n4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1\n3\n1\n2\n3\n3\n2\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 397, "cpu_time_ms": 32, "memory_kb": 6400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s576632304", "group_id": "codeNet:p03103", "input_text": "type\n pair = record\n a : int64;\n b : integer;\n end;\n\tpairArray = array[1..100000] of pair;\nvar i,n,m:integer;\n input:pairArray;\n sum : int64;\n\nprocedure\tswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a input[i].b then begin\n sum := sum + input[i].b * input[i].a;\n m := m - input[i].b\n end else begin\n sum := sum + m * input[i].a;\n m := 0\n end;\n if m = 0 then break;\n\tend;\n writeln(sum)\nend.", "language": "Pascal", "metadata": {"date": 1552163925, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Pascal/s576632304.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s576632304", "user_id": "u492212770"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "type\n pair = record\n a : int64;\n b : integer;\n end;\n\tpairArray = array[1..100000] of pair;\nvar i,n,m:integer;\n input:pairArray;\n sum : int64;\n\nprocedure\tswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a input[i].b then begin\n sum := sum + input[i].b * input[i].a;\n m := m - input[i].b\n end else begin\n sum := sum + m * input[i].a;\n m := 0\n end;\n if m = 0 then break;\n\tend;\n writeln(sum)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1061, "cpu_time_ms": 35, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s528420050", "group_id": "codeNet:p03107", "input_text": "var c:char; r,b:integer;\nbegin\n r:=0; b:=0;\n repeat \n read(c);\n if c = '0' then r:=r+1 else b:=b+1\n until eoln;\n if r>b then write(2*b) else write(2*r)\nend.\n", "language": "Pascal", "metadata": {"date": 1551649188, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Pascal/s528420050.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s528420050", "user_id": "u805277811"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var c:char; r,b:integer;\nbegin\n r:=0; b:=0;\n repeat \n read(c);\n if c = '0' then r:=r+1 else b:=b+1\n until eoln;\n if r>b then write(2*b) else write(2*r)\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 167, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s080410871", "group_id": "codeNet:p03112", "input_text": "const\n\ttmax=100000;\n\tinf=tmax*tmax*tmax;\ntype\n\tarr=array[0..100010] of int64;\n\tnode=record\n\t\t\t\tt1,t2,tans:int64;\n\t\t\tend;\nvar\n\ts1,s2:node;\n\ta,b:arr;\n\tn,m,q,i:longint;\n\tans,t,x:int64;\nprocedure qsort(x:arr; l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=x[(l+r) div 2];\n\trepeat\n\t\twhile x[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif la[len] then exit(fill(a[len]));\n\tl:=1; r:=len;\n\twhile lmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif la[len] then exit(fill(a[len]));\n\tl:=1; r:=len;\n\twhile lmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif la[len] then exit(fill(a[len]));\n\tl:=1; r:=len;\n\twhile la[r] then\n\tbegin\n\t\tans.t1:=a[r]; \n\t\tans.t2:=a[r+1];\n\t\tif abs(x-a[r])mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif la[len] then exit(fill(a[len]));\n\tl:=1; r:=len;\n\twhile la[r] then\n\tbegin\n\t\tans.t1:=a[r]; \n\t\tans.t2:=a[r+1];\n\t\tif abs(x-a[r])mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt[a[j+1]]) or (t[a[j]]=t[a[j+1]]) and (a[j]0 do\n\tbegin\n\t\twhile f[n-t[a[t1]]] do\n\t\tbegin\n\t\t\tn:=n-t[a[t1]];\n\t\t\tinc(cnt); ans[cnt]:=a[t1];\n\t\tend;\n\t\tinc(t1);\n\tend;\n\tqsort(1,cnt);\n\tfor i:=cnt downto 1 do write(ans[i]);\n\twriteln;\nend.", "language": "Pascal", "metadata": {"date": 1550372042, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03128.html", "problem_id": "p03128", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03128/input.txt", "sample_output_relpath": "derived/input_output/data/p03128/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03128/Pascal/s039687114.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s039687114", "user_id": "u957998623"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "const\n\tt:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\tn,m,min,t1,i,j,cnt:longint;\n\ta:array[0..10] of longint;\n\tans:array[0..5000] of longint;\n\tf:array[0..10010] of boolean;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=ans[(l+r) div 2];\n\trepeat\n\t\twhile ans[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt[a[j+1]]) or (t[a[j]]=t[a[j+1]]) and (a[j]0 do\n\tbegin\n\t\twhile f[n-t[a[t1]]] do\n\t\tbegin\n\t\t\tn:=n-t[a[t1]];\n\t\t\tinc(cnt); ans[cnt]:=a[t1];\n\t\tend;\n\t\tinc(t1);\n\tend;\n\tqsort(1,cnt);\n\tfor i:=cnt downto 1 do write(ans[i]);\n\twriteln;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "sample_input": "20 4\n3 7 8 4\n"}, "reference_outputs": ["777773\n"], "source_document_id": "p03128", "source_text": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1181, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s991791094", "group_id": "codeNet:p03139", "input_text": "var n,a,b,left,right:integer;\nbegin\nreadln(n,a,b);\nif(a+b>=n)then left:=a+b-n else left:=0;\nif(a>=b)then right:=b else right:=a;\nwriteln(left,' ',right);\nend.", "language": "Pascal", "metadata": {"date": 1599235577, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03139.html", "problem_id": "p03139", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03139/input.txt", "sample_output_relpath": "derived/input_output/data/p03139/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03139/Pascal/s991791094.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s991791094", "user_id": "u984276646"}, "prompt_components": {"gold_output": "3 0\n", "input_to_evaluate": "var n,a,b,left,right:integer;\nbegin\nreadln(n,a,b);\nif(a+b>=n)then left:=a+b-n else left:=0;\nif(a>=b)then right:=b else right:=a;\nwriteln(left,' ',right);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe conducted a survey on newspaper subscriptions.\nMore specifically, we asked each of the N respondents the following two questions:\n\nQuestion 1: Are you subscribing to Newspaper X?\n\nQuestion 2: Are you subscribing to Newspaper Y?\n\nAs the result, A respondents answered \"yes\" to Question 1, and B respondents answered \"yes\" to Question 2.\n\nWhat are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?\n\nWrite a program to answer this question.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N\n\n0 \\leq B \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the maximum possible number and the minimum possible number of respondents subscribing to both newspapers, in this order, with a space in between.\n\nSample Input 1\n\n10 3 5\n\nSample Output 1\n\n3 0\n\nIn this sample, out of the 10 respondents, 3 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.\n\nHere, the number of respondents subscribing to both newspapers is at most 3 and at least 0.\n\nSample Input 2\n\n10 7 5\n\nSample Output 2\n\n5 2\n\nIn this sample, out of the 10 respondents, 7 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.\n\nHere, the number of respondents subscribing to both newspapers is at most 5 and at least 2.\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n100 100", "sample_input": "10 3 5\n"}, "reference_outputs": ["3 0\n"], "source_document_id": "p03139", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe conducted a survey on newspaper subscriptions.\nMore specifically, we asked each of the N respondents the following two questions:\n\nQuestion 1: Are you subscribing to Newspaper X?\n\nQuestion 2: Are you subscribing to Newspaper Y?\n\nAs the result, A respondents answered \"yes\" to Question 1, and B respondents answered \"yes\" to Question 2.\n\nWhat are the maximum possible number and the minimum possible number of respondents subscribing to both newspapers X and Y?\n\nWrite a program to answer this question.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N\n\n0 \\leq B \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the maximum possible number and the minimum possible number of respondents subscribing to both newspapers, in this order, with a space in between.\n\nSample Input 1\n\n10 3 5\n\nSample Output 1\n\n3 0\n\nIn this sample, out of the 10 respondents, 3 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.\n\nHere, the number of respondents subscribing to both newspapers is at most 3 and at least 0.\n\nSample Input 2\n\n10 7 5\n\nSample Output 2\n\n5 2\n\nIn this sample, out of the 10 respondents, 7 answered they are subscribing to Newspaper X, and 5 answered they are subscribing to Newspaper Y.\n\nHere, the number of respondents subscribing to both newspapers is at most 5 and at least 2.\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n100 100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 4, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s518313335", "group_id": "codeNet:p03158", "input_text": "var\n a,b:array[0..100002]of longint;\n i,j,k,n,m:longint;\n p,q,ans,anq:qword;\nfunction max(a,b:longint):longint;\nbegin\n if abs(a)<=b then exit(a)\n else exit(b);\nend;\nprocedure zx(s:longint);\nvar\n i,j,p,q,t,u,o:longint;\n f:array[0..100002]of boolean;\nbegin\n for i:=1 to n do\n if a[i]>s then break;\n p:=i-1;\n q:=i;\n t:=n;\n j:=n div 2;\n while j>0 do\n begin\n dec(j);\n f[t]:=true;\n dec(t);\n if p=0 then begin ans:=a[q]+ans; inc(q); end\n else if f[q] then begin ans:=a[p]+ans; dec(p,2); end\n else if s-a[p]>=q-s then\n begin\n ans:=a[p]+ans;\n dec(p);\n end else\n begin\n ans:=a[q]+ans;\n inc(q);\n end;\n end;\nend;\nbegin\n readln(n,m);\n for i:=1 to n do begin read(a[i]); anq:=a[i]+anq; end;\n for i:=1 to m do\n begin\n readln(b[i]);\n ans:=0;\n zx(b[i]);\n writeln(anq-ans);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1547329091, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03158.html", "problem_id": "p03158", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03158/input.txt", "sample_output_relpath": "derived/input_output/data/p03158/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03158/Pascal/s518313335.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s518313335", "user_id": "u380619494"}, "prompt_components": {"gold_output": "31\n31\n27\n23\n23\n", "input_to_evaluate": "var\n a,b:array[0..100002]of longint;\n i,j,k,n,m:longint;\n p,q,ans,anq:qword;\nfunction max(a,b:longint):longint;\nbegin\n if abs(a)<=b then exit(a)\n else exit(b);\nend;\nprocedure zx(s:longint);\nvar\n i,j,p,q,t,u,o:longint;\n f:array[0..100002]of boolean;\nbegin\n for i:=1 to n do\n if a[i]>s then break;\n p:=i-1;\n q:=i;\n t:=n;\n j:=n div 2;\n while j>0 do\n begin\n dec(j);\n f[t]:=true;\n dec(t);\n if p=0 then begin ans:=a[q]+ans; inc(q); end\n else if f[q] then begin ans:=a[p]+ans; dec(p,2); end\n else if s-a[p]>=q-s then\n begin\n ans:=a[p]+ans;\n dec(p);\n end else\n begin\n ans:=a[q]+ans;\n inc(q);\n end;\n end;\nend;\nbegin\n readln(n,m);\n for i:=1 to n do begin read(a[i]); anq:=a[i]+anq; end;\n for i:=1 to m do\n begin\n readln(b[i]);\n ans:=0;\n zx(b[i]);\n writeln(anq-ans);\n end;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N cards. The i-th card has an integer A_i written on it.\nFor any two cards, the integers on those cards are different.\n\nUsing these cards, Takahashi and Aoki will play the following game:\n\nAoki chooses an integer x.\n\nStarting from Takahashi, the two players alternately take a card. The card should be chosen in the following manner:\n\nTakahashi should take the card with the largest integer among the remaining card.\n\nAoki should take the card with the integer closest to x among the remaining card. If there are multiple such cards, he should take the card with the smallest integer among those cards.\n\nThe game ends when there is no card remaining.\n\nYou are given Q candidates for the value of x: X_1, X_2, ..., X_Q.\nFor each i (1 \\leq i \\leq Q), find the sum of the integers written on the cards that Takahashi will take if Aoki chooses x = X_i.\n\nConstraints\n\n2 \\leq N \\leq 100 000\n\n1 \\leq Q \\leq 100 000\n\n1 \\leq A_1 < A_2 < ... < A_N \\leq 10^9\n\n1 \\leq X_i \\leq 10^9 (1 \\leq i \\leq Q)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nA_1 A_2 ... A_N\nX_1\nX_2\n:\nX_Q\n\nOutput\n\nPrint Q lines. The i-th line (1 \\leq i \\leq Q) should contain the answer for x = X_i.\n\nSample Input 1\n\n5 5\n3 5 7 11 13\n1\n4\n9\n10\n13\n\nSample Output 1\n\n31\n31\n27\n23\n23\n\nFor example, when x = X_3(= 9), the game proceeds as follows:\n\nTakahashi takes the card with 13.\n\nAoki takes the card with 7.\n\nTakahashi takes the card with 11.\n\nAoki takes the card with 5.\n\nTakahashi takes the card with 3.\n\nThus, 13 + 11 + 3 = 27 should be printed on the third line.\n\nSample Input 2\n\n4 3\n10 20 30 40\n2\n34\n34\n\nSample Output 2\n\n70\n60\n60", "sample_input": "5 5\n3 5 7 11 13\n1\n4\n9\n10\n13\n"}, "reference_outputs": ["31\n31\n27\n23\n23\n"], "source_document_id": "p03158", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N cards. The i-th card has an integer A_i written on it.\nFor any two cards, the integers on those cards are different.\n\nUsing these cards, Takahashi and Aoki will play the following game:\n\nAoki chooses an integer x.\n\nStarting from Takahashi, the two players alternately take a card. The card should be chosen in the following manner:\n\nTakahashi should take the card with the largest integer among the remaining card.\n\nAoki should take the card with the integer closest to x among the remaining card. If there are multiple such cards, he should take the card with the smallest integer among those cards.\n\nThe game ends when there is no card remaining.\n\nYou are given Q candidates for the value of x: X_1, X_2, ..., X_Q.\nFor each i (1 \\leq i \\leq Q), find the sum of the integers written on the cards that Takahashi will take if Aoki chooses x = X_i.\n\nConstraints\n\n2 \\leq N \\leq 100 000\n\n1 \\leq Q \\leq 100 000\n\n1 \\leq A_1 < A_2 < ... < A_N \\leq 10^9\n\n1 \\leq X_i \\leq 10^9 (1 \\leq i \\leq Q)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nA_1 A_2 ... A_N\nX_1\nX_2\n:\nX_Q\n\nOutput\n\nPrint Q lines. The i-th line (1 \\leq i \\leq Q) should contain the answer for x = X_i.\n\nSample Input 1\n\n5 5\n3 5 7 11 13\n1\n4\n9\n10\n13\n\nSample Output 1\n\n31\n31\n27\n23\n23\n\nFor example, when x = X_3(= 9), the game proceeds as follows:\n\nTakahashi takes the card with 13.\n\nAoki takes the card with 7.\n\nTakahashi takes the card with 11.\n\nAoki takes the card with 5.\n\nTakahashi takes the card with 3.\n\nThus, 13 + 11 + 3 = 27 should be printed on the third line.\n\nSample Input 2\n\n4 3\n10 20 30 40\n2\n34\n34\n\nSample Output 2\n\n70\n60\n60", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 850, "cpu_time_ms": 2103, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s978709761", "group_id": "codeNet:p03162", "input_text": "uses crt;\nvar a,b,c:array[1..100000] of longint;\n i,n:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n clrscr;\n readln(n);\n for i := 1 to n do readln(a[i],b[i],c[i]);\n for i:=2 to n do \n begin\n a[i]:=max(a[i-1],max(b[i-1],c[i-1])+a[i]);\n b[i]:=max(b[i-1],max(a[i-1],c[i-1])+b[i]);\n c[i]:=max(c[i-1],max(a[i-1],b[i-1])+c[i]);\n end;\n writeln(max(a[n],max(c[n],b[n])));\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1565481509, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03162.html", "problem_id": "p03162", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03162/input.txt", "sample_output_relpath": "derived/input_output/data/p03162/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03162/Pascal/s978709761.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978709761", "user_id": "u805448247"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nvar a,b,c:array[1..100000] of longint;\n i,n:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n clrscr;\n readln(n);\n for i := 1 to n do readln(a[i],b[i],c[i]);\n for i:=2 to n do \n begin\n a[i]:=max(a[i-1],max(b[i-1],c[i-1])+a[i]);\n b[i]:=max(b[i-1],max(a[i-1],c[i-1])+b[i]);\n c[i]:=max(c[i-1],max(a[i-1],b[i-1])+c[i]);\n end;\n writeln(max(a[n],max(c[n],b[n])));\n readln;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "sample_input": "3\n10 40 70\n20 50 80\n30 60 90\n"}, "reference_outputs": ["210\n"], "source_document_id": "p03162", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 493, "cpu_time_ms": 36, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s570199745", "group_id": "codeNet:p03162", "input_text": "//ac\nuses math;\nvar\n a,b,c:array[0..101010] of qword;\n dp:array[1..3,0..101010] of qword;\n n,i:longint;\nfunction max(u,v:qword):qword;\n BEGIN\n if u>v then exit(u);\n exit(v);\n end;\nBEGIN\n ///assign(input,'a.in'); reset(input);\n readln(n);\n for i:=1 to n do read(a[i], b[i], c[i]);\n\n fillchar(dp,sizeof(dp),0);\n for i:=1 to n do BEGIN\n dp[1,i] := max(dp[1,i-1], max(dp[2,i-1], dp[3,i-1]) + a[i]);\n dp[2,i] := max(dp[2,i-1], max(dp[1,i-1], dp[3,i-1]) + b[i]);\n dp[3,i] := max(dp[3,i-1], max(dp[1,i-1], dp[2,i-1]) + c[i]);\n end;\n writeln(max(dp[1,n], max(dp[2,n], dp[3,n])));\nEND.", "language": "Pascal", "metadata": {"date": 1546808692, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03162.html", "problem_id": "p03162", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03162/input.txt", "sample_output_relpath": "derived/input_output/data/p03162/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03162/Pascal/s570199745.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s570199745", "user_id": "u480821607"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "//ac\nuses math;\nvar\n a,b,c:array[0..101010] of qword;\n dp:array[1..3,0..101010] of qword;\n n,i:longint;\nfunction max(u,v:qword):qword;\n BEGIN\n if u>v then exit(u);\n exit(v);\n end;\nBEGIN\n ///assign(input,'a.in'); reset(input);\n readln(n);\n for i:=1 to n do read(a[i], b[i], c[i]);\n\n fillchar(dp,sizeof(dp),0);\n for i:=1 to n do BEGIN\n dp[1,i] := max(dp[1,i-1], max(dp[2,i-1], dp[3,i-1]) + a[i]);\n dp[2,i] := max(dp[2,i-1], max(dp[1,i-1], dp[3,i-1]) + b[i]);\n dp[3,i] := max(dp[3,i-1], max(dp[1,i-1], dp[2,i-1]) + c[i]);\n end;\n writeln(max(dp[1,n], max(dp[2,n], dp[3,n])));\nEND.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "sample_input": "3\n10 40 70\n20 50 80\n30 60 90\n"}, "reference_outputs": ["210\n"], "source_document_id": "p03162", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 603, "cpu_time_ms": 42, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s874074500", "group_id": "codeNet:p03164", "input_text": "var N, W, V, i, j: longint;\n ww, vv: array[1..1000] of longint;\n dp, weight: array[-10..100, -11000..100000] of longint;\nbegin\n readln(N, W);\n for i:=1 to N do\n begin\n readln(ww[i], vv[i]);\n V:=V+vv[i];\n end;\n for i:=1 to N do\n begin\n for j:=1 to V do\n begin\n if (weight[i-1,j-vv[i]]+ww[i]>W) then\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if (dp[i-1,j-vv[i]]+vv[i]<=j) then\n begin\n if (dp[i-1,j]>dp[i-1,j-vv[i]]+vv[i]) and (dp[i-1,j]>dp[i,j-1]) then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else if (dp[i-1,j-vv[i]]+vv[i]>=dp[i-1,j]) and (dp[i-1,j-vv[i]]+vv[i]>=dp[i,j-1]) then\n begin\n dp[i,j]:=dp[i-1,j-vv[i]]+vv[i];\n weight[i,j]:=weight[i-1,j-vv[i]]+ww[i];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end;\n end;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,V]);\nend.", "language": "Pascal", "metadata": {"date": 1589023486, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s874074500.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s874074500", "user_id": "u816631826"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "var N, W, V, i, j: longint;\n ww, vv: array[1..1000] of longint;\n dp, weight: array[-10..100, -11000..100000] of longint;\nbegin\n readln(N, W);\n for i:=1 to N do\n begin\n readln(ww[i], vv[i]);\n V:=V+vv[i];\n end;\n for i:=1 to N do\n begin\n for j:=1 to V do\n begin\n if (weight[i-1,j-vv[i]]+ww[i]>W) then\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if (dp[i-1,j-vv[i]]+vv[i]<=j) then\n begin\n if (dp[i-1,j]>dp[i-1,j-vv[i]]+vv[i]) and (dp[i-1,j]>dp[i,j-1]) then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else if (dp[i-1,j-vv[i]]+vv[i]>=dp[i-1,j]) and (dp[i-1,j-vv[i]]+vv[i]>=dp[i,j-1]) then\n begin\n dp[i,j]:=dp[i-1,j-vv[i]]+vv[i];\n weight[i,j]:=weight[i-1,j-vv[i]]+ww[i];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end;\n end;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,V]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1981, "cpu_time_ms": 153, "memory_kb": 90368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s268319431", "group_id": "codeNet:p03164", "input_text": "var N, W, V, i, j: longint;\n ww, vv: array[1..1000] of longint;\n dp, weight: array[0..100, -1100..100000] of longint;\nbegin\n readln(N, W);\n for i:=1 to N do\n begin\n readln(ww[i], vv[i]);\n V:=V+vv[i];\n end;\n for i:=1 to N do\n begin\n for j:=1 to V do\n begin\n if (weight[i-1,j-vv[i]]+ww[i]>W) then\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if (dp[i-1,j-vv[i]]+vv[i]<=j) then\n begin\n if dp[i-1,j]>dp[i-1,j-vv[i]]+vv[i] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i-1,j-vv[i]]+vv[i];\n weight[i,j]:=weight[i-1,j-vv[i]]+ww[i];\n end;\n end\n else\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end;\n end;\n end;\n end;\n writeln(dp[N,V]);\nend.", "language": "Pascal", "metadata": {"date": 1589022163, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s268319431.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s268319431", "user_id": "u863370423"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "var N, W, V, i, j: longint;\n ww, vv: array[1..1000] of longint;\n dp, weight: array[0..100, -1100..100000] of longint;\nbegin\n readln(N, W);\n for i:=1 to N do\n begin\n readln(ww[i], vv[i]);\n V:=V+vv[i];\n end;\n for i:=1 to N do\n begin\n for j:=1 to V do\n begin\n if (weight[i-1,j-vv[i]]+ww[i]>W) then\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if (dp[i-1,j-vv[i]]+vv[i]<=j) then\n begin\n if dp[i-1,j]>dp[i-1,j-vv[i]]+vv[i] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i-1,j-vv[i]]+vv[i];\n weight[i,j]:=weight[i-1,j-vv[i]]+ww[i];\n end;\n end\n else\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end;\n end;\n end;\n end;\n writeln(dp[N,V]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1417, "cpu_time_ms": 113, "memory_kb": 79488}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s883881767", "group_id": "codeNet:p03164", "input_text": "program knapsack1;\n\nuses math;\n\nconst\n fi='knapsack1.inp';\n fo='knapsack1.out';\n oo=trunc(1e9)+5;\n\nvar\n n,m,va: longint;\n v,w: array[0..100000] of int16;\n f:array[0..100,0..100000] of int32;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n va:=0;\n read(n,m);\n for i:=1 to n do begin\n read(w[i],v[i]);\n inc(va,v[i]);\n end;\n\nend;\n\nprocedure xuli;\nvar i,j,ans: longint;\nbegin\n\n ans:=0;\n for i:=0 to n do begin\n for j:=0 to va do f[i][j]:=oo;\n end;\n\n f[0][0]:=0;\n\n for i:=1 to n do begin\n for j:=0 to va do begin\n if (j>=v[i]) and (f[i-1][j-v[i]]+w[i]<=m) then f[i][j]:=min(f[i-1][j],f[i-1][j-v[i]]+w[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n\n for j:=0 to va do begin\n ans:=ifthen((f[n][j]<=m),j,ans);\n end;\n//\n// for i:=0 to n do begin\n// for j:=0 to va do begin\n// if f[i][j]=oo then write('oo':3)\n// else write(f[i][j]:3);\n// end;\n// writeln\n// end;\n\n write(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n // close(input); close(output);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577013295, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s883881767.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s883881767", "user_id": "u762868299"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "program knapsack1;\n\nuses math;\n\nconst\n fi='knapsack1.inp';\n fo='knapsack1.out';\n oo=trunc(1e9)+5;\n\nvar\n n,m,va: longint;\n v,w: array[0..100000] of int16;\n f:array[0..100,0..100000] of int32;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n va:=0;\n read(n,m);\n for i:=1 to n do begin\n read(w[i],v[i]);\n inc(va,v[i]);\n end;\n\nend;\n\nprocedure xuli;\nvar i,j,ans: longint;\nbegin\n\n ans:=0;\n for i:=0 to n do begin\n for j:=0 to va do f[i][j]:=oo;\n end;\n\n f[0][0]:=0;\n\n for i:=1 to n do begin\n for j:=0 to va do begin\n if (j>=v[i]) and (f[i-1][j-v[i]]+w[i]<=m) then f[i][j]:=min(f[i-1][j],f[i-1][j-v[i]]+w[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n\n for j:=0 to va do begin\n ans:=ifthen((f[n][j]<=m),j,ans);\n end;\n//\n// for i:=0 to n do begin\n// for j:=0 to va do begin\n// if f[i][j]=oo then write('oo':3)\n// else write(f[i][j]:3);\n// end;\n// writeln\n// end;\n\n write(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n // close(input); close(output);\n\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1078, "cpu_time_ms": 71, "memory_kb": 39680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s162736823", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=200000;\nvar n,w:int32;\n maxval:uint64;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint32;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int64):int64;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n-1 do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 0 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577012940, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s162736823.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s162736823", "user_id": "u801427196"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=200000;\nvar n,w:int32;\n maxval:uint64;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint32;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int64):int64;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n-1 do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 0 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1148, "cpu_time_ms": 50, "memory_kb": 77568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s364161857", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=200000;\nvar n,w:int32;\n maxval:uint64;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint32;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int64):int64;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 0 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577012858, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s364161857.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s364161857", "user_id": "u801427196"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=200000;\nvar n,w:int32;\n maxval:uint64;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint32;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int64):int64;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 0 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1146, "cpu_time_ms": 414, "memory_kb": 338944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s493553841", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='CAITUI2.INP';\n fo='CAITUI2.OUT';\n maxn=100;\n maxj=trunc(1e5);\n oo=trunc(1e9)+7;\n\nvar n,mw:longint;\n w,v:array[1..maxn] of longint;\n\n f:array[0..maxn,0..maxj] of longint;\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n,mw);\n\n for i:=1 to n do readln(w[i],v[i]);\nend;\n//============================\nprocedure xuli;\nvar i,j:longint;\nbegin\n\n for i:=0 to n do\n for j:=0 to n*1000 do f[i,j]:=oo;\n\n f[0,0]:=0;\n\n for i:=0 to n-1 do\n for j:=0 to n*1000 do\n if f[i,j]<>oo then\n begin\n\n //if f[i,j]+w[i+1]>mw then\n\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n\n //writeln(i,' ',j,' ',f[i,j],' ',i+1,' ',f[i+1,j]);\n\n if f[i,j]+w[i+1]<=mw then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+w[i+1]);\n\n end;\n\n for j:=n*1000 downto 1 do\n if f[n,j]<=mw then break;\n\n {for i:=0 to n do\n for j:=0 to n+1000 do\n writeln(i,' ',j,' ',f[i,j]);}\n\n write(j);\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "language": "Pascal", "metadata": {"date": 1577012709, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s493553841.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s493553841", "user_id": "u383373065"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='CAITUI2.INP';\n fo='CAITUI2.OUT';\n maxn=100;\n maxj=trunc(1e5);\n oo=trunc(1e9)+7;\n\nvar n,mw:longint;\n w,v:array[1..maxn] of longint;\n\n f:array[0..maxn,0..maxj] of longint;\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n,mw);\n\n for i:=1 to n do readln(w[i],v[i]);\nend;\n//============================\nprocedure xuli;\nvar i,j:longint;\nbegin\n\n for i:=0 to n do\n for j:=0 to n*1000 do f[i,j]:=oo;\n\n f[0,0]:=0;\n\n for i:=0 to n-1 do\n for j:=0 to n*1000 do\n if f[i,j]<>oo then\n begin\n\n //if f[i,j]+w[i+1]>mw then\n\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n\n //writeln(i,' ',j,' ',f[i,j],' ',i+1,' ',f[i+1,j]);\n\n if f[i,j]+w[i+1]<=mw then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+w[i+1]);\n\n end;\n\n for j:=n*1000 downto 1 do\n if f[n,j]<=mw then break;\n\n {for i:=0 to n do\n for j:=0 to n+1000 do\n writeln(i,' ',j,' ',f[i,j]);}\n\n write(j);\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1159, "cpu_time_ms": 48, "memory_kb": 39680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s381424240", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=200000;\nvar n,w:int32;\n maxval:uint64;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int64):int64;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\n ans:uint64;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n assign(input,fi); reset(input);\n assign(output,fo); rewrite(output);\n nhap;\n xuli;\n close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577012265, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s381424240.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s381424240", "user_id": "u801427196"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=200000;\nvar n,w:int32;\n maxval:uint64;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int64):int64;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\n ans:uint64;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n assign(input,fi); reset(input);\n assign(output,fo); rewrite(output);\n nhap;\n xuli;\n close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1156, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s098280530", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=100000;\nvar n,w,maxval:int32;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int32):int32;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j,ans:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577012114, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s098280530.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s098280530", "user_id": "u801427196"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=100000;\nvar n,w,maxval:int32;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int32):int32;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j,ans:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if f[i,j]+we[i+1]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1138, "cpu_time_ms": 422, "memory_kb": 344448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s541418979", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=100000;\nvar n,w,maxval:int32;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int32):int32;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j,ans:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if j+we[i]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577010927, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s541418979.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s541418979", "user_id": "u801427196"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=100000;\nvar n,w,maxval:int32;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int32):int32;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j,ans:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n if j+we[i]<=w then\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1131, "cpu_time_ms": 411, "memory_kb": 339712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s773382732", "group_id": "codeNet:p03164", "input_text": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=100000;\nvar n,w,maxval:int32;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int32):int32;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j,ans:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577010230, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Pascal/s773382732.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s773382732", "user_id": "u801427196"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses math;\nconst fi='knapsack2.inp';\n fo='knapsack2.out';\n maxn=100;\n maxv=100000;\nvar n,w,maxval:int32;\n we,v:array[1..maxn] of uint32;\n f:array[0..maxn,0..maxv] of uint64;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,w); maxval:=0;\n for i:=1 to n do\n begin\n readln(we[i],v[i]);\n maxval:=maxval+v[i];\n end;\nend;\n//=============================\nfunction min(x,y:int32):int32;\nbegin\n if x>y then exit(y)\n else exit(x);\nend;\n//=============================\nprocedure xuli;\nvar i,j,ans:int32;\nbegin\n for i:=0 to n do\n for j:=0 to maxval do f[i,j]:=maxlongint;\n f[0,0]:=0;\n for i:=0 to n do\n for j:=0 to maxval do\n if f[i,j]<>maxlongint then\n begin\n f[i+1,j]:=min(f[i+1,j],f[i,j]);\n f[i+1,j+v[i+1]]:=min(f[i+1,j+v[i+1]],f[i,j]+we[i+1]);\n end;\n for i:=maxval downto 1 do\n if f[n,i]<=w then break;\n write(i);\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1103, "cpu_time_ms": 421, "memory_kb": 344448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s181283288", "group_id": "codeNet:p03164", "input_text": " var F:array[0..100000] of int64;\n W,V:array[0..100000] of longint;\n i,n,m,t:longint; f1:text; max:int64;\n\n function min(x,y:int64):int64;\n begin\n if x= 0 then\n begin\n cr:= i - x[j];\n if cs[cr] = 2 then cs[i]:= 1;\n end;\n\n end;\n\n If cs[k] = 2 then write ('Second') else write ('First');\n readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1584250610, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03170.html", "problem_id": "p03170", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03170/input.txt", "sample_output_relpath": "derived/input_output/data/p03170/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03170/Pascal/s729197381.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s729197381", "user_id": "u428668906"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "uses crt;\nvar\n // f: text;\n x,cs: array [0..100000] of longint;\n i,j,n,k,cr: longint;\n\nbegin\n // assign (f, fi); reset(f);\n readln ( n,k);\n for i:=1 to n do read ( x[i]);\n\n for i:=0 to k do cs[i]:=2;\n\n for i:=x[1] to k do\n for j:=1 to n do\n begin\n if i - x[j] >= 0 then\n begin\n cr:= i - x[j];\n if cs[cr] = 2 then cs[i]:= 1;\n end;\n\n end;\n\n If cs[k] = 2 then write ('Second') else write ('First');\n readln;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "sample_input": "2 4\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03170", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 542, "cpu_time_ms": 38, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s528687412", "group_id": "codeNet:p03170", "input_text": "const fi='STONE.INP';\n fo='STONE.OUT';\n maxn=100;\n maxk=trunc(1e5);\n\nvar n,k:longint;\n a:array[1..maxn] of longint;\n f:array[0..maxk] of 0..1; {f=0-> thua, f=1->thang}\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n,k);\n\n for i:=1 to n do read(a[i]);\nend;\n//============================\nprocedure xuli;\nvar i,j:longint;\n ok:boolean;\nbegin\n fillchar(f,sizeof(f),0);\n\n for i:=1 to k do\n begin\n if (i=a[j]) then\n begin\n if (f[i-a[j]]=1) then continue;\n ok:=true; break;\n end;\n end;\n\n if ok then f[i]:=1 else f[i]:=0;\n end;\n\n if f[k]=1 then write('First')\n else write('Second');\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "language": "Pascal", "metadata": {"date": 1577038306, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03170.html", "problem_id": "p03170", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03170/input.txt", "sample_output_relpath": "derived/input_output/data/p03170/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03170/Pascal/s528687412.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s528687412", "user_id": "u383373065"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "const fi='STONE.INP';\n fo='STONE.OUT';\n maxn=100;\n maxk=trunc(1e5);\n\nvar n,k:longint;\n a:array[1..maxn] of longint;\n f:array[0..maxk] of 0..1; {f=0-> thua, f=1->thang}\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n,k);\n\n for i:=1 to n do read(a[i]);\nend;\n//============================\nprocedure xuli;\nvar i,j:longint;\n ok:boolean;\nbegin\n fillchar(f,sizeof(f),0);\n\n for i:=1 to k do\n begin\n if (i=a[j]) then\n begin\n if (f[i-a[j]]=1) then continue;\n ok:=true; break;\n end;\n end;\n\n if ok then f[i]:=1 else f[i]:=0;\n end;\n\n if f[k]=1 then write('First')\n else write('Second');\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "sample_input": "2 4\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03170", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 986, "cpu_time_ms": 9, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s211117513", "group_id": "codeNet:p03170", "input_text": "const fi='STONE.INP';\n fo='STONE.OUT';\n maxn=100;\n maxk=trunc(1e5);\n\nvar n,k:longint;\n a:array[1..maxn] of longint;\n f:array[0..maxk] of 0..1; {f=0-> thua, f=1->thang}\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n,k);\n\n for i:=1 to n do read(a[i]);\nend;\n//============================\nprocedure xuli;\nvar i,j:longint;\n ok:boolean;\nbegin\n fillchar(f,sizeof(f),0);\n\n for i:=1 to k do\n begin\n if (i=a[j]) then\n begin\n if (f[i-a[j]]=0) then continue;\n ok:=false; break;\n end;\n end;\n\n if ok then f[i]:=1 else f[i]:=0;\n end;\n\n if f[k]=1 then write('First')\n else write('Second');\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "language": "Pascal", "metadata": {"date": 1577038064, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03170.html", "problem_id": "p03170", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03170/input.txt", "sample_output_relpath": "derived/input_output/data/p03170/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03170/Pascal/s211117513.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s211117513", "user_id": "u383373065"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "const fi='STONE.INP';\n fo='STONE.OUT';\n maxn=100;\n maxk=trunc(1e5);\n\nvar n,k:longint;\n a:array[1..maxn] of longint;\n f:array[0..maxk] of 0..1; {f=0-> thua, f=1->thang}\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n,k);\n\n for i:=1 to n do read(a[i]);\nend;\n//============================\nprocedure xuli;\nvar i,j:longint;\n ok:boolean;\nbegin\n fillchar(f,sizeof(f),0);\n\n for i:=1 to k do\n begin\n if (i=a[j]) then\n begin\n if (f[i-a[j]]=0) then continue;\n ok:=false; break;\n end;\n end;\n\n if ok then f[i]:=1 else f[i]:=0;\n end;\n\n if f[k]=1 then write('First')\n else write('Second');\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "sample_input": "2 4\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03170", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 986, "cpu_time_ms": 9, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s425463246", "group_id": "codeNet:p03170", "input_text": "uses math;\nconst fi='kstones.inp';\n fo='kstones.out';\n maxn=100;\nvar n,k,mmin:int32;\n a:array[1..maxn] of int32;\n f:array[0..100000] of boolean;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,k);\n mmin:=maxlongint;\n for i:=1 to n do\n begin read(a[i]); mmin:=min(mmin,a[i]); end;\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\n ok:boolean;\nbegin\n fillchar(f,sizeof(f),false);\n for i:=mmin to k do\n begin\n ok:=false;\n for j:=1 to n do\n if i>=a[j] then\n if not f[i-a[j]] then\n begin\n ok:=true; break;\n end;\n f[i]:=ok;\n end;\n if f[k] then write('First') else write('Second');\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1577037570, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03170.html", "problem_id": "p03170", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03170/input.txt", "sample_output_relpath": "derived/input_output/data/p03170/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03170/Pascal/s425463246.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s425463246", "user_id": "u801427196"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "uses math;\nconst fi='kstones.inp';\n fo='kstones.out';\n maxn=100;\nvar n,k,mmin:int32;\n a:array[1..maxn] of int32;\n f:array[0..100000] of boolean;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n,k);\n mmin:=maxlongint;\n for i:=1 to n do\n begin read(a[i]); mmin:=min(mmin,a[i]); end;\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\n ok:boolean;\nbegin\n fillchar(f,sizeof(f),false);\n for i:=mmin to k do\n begin\n ok:=false;\n for j:=1 to n do\n if i>=a[j] then\n if not f[i-a[j]] then\n begin\n ok:=true; break;\n end;\n f[i]:=ok;\n end;\n if f[k] then write('First') else write('Second');\nend;\n//=============================\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo); rewrite(output);\n nhap;\n xuli;\n// close(input); close(output);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "sample_input": "2 4\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03170", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 868, "cpu_time_ms": 9, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s828973250", "group_id": "codeNet:p03171", "input_text": "uses math;\n{\nconst\n fi = 'test.inp';\n fo = 'test.out';\n}\nvar\n// f: Text;\n a,b: array [0..4000] of int64;\n dp: array [0..4000, 0..4000] of int64;\n i,j,n: longint;\n x,y: int64;\n\nbegin\n// assign (f, fi); reset (F);\n readln (n);\n for i:= 1 to n do\n begin\n read ( a[i]);\n\n end;\n// close (f);\n\n // assign (F, fo); rewrite (f);\n\n for i:=n downto 1 do\n for j:=i to n do\n begin\n if i = j then dp[i,j]:= a[i]\n else\n dp[i,j]:= max( a[i] - dp[i+1,j], a[j] - dp[i,j-1]);\n end;\n\n write ( dp[1,n]);\n readln;\n // close (f);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1588546974, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03171.html", "problem_id": "p03171", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03171/input.txt", "sample_output_relpath": "derived/input_output/data/p03171/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03171/Pascal/s828973250.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s828973250", "user_id": "u428668906"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "uses math;\n{\nconst\n fi = 'test.inp';\n fo = 'test.out';\n}\nvar\n// f: Text;\n a,b: array [0..4000] of int64;\n dp: array [0..4000, 0..4000] of int64;\n i,j,n: longint;\n x,y: int64;\n\nbegin\n// assign (f, fi); reset (F);\n readln (n);\n for i:= 1 to n do\n begin\n read ( a[i]);\n\n end;\n// close (f);\n\n // assign (F, fo); rewrite (f);\n\n for i:=n downto 1 do\n for j:=i to n do\n begin\n if i = j then dp[i,j]:= a[i]\n else\n dp[i,j]:= max( a[i] - dp[i+1,j], a[j] - dp[i,j-1]);\n end;\n\n write ( dp[1,n]);\n readln;\n // close (f);\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "sample_input": "4\n10 80 90 30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03171", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 719, "cpu_time_ms": 46, "memory_kb": 95744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s981455033", "group_id": "codeNet:p03171", "input_text": "uses crt;\n{\nconst\n fi = 'test.inp';\n fo = 'test.out';\n}\nvar\n f: Text;\n a,b: array [0..4000] of int64;\n// dp: array [0..1000, 0..1000] of longint;\n i,j,n: longint;\n x,y: int64;\n\nbegin\n// assign (f, fi); reset (F);\n readln (n);\n for i:= 1 to n do\n begin\n read ( a[i]);\n\n end;\n // close (f);\n\n // assign (F, fo); rewrite (f);\n j:=0;\n for i:=1 to n do\n begin\n inc(j);\n b[j]:= a[i];\n\n if ( j - 3 >= 0 ) then\n\n if ( b[j-1] > b[j] ) and (b[j-1] > b[j-2]) then\n begin\n b[j-2]:= b[j-2] +b[j] - b[j-1];\n j:= j-2;\n end;\n\n end;\n\n i:=1;\n\n while i <= j do\n begin\n if b[i] > b[j] then\n begin\n x:= x + b[i]; inc(i);\n end else\n begin\n x:= x + b[j]; dec(j);\n end;\n\n if i > j then break;\n if b[i] > b[j] then\n begin\n y:= y + b[i]; inc(i);\n end else\n begin\n y:= y + b[j]; dec(j);\n end;\n end;\n\n // for i:=1 to n do write (f, b[i], ' '); writeln (f);\n write (x- y);\n readln;\n // close (f);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1588546114, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03171.html", "problem_id": "p03171", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03171/input.txt", "sample_output_relpath": "derived/input_output/data/p03171/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03171/Pascal/s981455033.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s981455033", "user_id": "u428668906"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "uses crt;\n{\nconst\n fi = 'test.inp';\n fo = 'test.out';\n}\nvar\n f: Text;\n a,b: array [0..4000] of int64;\n// dp: array [0..1000, 0..1000] of longint;\n i,j,n: longint;\n x,y: int64;\n\nbegin\n// assign (f, fi); reset (F);\n readln (n);\n for i:= 1 to n do\n begin\n read ( a[i]);\n\n end;\n // close (f);\n\n // assign (F, fo); rewrite (f);\n j:=0;\n for i:=1 to n do\n begin\n inc(j);\n b[j]:= a[i];\n\n if ( j - 3 >= 0 ) then\n\n if ( b[j-1] > b[j] ) and (b[j-1] > b[j-2]) then\n begin\n b[j-2]:= b[j-2] +b[j] - b[j-1];\n j:= j-2;\n end;\n\n end;\n\n i:=1;\n\n while i <= j do\n begin\n if b[i] > b[j] then\n begin\n x:= x + b[i]; inc(i);\n end else\n begin\n x:= x + b[j]; dec(j);\n end;\n\n if i > j then break;\n if b[i] > b[j] then\n begin\n y:= y + b[i]; inc(i);\n end else\n begin\n y:= y + b[j]; dec(j);\n end;\n end;\n\n // for i:=1 to n do write (f, b[i], ' '); writeln (f);\n write (x- y);\n readln;\n // close (f);\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "sample_input": "4\n10 80 90 30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03171", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1463, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s015747868", "group_id": "codeNet:p03171", "input_text": "uses math;\nconst fi='DEQUE.INP';\n fo='DEQUE.OUT';\n maxn=3000;\n\nvar n:longint;\n a:array[1..maxn] of longint;\n s:array[0..maxn] of int64;\n f:array[1..maxn,1..maxn] of int64;\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n);\n\n for i:=1 to n do read(a[i]);\n\nend;\n//============================\nprocedure tinhs;\nvar i:longint;\nbegin\n s[0]:=0;\n s[1]:=a[1];\n for i:=2 to n do s[i]:=s[i-1]+a[i];\nend;\n//============================\nfunction sum(i,j:longint):int64;\nbegin\n sum:=s[j]-s[i-1];\nend;\n//============================\nprocedure xuli;\nvar l,r,i:longint;\nbegin\n tinhs;\n\n for i:=1 to n do f[i,i]:=a[i];\n\n for l:=1 to n-1 do\n for r:=l+1 to n do\n f[l,r]:=max(sum(l,r)-f[l+1,r],sum(l,r)-f[l,r-1]);\n\n write(f[1,n]-(sum(1,n)-f[1,n]));\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "language": "Pascal", "metadata": {"date": 1577040141, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03171.html", "problem_id": "p03171", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03171/input.txt", "sample_output_relpath": "derived/input_output/data/p03171/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03171/Pascal/s015747868.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s015747868", "user_id": "u383373065"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "uses math;\nconst fi='DEQUE.INP';\n fo='DEQUE.OUT';\n maxn=3000;\n\nvar n:longint;\n a:array[1..maxn] of longint;\n s:array[0..maxn] of int64;\n f:array[1..maxn,1..maxn] of int64;\n//============================\nprocedure doc;\nvar i:longint;\nbegin\n readln(n);\n\n for i:=1 to n do read(a[i]);\n\nend;\n//============================\nprocedure tinhs;\nvar i:longint;\nbegin\n s[0]:=0;\n s[1]:=a[1];\n for i:=2 to n do s[i]:=s[i-1]+a[i];\nend;\n//============================\nfunction sum(i,j:longint):int64;\nbegin\n sum:=s[j]-s[i-1];\nend;\n//============================\nprocedure xuli;\nvar l,r,i:longint;\nbegin\n tinhs;\n\n for i:=1 to n do f[i,i]:=a[i];\n\n for l:=1 to n-1 do\n for r:=l+1 to n do\n f[l,r]:=max(sum(l,r)-f[l+1,r],sum(l,r)-f[l,r-1]);\n\n write(f[1,n]-(sum(1,n)-f[1,n]));\nend;\n//============================\nBEGIN\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n doc;\n xuli;\n //close(input); close(output);\nEND.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "sample_input": "4\n10 80 90 30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03171", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 964, "cpu_time_ms": 43, "memory_kb": 69632}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s895809832", "group_id": "codeNet:p03171", "input_text": "program LDeque;\n\nuses math;\n\nconst\n fi='LDeque.inp';\n fo='LDeque.out';\n\nvar\n n: longint;\n a:array[0..3000] of int64;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n readln(n);\n for i:=1 to n do read(a[i]);\n\nend;\n\nprocedure xuli;\nvar i,j: longint; k:boolean; ans:int64;\nbegin\n\n i:=1; j:=n; k:=true;\n ans:=0;\n repeat\n if a[i]>a[j] then begin\n ans:=ifthen(k,ans+a[i],ans-a[j]);\n inc(i);\n end else begin\n ans:=ifthen(k,ans+a[j],ans-a[j]);\n dec(j);\n end;\n k:=not(k);\n until i>j;\n\n writeln(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reseT(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577038113, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03171.html", "problem_id": "p03171", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03171/input.txt", "sample_output_relpath": "derived/input_output/data/p03171/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03171/Pascal/s895809832.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s895809832", "user_id": "u762868299"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program LDeque;\n\nuses math;\n\nconst\n fi='LDeque.inp';\n fo='LDeque.out';\n\nvar\n n: longint;\n a:array[0..3000] of int64;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n readln(n);\n for i:=1 to n do read(a[i]);\n\nend;\n\nprocedure xuli;\nvar i,j: longint; k:boolean; ans:int64;\nbegin\n\n i:=1; j:=n; k:=true;\n ans:=0;\n repeat\n if a[i]>a[j] then begin\n ans:=ifthen(k,ans+a[i],ans-a[j]);\n inc(i);\n end else begin\n ans:=ifthen(k,ans+a[j],ans-a[j]);\n dec(j);\n end;\n k:=not(k);\n until i>j;\n\n writeln(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reseT(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "sample_input": "4\n10 80 90 30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03171", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 688, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s679699446", "group_id": "codeNet:p03172", "input_text": "var a: array[1..1000] of longint;\n dp, p: array[-10..150, -110000..200000] of longint; \n i, j, N, K: longint;\nbegin\n readln(N, K);\n for i:=1 to N do\n read(a[i]);\n for i:=0 to a[1] do\n begin\n dp[1,i]:=1;\n end;\n for i:=0 to K do\n p[1,i]:=p[1,i-1]+dp[1,i];\n for i:=2 to N do\n begin\n for j:=0 to K do\n begin\n dp[i,j]:=(p[i-1,j]-p[i-1,j-a[i]-1]) mod 1000000007;\n if dp[i,j]<0 then\n dp[i,j]:=dp[i,j]+1000000007;\n p[i,j]:=(p[i,j-1]+dp[i,j]) mod 1000000007;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,K]);\nend.", "language": "Pascal", "metadata": {"date": 1589935098, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03172.html", "problem_id": "p03172", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03172/input.txt", "sample_output_relpath": "derived/input_output/data/p03172/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03172/Pascal/s679699446.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s679699446", "user_id": "u020129571"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var a: array[1..1000] of longint;\n dp, p: array[-10..150, -110000..200000] of longint; \n i, j, N, K: longint;\nbegin\n readln(N, K);\n for i:=1 to N do\n read(a[i]);\n for i:=0 to a[1] do\n begin\n dp[1,i]:=1;\n end;\n for i:=0 to K do\n p[1,i]:=p[1,i-1]+dp[1,i];\n for i:=2 to N do\n begin\n for j:=0 to K do\n begin\n dp[i,j]:=(p[i-1,j]-p[i-1,j-a[i]-1]) mod 1000000007;\n if dp[i,j]<0 then\n dp[i,j]:=dp[i,j]+1000000007;\n p[i,j]:=(p[i,j-1]+dp[i,j]) mod 1000000007;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,K]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, \\ldots, N.\n\nThey have decided to share K candies among themselves.\nHere, for each i (1 \\leq i \\leq N), Child i must receive between 0 and a_i candies (inclusive).\nAlso, no candies should be left over.\n\nFind the number of ways for them to share candies, modulo 10^9 + 7.\nHere, two ways are said to be different when there exists a child who receives a different number of candies.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq K \\leq 10^5\n\n0 \\leq a_i \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the number of ways for the children to share candies, modulo 10^9 + 7.\n\nSample Input 1\n\n3 4\n1 2 3\n\nSample Output 1\n\n5\n\nThere are five ways for the children to share candies, as follows:\n\n(0, 1, 3)\n\n(0, 2, 2)\n\n(1, 0, 3)\n\n(1, 1, 2)\n\n(1, 2, 1)\n\nHere, in each sequence, the i-th element represents the number of candies that Child i receives.\n\nSample Input 2\n\n1 10\n9\n\nSample Output 2\n\n0\n\nThere may be no ways for the children to share candies.\n\nSample Input 3\n\n2 0\n0 0\n\nSample Output 3\n\n1\n\nThere is one way for the children to share candies, as follows:\n\n(0, 0)\n\nSample Input 4\n\n4 100000\n100000 100000 100000 100000\n\nSample Output 4\n\n665683269\n\nBe sure to print the answer modulo 10^9 + 7.", "sample_input": "3 4\n1 2 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03172", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, \\ldots, N.\n\nThey have decided to share K candies among themselves.\nHere, for each i (1 \\leq i \\leq N), Child i must receive between 0 and a_i candies (inclusive).\nAlso, no candies should be left over.\n\nFind the number of ways for them to share candies, modulo 10^9 + 7.\nHere, two ways are said to be different when there exists a child who receives a different number of candies.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq K \\leq 10^5\n\n0 \\leq a_i \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the number of ways for the children to share candies, modulo 10^9 + 7.\n\nSample Input 1\n\n3 4\n1 2 3\n\nSample Output 1\n\n5\n\nThere are five ways for the children to share candies, as follows:\n\n(0, 1, 3)\n\n(0, 2, 2)\n\n(1, 0, 3)\n\n(1, 1, 2)\n\n(1, 2, 1)\n\nHere, in each sequence, the i-th element represents the number of candies that Child i receives.\n\nSample Input 2\n\n1 10\n9\n\nSample Output 2\n\n0\n\nThere may be no ways for the children to share candies.\n\nSample Input 3\n\n2 0\n0 0\n\nSample Output 3\n\n1\n\nThere is one way for the children to share candies, as follows:\n\n(0, 0)\n\nSample Input 4\n\n4 100000\n100000 100000 100000 100000\n\nSample Output 4\n\n665683269\n\nBe sure to print the answer modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 668, "cpu_time_ms": 348, "memory_kb": 245888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s643577747", "group_id": "codeNet:p03172", "input_text": "var a: array[1..1000] of longint;\n dp, p: array[-10..150, -110000..200000] of longint; \n i, j, N, K: longint;\nbegin\n readln(N, K);\n for i:=1 to N do\n read(a[i]);\n for i:=0 to a[1] do\n begin\n dp[1,i]:=1;\n end;\n for i:=0 to K do\n p[1,i]:=p[1,i-1]+dp[1,i];\n for i:=2 to N do\n begin\n for j:=0 to K do\n begin\n dp[i,j]:=(p[i-1,j]-p[i-1,j-a[i]-1]) mod 1000000007;\n p[i,j]:=(p[i,j-1]+dp[i,j]) mod 1000000007;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,K]);\nend.", "language": "Pascal", "metadata": {"date": 1589934768, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03172.html", "problem_id": "p03172", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03172/input.txt", "sample_output_relpath": "derived/input_output/data/p03172/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03172/Pascal/s643577747.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s643577747", "user_id": "u020129571"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var a: array[1..1000] of longint;\n dp, p: array[-10..150, -110000..200000] of longint; \n i, j, N, K: longint;\nbegin\n readln(N, K);\n for i:=1 to N do\n read(a[i]);\n for i:=0 to a[1] do\n begin\n dp[1,i]:=1;\n end;\n for i:=0 to K do\n p[1,i]:=p[1,i-1]+dp[1,i];\n for i:=2 to N do\n begin\n for j:=0 to K do\n begin\n dp[i,j]:=(p[i-1,j]-p[i-1,j-a[i]-1]) mod 1000000007;\n p[i,j]:=(p[i,j-1]+dp[i,j]) mod 1000000007;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,K]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, \\ldots, N.\n\nThey have decided to share K candies among themselves.\nHere, for each i (1 \\leq i \\leq N), Child i must receive between 0 and a_i candies (inclusive).\nAlso, no candies should be left over.\n\nFind the number of ways for them to share candies, modulo 10^9 + 7.\nHere, two ways are said to be different when there exists a child who receives a different number of candies.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq K \\leq 10^5\n\n0 \\leq a_i \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the number of ways for the children to share candies, modulo 10^9 + 7.\n\nSample Input 1\n\n3 4\n1 2 3\n\nSample Output 1\n\n5\n\nThere are five ways for the children to share candies, as follows:\n\n(0, 1, 3)\n\n(0, 2, 2)\n\n(1, 0, 3)\n\n(1, 1, 2)\n\n(1, 2, 1)\n\nHere, in each sequence, the i-th element represents the number of candies that Child i receives.\n\nSample Input 2\n\n1 10\n9\n\nSample Output 2\n\n0\n\nThere may be no ways for the children to share candies.\n\nSample Input 3\n\n2 0\n0 0\n\nSample Output 3\n\n1\n\nThere is one way for the children to share candies, as follows:\n\n(0, 0)\n\nSample Input 4\n\n4 100000\n100000 100000 100000 100000\n\nSample Output 4\n\n665683269\n\nBe sure to print the answer modulo 10^9 + 7.", "sample_input": "3 4\n1 2 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03172", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, \\ldots, N.\n\nThey have decided to share K candies among themselves.\nHere, for each i (1 \\leq i \\leq N), Child i must receive between 0 and a_i candies (inclusive).\nAlso, no candies should be left over.\n\nFind the number of ways for them to share candies, modulo 10^9 + 7.\nHere, two ways are said to be different when there exists a child who receives a different number of candies.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq K \\leq 10^5\n\n0 \\leq a_i \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the number of ways for the children to share candies, modulo 10^9 + 7.\n\nSample Input 1\n\n3 4\n1 2 3\n\nSample Output 1\n\n5\n\nThere are five ways for the children to share candies, as follows:\n\n(0, 1, 3)\n\n(0, 2, 2)\n\n(1, 0, 3)\n\n(1, 1, 2)\n\n(1, 2, 1)\n\nHere, in each sequence, the i-th element represents the number of candies that Child i receives.\n\nSample Input 2\n\n1 10\n9\n\nSample Output 2\n\n0\n\nThere may be no ways for the children to share candies.\n\nSample Input 3\n\n2 0\n0 0\n\nSample Output 3\n\n1\n\nThere is one way for the children to share candies, as follows:\n\n(0, 0)\n\nSample Input 4\n\n4 100000\n100000 100000 100000 100000\n\nSample Output 4\n\n665683269\n\nBe sure to print the answer modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 593, "cpu_time_ms": 313, "memory_kb": 245888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s444540359", "group_id": "codeNet:p03187", "input_text": "var\n n,i,j:longint;\n flag:boolean;\n l,s,loc,dis:int64;\n a:array[1..1000000]of longint;\nbegin\n readln(l,n);\n for i:=1 to n do read(a[i]);\n i:=1;j:=n;\n if a[1]>=(l-a[n]+1) \n then \n begin \n\t loc:=1;\n\t dis:=a[1];\n\t i:=2;\n\t flag:=true;\n\tend \n else \n begin \n j:=j-1;\n\t loc:=n;\n\t dis:=l-a[n]+1;\n\t flag:=false;\n\tend;\n //write(dis,' ');\n while s=(a[loc]+l-a[j])\n\t then \n\t\t begin \n\t\t\tdis:=dis+a[i]-a[loc];\n\t\t\tflag:=true;\n\t\t\tloc:=i;\n\t\t\tinc(i);\n\t\t\t//write(dis,' ');\n\t end\n\t\t else\n\t\t begin\n\t\t\t dis:=dis+a[loc]+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\t //write(dis,' ');\n\t\t\tend\n\t\telse\n\t\t if (a[i]+l-a[loc])>=(a[loc]-a[j])\n\t\t then\n\t\t\tbegin \n\t\t\t dis:=dis+a[i]+l-a[loc];\n\t\t\t flag:=true;\n\t\t\t loc:=i;\n\t\t\t inc(i);\n\t\t\t //write(dis,' ');\n\t end\n\t\t else \n\t\t begin\n\t\t\t dis:=dis+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\t //write(dis,' ');\n\t\t\tend;\n end;\n writeln(dis-1);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1546140660, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03187.html", "problem_id": "p03187", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03187/input.txt", "sample_output_relpath": "derived/input_output/data/p03187/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03187/Pascal/s444540359.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s444540359", "user_id": "u380619494"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "var\n n,i,j:longint;\n flag:boolean;\n l,s,loc,dis:int64;\n a:array[1..1000000]of longint;\nbegin\n readln(l,n);\n for i:=1 to n do read(a[i]);\n i:=1;j:=n;\n if a[1]>=(l-a[n]+1) \n then \n begin \n\t loc:=1;\n\t dis:=a[1];\n\t i:=2;\n\t flag:=true;\n\tend \n else \n begin \n j:=j-1;\n\t loc:=n;\n\t dis:=l-a[n]+1;\n\t flag:=false;\n\tend;\n //write(dis,' ');\n while s=(a[loc]+l-a[j])\n\t then \n\t\t begin \n\t\t\tdis:=dis+a[i]-a[loc];\n\t\t\tflag:=true;\n\t\t\tloc:=i;\n\t\t\tinc(i);\n\t\t\t//write(dis,' ');\n\t end\n\t\t else\n\t\t begin\n\t\t\t dis:=dis+a[loc]+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\t //write(dis,' ');\n\t\t\tend\n\t\telse\n\t\t if (a[i]+l-a[loc])>=(a[loc]-a[j])\n\t\t then\n\t\t\tbegin \n\t\t\t dis:=dis+a[i]+l-a[loc];\n\t\t\t flag:=true;\n\t\t\t loc:=i;\n\t\t\t inc(i);\n\t\t\t //write(dis,' ');\n\t end\n\t\t else \n\t\t begin\n\t\t\t dis:=dis+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\t //write(dis,' ');\n\t\t\tend;\n end;\n writeln(dis-1);\n readln(i);\nend.", "problem_context": "Score : 800 points\n\nProblem Statement\n\nTakahashi Lake has a perimeter of L. On the circumference of the lake, there is a residence of the lake's owner, Takahashi.\nEach point on the circumference of the lake has a coordinate between 0 and L (including 0 but not L), which is the distance from the Takahashi's residence, measured counter-clockwise.\n\nThere are N trees around the lake; the coordinate of the i-th tree is X_i. There is no tree at coordinate 0, the location of Takahashi's residence.\n\nStarting at his residence, Takahashi will repeat the following action:\n\nIf all trees are burnt, terminate the process.\n\nSpecify a direction: clockwise or counter-clockwise.\n\nWalk around the lake in the specified direction, until the coordinate of a tree that is not yet burnt is reached for the first time.\n\nWhen the coordinate with the tree is reached, burn that tree, stay at the position and go back to the first step.\n\nFind the longest possible total distance Takahashi walks during the process.\n\nPartial Score\n\nA partial score can be obtained in this problem:\n\n300 points will be awarded for passing the input satisfying N \\leq 2000.\n\nConstraints\n\n2 \\leq L \\leq 10^9\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq X_1 < ... < X_N \\leq L-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL N\nX_1\n:\nX_N\n\nOutput\n\nPrint the longest possible total distance Takahashi walks during the process.\n\nSample Input 1\n\n10 3\n2\n7\n9\n\nSample Output 1\n\n15\n\nTakahashi walks the distance of 15 if the process goes as follows:\n\nWalk a distance of 2 counter-clockwise, burn the tree at the coordinate 2 and stay there.\n\nWalk a distance of 5 counter-clockwise, burn the tree at the coordinate 7 and stay there.\n\nWalk a distance of 8 clockwise, burn the tree at the coordinate 9 and stay there.\n\nSample Input 2\n\n10 6\n1\n2\n3\n6\n7\n9\n\nSample Output 2\n\n27\n\nSample Input 3\n\n314159265 7\n21662711\n77271666\n89022761\n156626166\n160332356\n166902656\n298992265\n\nSample Output 3\n\n1204124749", "sample_input": "10 3\n2\n7\n9\n"}, "reference_outputs": ["15\n"], "source_document_id": "p03187", "source_text": "Score : 800 points\n\nProblem Statement\n\nTakahashi Lake has a perimeter of L. On the circumference of the lake, there is a residence of the lake's owner, Takahashi.\nEach point on the circumference of the lake has a coordinate between 0 and L (including 0 but not L), which is the distance from the Takahashi's residence, measured counter-clockwise.\n\nThere are N trees around the lake; the coordinate of the i-th tree is X_i. There is no tree at coordinate 0, the location of Takahashi's residence.\n\nStarting at his residence, Takahashi will repeat the following action:\n\nIf all trees are burnt, terminate the process.\n\nSpecify a direction: clockwise or counter-clockwise.\n\nWalk around the lake in the specified direction, until the coordinate of a tree that is not yet burnt is reached for the first time.\n\nWhen the coordinate with the tree is reached, burn that tree, stay at the position and go back to the first step.\n\nFind the longest possible total distance Takahashi walks during the process.\n\nPartial Score\n\nA partial score can be obtained in this problem:\n\n300 points will be awarded for passing the input satisfying N \\leq 2000.\n\nConstraints\n\n2 \\leq L \\leq 10^9\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq X_1 < ... < X_N \\leq L-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL N\nX_1\n:\nX_N\n\nOutput\n\nPrint the longest possible total distance Takahashi walks during the process.\n\nSample Input 1\n\n10 3\n2\n7\n9\n\nSample Output 1\n\n15\n\nTakahashi walks the distance of 15 if the process goes as follows:\n\nWalk a distance of 2 counter-clockwise, burn the tree at the coordinate 2 and stay there.\n\nWalk a distance of 5 counter-clockwise, burn the tree at the coordinate 7 and stay there.\n\nWalk a distance of 8 clockwise, burn the tree at the coordinate 9 and stay there.\n\nSample Input 2\n\n10 6\n1\n2\n3\n6\n7\n9\n\nSample Output 2\n\n27\n\nSample Input 3\n\n314159265 7\n21662711\n77271666\n89022761\n156626166\n160332356\n166902656\n298992265\n\nSample Output 3\n\n1204124749", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1020, "cpu_time_ms": 31, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s811153818", "group_id": "codeNet:p03187", "input_text": "var\n n,i,l,s,loc,dis,j:longint;\n flag:boolean;\n a:array[1..1000000]of longint;\nbegin\n readln(l,n);\n for i:=1 to n do read(a[i]);\n i:=1;j:=n;\n if a[1]>=(l-a[n]+1) \n then \n begin \n\t loc:=1;\n\t dis:=a[1];\n\t i:=2;\n\t flag:=true;\n\tend \n else \n begin \n j:=j-1;\n\t loc:=n;\n\t dis:=l-a[n]+1;\n\t flag:=false;\n\tend;\n while s=(a[loc]+l-a[j])\n\t then \n\t\t begin \n\t\t\tdis:=dis+a[i]-a[loc];\n\t\t\tflag:=true;\n\t\t\tloc:=i;\n\t\t\tinc(i);\n\t end\n\t\t else\n\t\t begin\n\t\t\t dis:=dis+a[loc]+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\tend\n\t\telse\n\t\t if (a[i]+l-a[loc])>=(a[loc]-a[j])\n\t\t then\n\t\t\tbegin \n\t\t\t dis:=dis+a[i]+l-a[loc];\n\t\t\t flag:=true;\n\t\t\t loc:=i;\n\t\t\t inc(i);\n\t end\n\t\t else \n\t\t begin\n\t\t\t dis:=dis+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\tend;\n end;\n writeln(dis);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1546139643, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03187.html", "problem_id": "p03187", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03187/input.txt", "sample_output_relpath": "derived/input_output/data/p03187/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03187/Pascal/s811153818.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s811153818", "user_id": "u380619494"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "var\n n,i,l,s,loc,dis,j:longint;\n flag:boolean;\n a:array[1..1000000]of longint;\nbegin\n readln(l,n);\n for i:=1 to n do read(a[i]);\n i:=1;j:=n;\n if a[1]>=(l-a[n]+1) \n then \n begin \n\t loc:=1;\n\t dis:=a[1];\n\t i:=2;\n\t flag:=true;\n\tend \n else \n begin \n j:=j-1;\n\t loc:=n;\n\t dis:=l-a[n]+1;\n\t flag:=false;\n\tend;\n while s=(a[loc]+l-a[j])\n\t then \n\t\t begin \n\t\t\tdis:=dis+a[i]-a[loc];\n\t\t\tflag:=true;\n\t\t\tloc:=i;\n\t\t\tinc(i);\n\t end\n\t\t else\n\t\t begin\n\t\t\t dis:=dis+a[loc]+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\tend\n\t\telse\n\t\t if (a[i]+l-a[loc])>=(a[loc]-a[j])\n\t\t then\n\t\t\tbegin \n\t\t\t dis:=dis+a[i]+l-a[loc];\n\t\t\t flag:=true;\n\t\t\t loc:=i;\n\t\t\t inc(i);\n\t end\n\t\t else \n\t\t begin\n\t\t\t dis:=dis+l-a[j];\n\t\t\t flag:=false;\n\t\t\t loc:=j;\n\t\t\t dec(j);\n\t\t\tend;\n end;\n writeln(dis);\n readln(i);\nend.", "problem_context": "Score : 800 points\n\nProblem Statement\n\nTakahashi Lake has a perimeter of L. On the circumference of the lake, there is a residence of the lake's owner, Takahashi.\nEach point on the circumference of the lake has a coordinate between 0 and L (including 0 but not L), which is the distance from the Takahashi's residence, measured counter-clockwise.\n\nThere are N trees around the lake; the coordinate of the i-th tree is X_i. There is no tree at coordinate 0, the location of Takahashi's residence.\n\nStarting at his residence, Takahashi will repeat the following action:\n\nIf all trees are burnt, terminate the process.\n\nSpecify a direction: clockwise or counter-clockwise.\n\nWalk around the lake in the specified direction, until the coordinate of a tree that is not yet burnt is reached for the first time.\n\nWhen the coordinate with the tree is reached, burn that tree, stay at the position and go back to the first step.\n\nFind the longest possible total distance Takahashi walks during the process.\n\nPartial Score\n\nA partial score can be obtained in this problem:\n\n300 points will be awarded for passing the input satisfying N \\leq 2000.\n\nConstraints\n\n2 \\leq L \\leq 10^9\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq X_1 < ... < X_N \\leq L-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL N\nX_1\n:\nX_N\n\nOutput\n\nPrint the longest possible total distance Takahashi walks during the process.\n\nSample Input 1\n\n10 3\n2\n7\n9\n\nSample Output 1\n\n15\n\nTakahashi walks the distance of 15 if the process goes as follows:\n\nWalk a distance of 2 counter-clockwise, burn the tree at the coordinate 2 and stay there.\n\nWalk a distance of 5 counter-clockwise, burn the tree at the coordinate 7 and stay there.\n\nWalk a distance of 8 clockwise, burn the tree at the coordinate 9 and stay there.\n\nSample Input 2\n\n10 6\n1\n2\n3\n6\n7\n9\n\nSample Output 2\n\n27\n\nSample Input 3\n\n314159265 7\n21662711\n77271666\n89022761\n156626166\n160332356\n166902656\n298992265\n\nSample Output 3\n\n1204124749", "sample_input": "10 3\n2\n7\n9\n"}, "reference_outputs": ["15\n"], "source_document_id": "p03187", "source_text": "Score : 800 points\n\nProblem Statement\n\nTakahashi Lake has a perimeter of L. On the circumference of the lake, there is a residence of the lake's owner, Takahashi.\nEach point on the circumference of the lake has a coordinate between 0 and L (including 0 but not L), which is the distance from the Takahashi's residence, measured counter-clockwise.\n\nThere are N trees around the lake; the coordinate of the i-th tree is X_i. There is no tree at coordinate 0, the location of Takahashi's residence.\n\nStarting at his residence, Takahashi will repeat the following action:\n\nIf all trees are burnt, terminate the process.\n\nSpecify a direction: clockwise or counter-clockwise.\n\nWalk around the lake in the specified direction, until the coordinate of a tree that is not yet burnt is reached for the first time.\n\nWhen the coordinate with the tree is reached, burn that tree, stay at the position and go back to the first step.\n\nFind the longest possible total distance Takahashi walks during the process.\n\nPartial Score\n\nA partial score can be obtained in this problem:\n\n300 points will be awarded for passing the input satisfying N \\leq 2000.\n\nConstraints\n\n2 \\leq L \\leq 10^9\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq X_1 < ... < X_N \\leq L-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL N\nX_1\n:\nX_N\n\nOutput\n\nPrint the longest possible total distance Takahashi walks during the process.\n\nSample Input 1\n\n10 3\n2\n7\n9\n\nSample Output 1\n\n15\n\nTakahashi walks the distance of 15 if the process goes as follows:\n\nWalk a distance of 2 counter-clockwise, burn the tree at the coordinate 2 and stay there.\n\nWalk a distance of 5 counter-clockwise, burn the tree at the coordinate 7 and stay there.\n\nWalk a distance of 8 clockwise, burn the tree at the coordinate 9 and stay there.\n\nSample Input 2\n\n10 6\n1\n2\n3\n6\n7\n9\n\nSample Output 2\n\n27\n\nSample Input 3\n\n314159265 7\n21662711\n77271666\n89022761\n156626166\n160332356\n166902656\n298992265\n\nSample Output 3\n\n1204124749", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 899, "cpu_time_ms": 31, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s584914377", "group_id": "codeNet:p03193", "input_text": "var\n\tn,cnt,i,a,b,c,d:Longint;\nbegin\n\tread(n,a,b);\n\tfor i:=1 to n do begin\n\t\tread(c,d);\n\t\tif(a<=c)and(b<=d)then inc(cnt);\n\tend;\n\twriteln(cnt);\nend.\n", "language": "Pascal", "metadata": {"date": 1545537928, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03193.html", "problem_id": "p03193", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03193/input.txt", "sample_output_relpath": "derived/input_output/data/p03193/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03193/Pascal/s584914377.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584914377", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,cnt,i,a,b,c,d:Longint;\nbegin\n\tread(n,a,b);\n\tfor i:=1 to n do begin\n\t\tread(c,d);\n\t\tif(a<=c)and(b<=d)then inc(cnt);\n\tend;\n\twriteln(cnt);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "sample_input": "3 5 2\n10 3\n5 2\n2 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03193", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s139919084", "group_id": "codeNet:p03193", "input_text": "var\n a:array[1..1000,1..1000]of longint;\n n,k,i,m,j,t,ans,b,c,d:longint;\n p,q,o,x,y:real;\n s:string;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then max:=b\n else max:=a;\nend;\nbegin\n readln(c,n,m);\n for i:=1 to c do\n begin\n readln(a[i,1],a[i,2]);\n ans:=ans+max(a[i,1] div n,a[i,2] div m);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1545530820, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03193.html", "problem_id": "p03193", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03193/input.txt", "sample_output_relpath": "derived/input_output/data/p03193/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03193/Pascal/s139919084.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139919084", "user_id": "u223928734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..1000,1..1000]of longint;\n n,k,i,m,j,t,ans,b,c,d:longint;\n p,q,o,x,y:real;\n s:string;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then max:=b\n else max:=a;\nend;\nbegin\n readln(c,n,m);\n for i:=1 to c do\n begin\n readln(a[i,1],a[i,2]);\n ans:=ans+max(a[i,1] div n,a[i,2] div m);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "sample_input": "3 5 2\n10 3\n5 2\n2 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03193", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 336, "cpu_time_ms": 2, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s717863928", "group_id": "codeNet:p03193", "input_text": "var\n\tn,h,w,i,x,y:longint;\n ans:int64;\nbegin\n\treadln(n,h,w);\n ans:=0;\n for i:=1 to n do\n begin\n \tread(x,y);\n if (x>=h) and (y>=w) then inc(ans);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1545530804, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03193.html", "problem_id": "p03193", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03193/input.txt", "sample_output_relpath": "derived/input_output/data/p03193/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03193/Pascal/s717863928.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s717863928", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,h,w,i,x,y:longint;\n ans:int64;\nbegin\n\treadln(n,h,w);\n ans:=0;\n for i:=1 to n do\n begin\n \tread(x,y);\n if (x>=h) and (y>=w) then inc(ans);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "sample_input": "3 5 2\n10 3\n5 2\n2 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03193", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 197, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s187905845", "group_id": "codeNet:p03195", "input_text": "var\n\tf:boolean;\n\tn,i,x:longint;\nbegin\n\tread(n);\n f:=false;\n for i:=1 to n do\n begin\n \tread(x);\n f:=f or (x mod 2=1); \n end;\n if f then writeln('first')\n else writeln('second');\nend.\n", "language": "Pascal", "metadata": {"date": 1545532586, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03195.html", "problem_id": "p03195", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03195/input.txt", "sample_output_relpath": "derived/input_output/data/p03195/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03195/Pascal/s187905845.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s187905845", "user_id": "u957998623"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "var\n\tf:boolean;\n\tn,i,x:longint;\nbegin\n\tread(n);\n f:=false;\n for i:=1 to n do\n begin\n \tread(x);\n f:=f or (x mod 2=1); \n end;\n if f then writeln('first')\n else writeln('second');\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "sample_input": "2\n1\n2\n"}, "reference_outputs": ["first\n"], "source_document_id": "p03195", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 210, "cpu_time_ms": 17, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s292050185", "group_id": "codeNet:p03200", "input_text": "var\n\tS:String;\n\tu,v:int64;\n\ti:Longint;\nbegin\n\treadln(S);\n\tfor i:=1 to length(S) do begin\n\t\tif S[i]='B'then inc(u)else inc(v,u);\n\tend;\n\twriteln(v);\nend.\n", "language": "Pascal", "metadata": {"date": 1582115649, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Pascal/s292050185.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s292050185", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tS:String;\n\tu,v:int64;\n\ti:Longint;\nbegin\n\treadln(S);\n\tfor i:=1 to length(S) do begin\n\t\tif S[i]='B'then inc(u)else inc(v,u);\n\tend;\n\twriteln(v);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s045822433", "group_id": "codeNet:p03200", "input_text": "var\n i,j,n:longint;\n ans:qword;\n s:ansistring;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544927548, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Pascal/s045822433.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s045822433", "user_id": "u111363574"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n i,j,n:longint;\n ans:qword;\n s:ansistring;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s293287820", "group_id": "codeNet:p03200", "input_text": "var\n i,j,n:longint;\n ans:qword;\n s:ansistring;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544927542, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Pascal/s293287820.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s293287820", "user_id": "u111363574"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n i,j,n:longint;\n ans:qword;\n s:ansistring;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s084082001", "group_id": "codeNet:p03200", "input_text": "var\n i,j,n:longint;\n ans:qword;\n s:ansistring;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544927504, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Pascal/s084082001.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s084082001", "user_id": "u223928734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n i,j,n:longint;\n ans:qword;\n s:ansistring;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s007746878", "group_id": "codeNet:p03200", "input_text": "var\n i,j,n:longint;\n ans:qword;\n s:string;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544927475, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Pascal/s007746878.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s007746878", "user_id": "u380619494"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n i,j,n:longint;\n ans:qword;\n s:string;\nbegin\n read(s);\n n:=length(s);\n for i:=1 to n do\n begin\n if s[i]='W' then\n begin\n inc(j);\n ans:=ans+(i-j);\n end;\n end;\n write(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s735334765", "group_id": "codeNet:p03201", "input_text": "var\n\ta:array[0..35] of int64;\n\tb:array[0..200010] of longint;\n\tf:array[0..200010] of boolean;\n\tans,i,j,n,x,y,z,l,r,mid:longint;\nfunction check(x:longint):longint;\nbegin\n\tif xb[n] then exit(-1);\n\tl:=1; r:=n;\n\twhile l<=r do\n\tbegin\n\t\tmid:=(l+r) div 2;\n\t\tif x=b[mid] then exit(mid);\n\t\tif xmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=b[i]; b[i]:=b[j]; b[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif l-1) and ((x<>i) or (x=i) and (a[x-1]=a[i]) or (a[x+1]=a[i])) then \n\t\t\t\tbegin\n\t\t\t\t\tinc(ans);\n\t\t\t\t\tf[i]:=false;\n\t\t\t\t\tf[x]:=false;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544930869, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Pascal/s735334765.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s735334765", "user_id": "u957998623"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\ta:array[0..35] of int64;\n\tb:array[0..200010] of longint;\n\tf:array[0..200010] of boolean;\n\tans,i,j,n,x,y,z,l,r,mid:longint;\nfunction check(x:longint):longint;\nbegin\n\tif xb[n] then exit(-1);\n\tl:=1; r:=n;\n\twhile l<=r do\n\tbegin\n\t\tmid:=(l+r) div 2;\n\t\tif x=b[mid] then exit(mid);\n\t\tif xmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=b[i]; b[i]:=b[j]; b[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif l-1) and ((x<>i) or (x=i) and (a[x-1]=a[i]) or (a[x+1]=a[i])) then \n\t\t\t\tbegin\n\t\t\t\t\tinc(ans);\n\t\t\t\t\tf[i]:=false;\n\t\t\t\t\tf[x]:=false;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\tend;\n\tend;\n\twriteln(ans);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1190, "cpu_time_ms": 2103, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s878417690", "group_id": "codeNet:p03201", "input_text": "var\n\ta:array[0..35] of int64;\n\tb:array[0..200010] of longint;\n\tf:array[0..200010] of boolean;\n\tans,i,j,n,x,l,r,mid:longint;\nfunction check(x:longint):longint;\nbegin\n\tif xb[n] then exit(-1);\n\tl:=1; r:=n;\n\twhile l<=r do\n\tbegin\n\t\tmid:=(l+r) div 2;\n\t\tif x=b[mid] then exit(mid);\n\t\tif xmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=b[i]; b[i]:=b[j]; b[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lb[i]+b[n] then continue;\n\t\t\t\tx:=check(a[j]-b[i]);\n\t\t\t\tif (x<>-1) and (x<>i) then \n\t\t\t\tbegin\n\t\t\t\t\tinc(ans);\n\t\t\t\t\tf[i]:=false;\n\t\t\t\t\tf[x]:=false;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\t\tif a[j]<=b[i] then break;\n\t\t\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544928753, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Pascal/s878417690.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s878417690", "user_id": "u957998623"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\ta:array[0..35] of int64;\n\tb:array[0..200010] of longint;\n\tf:array[0..200010] of boolean;\n\tans,i,j,n,x,l,r,mid:longint;\nfunction check(x:longint):longint;\nbegin\n\tif xb[n] then exit(-1);\n\tl:=1; r:=n;\n\twhile l<=r do\n\tbegin\n\t\tmid:=(l+r) div 2;\n\t\tif x=b[mid] then exit(mid);\n\t\tif xmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=b[i]; b[i]:=b[j]; b[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lb[i]+b[n] then continue;\n\t\t\t\tx:=check(a[j]-b[i]);\n\t\t\t\tif (x<>-1) and (x<>i) then \n\t\t\t\tbegin\n\t\t\t\t\tinc(ans);\n\t\t\t\t\tf[i]:=false;\n\t\t\t\t\tf[x]:=false;\n\t\t\t\t\tbreak;\n\t\t\t\tend;\n\t\t\t\tif a[j]<=b[i] then break;\n\t\t\tend;\n\twriteln(ans);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1119, "cpu_time_ms": 2103, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s818605186", "group_id": "codeNet:p03202", "input_text": "var\n\ta,b,c,ch:array[0..200010] of longint;\n\tn,i,l,r,mid,y,k:longint;\n\tj:char;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=b[(l+r) div 2];\n\trepeat\n\t\twhile b[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=b[i]; b[i]:=b[j]; b[j]:=t;\n\t\t\tt:=c[i]; c[i]:=c[j]; c[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lx) and (y>1) do\n\t\tbegin\n\t\t\tch[y]:=ch[y]-x;\n\t\t\tdec(y);\n\t\t\tinc(ch[y]);\n\t\tend;\n\t\tif ch[1]>x then exit(false);\n\tend;\n\texit(true);\nend;\nbegin\n\treadln(n);\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\tc[i]:=i;\n\t\tb[i]:=a[i];\n\tend;\n\tqsort(1,n);\n\tfor i:=1 to n do a[c[i]]:=i;\n\tl:=1; r:=26;\n\twhile lmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=b[i]; b[i]:=b[j]; b[j]:=t;\n\t\t\tt:=c[i]; c[i]:=c[j]; c[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lx) and (y>1) do\n\t\tbegin\n\t\t\tch[y]:=ch[y]-x;\n\t\t\tdec(y);\n\t\t\tinc(ch[y]);\n\t\tend;\n\t\tif ch[1]>x then exit(false);\n\tend;\n\texit(true);\nend;\nbegin\n\treadln(n);\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\tc[i]:=i;\n\t\tb[i]:=a[i];\n\tend;\n\tqsort(1,n);\n\tfor i:=1 to n do a[c[i]]:=i;\n\tl:=1; r:=26;\n\twhile lmid do dec(j);\n\t\tif i<=j then \n\t\tbegin \n\t\t\tk:=h[i];h[i]:=h[j];h[j]:=k;\n\t\t\tinc(i);\n\t\t\tdec(j);\n\t\tend;\n\tuntil i>j;\n\tif il then qsort(l,j);\nend;\nbegin \n\tread(n,k);\n\tmin:=maxlongint;\n\tfor i:=1 to n do read(h[i]);\n\tqsort(1,n);\n\tfor i:=1 to n-k+1 do\n\t\tif h[i+k-1]-h[i]mid do dec(j);\n\t\tif i<=j then \n\t\tbegin \n\t\t\tk:=h[i];h[i]:=h[j];h[j]:=k;\n\t\t\tinc(i);\n\t\t\tdec(j);\n\t\tend;\n\tuntil i>j;\n\tif il then qsort(l,j);\nend;\nbegin \n\tread(n,k);\n\tmin:=maxlongint;\n\tfor i:=1 to n do read(h[i]);\n\tqsort(1,n);\n\tfor i:=1 to n-k+1 do\n\t\tif h[i+k-1]-h[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544322620, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03208.html", "problem_id": "p03208", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03208/input.txt", "sample_output_relpath": "derived/input_output/data/p03208/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03208/Pascal/s355678234.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355678234", "user_id": "u380619494"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..100000] of longint;\n i,n,j,m,k:longint;\n ans:qword;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r)shr 1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 592, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s040077429", "group_id": "codeNet:p03212", "input_text": "var\n\tn:Longint;\nfunction f(x:int64;a,b,c:Longint):Longint;\nbegin\n\tf:=0;\n\tif x<=n then f:=a*b*c+f(x*10+3,1,b,c)+f(x*10+5,a,1,c)+f(x*10+7,a,b,1);\nend;\nbegin\n\tread(n);\n\tif n>700000000 then writeln(17656+f(7,0,0,1))\n\telse if n>500000000 then writeln(8828+f(5,0,1,0))\n\telse writeln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1575165969, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03212.html", "problem_id": "p03212", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03212/input.txt", "sample_output_relpath": "derived/input_output/data/p03212/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03212/Pascal/s040077429.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s040077429", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tn:Longint;\nfunction f(x:int64;a,b,c:Longint):Longint;\nbegin\n\tf:=0;\n\tif x<=n then f:=a*b*c+f(x*10+3,1,b,c)+f(x*10+5,a,1,c)+f(x*10+7,a,b,1);\nend;\nbegin\n\tread(n);\n\tif n>700000000 then writeln(17656+f(7,0,0,1))\n\telse if n>500000000 then writeln(8828+f(5,0,1,0))\n\telse writeln(f(0,0,0,0));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "sample_input": "575\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03212", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 294, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s264544831", "group_id": "codeNet:p03212", "input_text": "var\n\tn:Longint;\nfunction f(x:int64;a,b,c:Longint):Longint;\nbegin\n\tf:=0;\n\tif x<=n then f:=a*b*c+f(x*10+3,1,b,c)+f(x*10+5,a,1,c)+f(x*10+7,a,b,1);\nend;\nbegin\n\tread(n);\n\tif n>777777000 then begin writeln(26484);exit;end;\n\twriteln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1575165653, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03212.html", "problem_id": "p03212", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03212/input.txt", "sample_output_relpath": "derived/input_output/data/p03212/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03212/Pascal/s264544831.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s264544831", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tn:Longint;\nfunction f(x:int64;a,b,c:Longint):Longint;\nbegin\n\tf:=0;\n\tif x<=n then f:=a*b*c+f(x*10+3,1,b,c)+f(x*10+5,a,1,c)+f(x*10+7,a,b,1);\nend;\nbegin\n\tread(n);\n\tif n>777777000 then begin writeln(26484);exit;end;\n\twriteln(f(0,0,0,0));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "sample_input": "575\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03212", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s048562138", "group_id": "codeNet:p03212", "input_text": "var n : longint;\n i,sum : integer;\n \nprocedure sft(p : longint; d : integer; s,f,t : boolean);\nbegin\n if d = 0 then begin\n if s and f and t then if p < n then sum := sum + 1;\n end else begin\n sft(p * 10 + 3, d - 1, s, f, true);\n sft(p * 10 + 5, d - 1, s, true, t);\n sft(p * 10 + 7, d - 1, true, f, t);\n end\nend;\n \nbegin\n readln(n);\n for i := 3 to 9 do begin\n sft(0, i, false, false, false);\n end;\n writeln(sum)\nend.", "language": "Pascal", "metadata": {"date": 1543984409, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03212.html", "problem_id": "p03212", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03212/input.txt", "sample_output_relpath": "derived/input_output/data/p03212/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03212/Pascal/s048562138.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s048562138", "user_id": "u492212770"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n : longint;\n i,sum : integer;\n \nprocedure sft(p : longint; d : integer; s,f,t : boolean);\nbegin\n if d = 0 then begin\n if s and f and t then if p < n then sum := sum + 1;\n end else begin\n sft(p * 10 + 3, d - 1, s, f, true);\n sft(p * 10 + 5, d - 1, s, true, t);\n sft(p * 10 + 7, d - 1, true, f, t);\n end\nend;\n \nbegin\n readln(n);\n for i := 3 to 9 do begin\n sft(0, i, false, false, false);\n end;\n writeln(sum)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "sample_input": "575\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03212", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 446, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s138754049", "group_id": "codeNet:p03212", "input_text": "var\n\tn,ans:Longint;\nprocedure f(x:int64;a,b,c:Boolean);\nbegin\n\tif x>n then exit;\n\tif a and b and c then inc(ans);\n\tf(x*10+3,True,b,c);\n\tf(x*10+5,a,True,c);\n\tf(x*10+7,a,b,True);\nend;\nbegin\n\tread(n);\n\tf(0,False,False,False);\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543811015, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03212.html", "problem_id": "p03212", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03212/input.txt", "sample_output_relpath": "derived/input_output/data/p03212/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03212/Pascal/s138754049.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s138754049", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tn,ans:Longint;\nprocedure f(x:int64;a,b,c:Boolean);\nbegin\n\tif x>n then exit;\n\tif a and b and c then inc(ans);\n\tf(x*10+3,True,b,c);\n\tf(x*10+5,a,True,c);\n\tf(x*10+7,a,b,True);\nend;\nbegin\n\tread(n);\n\tf(0,False,False,False);\n\twriteln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "sample_input": "575\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03212", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 242, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s402109208", "group_id": "codeNet:p03212", "input_text": "var\n n,i,j,m,ans:longint;\n s:string;\n b1,b2,b3:boolean;\nbegin\n readln(n);\n if n<357 then begin writeln('0'); halt; end;\n if (1000'3')and(s[j]<>'5')and(s[j]<>'7') then break;\n if s[j]='3' then b1:=true;\n if s[j]='5' then b2:=true;\n if s[j]='7' then b3:=true;\n end;\n if b1 and b2 and b3 and(j=length(s)) then inc(ans);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543808034, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03212.html", "problem_id": "p03212", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03212/input.txt", "sample_output_relpath": "derived/input_output/data/p03212/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03212/Pascal/s402109208.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s402109208", "user_id": "u223928734"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n n,i,j,m,ans:longint;\n s:string;\n b1,b2,b3:boolean;\nbegin\n readln(n);\n if n<357 then begin writeln('0'); halt; end;\n if (1000'3')and(s[j]<>'5')and(s[j]<>'7') then break;\n if s[j]='3' then b1:=true;\n if s[j]='5' then b2:=true;\n if s[j]='7' then b3:=true;\n end;\n if b1 and b2 and b3 and(j=length(s)) then inc(ans);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "sample_input": "575\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03212", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 113869, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s796551599", "group_id": "codeNet:p03213", "input_text": "{\n\t75=3*25\n\t\t=3*5*5\n\t\t=5*15\n\ta^2 b^24\n\ta^2 b^4 c^4\n\ta^4 b^14\n}\nvar\n\ti,j,k,ans,n:longint;\n\ts:array[0..110] of longint;\n\tf:array[0..110,0..110,0..110] of boolean;\nprocedure prime(x:longint);\nbegin\n\tj:=2;\n\twhile x>=j do\n\tbegin\n\t\twhile x mod j=0 do\n\t\tbegin\n\t\t\tinc(s[j]);\n\t\t\tx:=x div j;\n\t\tend;\n\t\tinc(j);\n\tend;\nend;\nbegin\n\tread(n);\n\tfillchar(s,sizeof(s),0);\n\tfor i:=2 to n do prime(i);\n\tfor i:=2 to n do writeln('s[',i,']=',s[i]);\n\tfillchar(f,sizeof(f),true);\n\tans:=0;\n\tfor i:=2 to n do\n\t\tfor j:=2 to n do\n\t\t\tif i<>j then\n\t\t\tbegin\n\t\t\t\tif (s[i]>=2) and (s[j]>=24) then inc(ans);\n\t\t\t\tif (s[i]>=4) and (s[j]>=14) then inc(ans);\n\t\t\t\tif (s[i]>=2) and (s[j]>=4) then \n\t\t\t\t\tfor k:=2 to n do\n\t\t\t\t\t\tif (i<>k) and (j<>k) then\n\t\t\t\t\t\t\tif s[k]>=4 then \n\t\t\t\t\t\t\t\tif f[i,j,k] then\n\t\t\t\t\t\t\t\tbegin \n\t\t\t\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\t\t\t\tf[i,j,k]:=false;\n\t\t\t\t\t\t\t\t\tf[i,k,j]:=false;\n\t\t\t\t\t\t\t\tend;\n\t\t\tend;\n\tfor i:=1 to n do\n\t\tif s[i]>=74 then inc(ans);\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543805171, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03213.html", "problem_id": "p03213", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03213/input.txt", "sample_output_relpath": "derived/input_output/data/p03213/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03213/Pascal/s796551599.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s796551599", "user_id": "u957998623"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "{\n\t75=3*25\n\t\t=3*5*5\n\t\t=5*15\n\ta^2 b^24\n\ta^2 b^4 c^4\n\ta^4 b^14\n}\nvar\n\ti,j,k,ans,n:longint;\n\ts:array[0..110] of longint;\n\tf:array[0..110,0..110,0..110] of boolean;\nprocedure prime(x:longint);\nbegin\n\tj:=2;\n\twhile x>=j do\n\tbegin\n\t\twhile x mod j=0 do\n\t\tbegin\n\t\t\tinc(s[j]);\n\t\t\tx:=x div j;\n\t\tend;\n\t\tinc(j);\n\tend;\nend;\nbegin\n\tread(n);\n\tfillchar(s,sizeof(s),0);\n\tfor i:=2 to n do prime(i);\n\tfor i:=2 to n do writeln('s[',i,']=',s[i]);\n\tfillchar(f,sizeof(f),true);\n\tans:=0;\n\tfor i:=2 to n do\n\t\tfor j:=2 to n do\n\t\t\tif i<>j then\n\t\t\tbegin\n\t\t\t\tif (s[i]>=2) and (s[j]>=24) then inc(ans);\n\t\t\t\tif (s[i]>=4) and (s[j]>=14) then inc(ans);\n\t\t\t\tif (s[i]>=2) and (s[j]>=4) then \n\t\t\t\t\tfor k:=2 to n do\n\t\t\t\t\t\tif (i<>k) and (j<>k) then\n\t\t\t\t\t\t\tif s[k]>=4 then \n\t\t\t\t\t\t\t\tif f[i,j,k] then\n\t\t\t\t\t\t\t\tbegin \n\t\t\t\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\t\t\t\tf[i,j,k]:=false;\n\t\t\t\t\t\t\t\t\tf[i,k,j]:=false;\n\t\t\t\t\t\t\t\tend;\n\t\t\tend;\n\tfor i:=1 to n do\n\t\tif s[i]>=74 then inc(ans);\n\twriteln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that has exactly 75 divisors.\n\nNote\n\nWhen a positive integer A divides a positive integer B, A is said to a divisor of B.\nFor example, 6 has four divisors: 1, 2, 3 and 6.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go numbers that are divisors of N!.\n\nSample Input 1\n\n9\n\nSample Output 1\n\n0\n\nThere are no Shichi-Go numbers among the divisors of 9! = 1 \\times 2 \\times ... \\times 9 = 362880.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1\n\nThere is one Shichi-Go number among the divisors of 10! = 3628800: 32400.\n\nSample Input 3\n\n100\n\nSample Output 3\n\n543", "sample_input": "9\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03213", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that has exactly 75 divisors.\n\nNote\n\nWhen a positive integer A divides a positive integer B, A is said to a divisor of B.\nFor example, 6 has four divisors: 1, 2, 3 and 6.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go numbers that are divisors of N!.\n\nSample Input 1\n\n9\n\nSample Output 1\n\n0\n\nThere are no Shichi-Go numbers among the divisors of 9! = 1 \\times 2 \\times ... \\times 9 = 362880.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1\n\nThere is one Shichi-Go number among the divisors of 10! = 3628800: 32400.\n\nSample Input 3\n\n100\n\nSample Output 3\n\n543", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 932, "cpu_time_ms": 1, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s991691398", "group_id": "codeNet:p03221", "input_text": "var\n n,m,i,j,zrt:longint;\n p,y,a,b,c,o:array[0..1000000]of longint;\nProcedure ch(var x,y:longint);\nvar\n t:longint;\nbegin\n t:=x;x:=y;y:=t;\nend;\nProcedure qs(l,r:longint);\nvar\n i,j,mid1,mid2:longint;\nbegin\n i:=l;j:=r;mid1:=p[(l+r)div 2];mid2:=y[(l+r)div 2];\n repeat\n while (p[i]mid1)or((p[j]=mid1)and(y[j]>mid2)) do dec(j);\n if i<=j then\n begin\n ch(p[i],p[j]);\n ch(y[i],y[j]);\n ch(c[i],c[j]);\n inc(i);dec(j);\n end;\n until i>j;\n if lp[i-1]) then j:=1 else inc(j);\n o[c[i]]:=j;\n end;\n for i:=1 to m do\n begin\n zrt:=100000;\n for j:=1 to 6 do\n begin\n if a[i]mid1)or((p[j]=mid1)and(y[j]>mid2)) do dec(j);\n if i<=j then\n begin\n ch(p[i],p[j]);\n ch(y[i],y[j]);\n ch(c[i],c[j]);\n inc(i);dec(j);\n end;\n until i>j;\n if lp[i-1]) then j:=1 else inc(j);\n o[c[i]]:=j;\n end;\n for i:=1 to m do\n begin\n zrt:=100000;\n for j:=1 to 6 do\n begin\n if a[i]x[mid]) or (x[j]=x[mid]) and (y[j]>y[mid]) do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tt:=y[i]; y[i]:=y[j]; y[j]:=t;\n\t\t\tfor k:=1 to m do\n\t\t\t\tif num[k]=i then break;\n\t\t\tfor l1:=1 to m do\n\t\t\t\tif num[l1]=j then break;\n\t\t\tt:=num[k]; num[k]:=num[l1]; num[l1]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lx[i-1] then t:=1 else inc(t);\n\t\ty[i]:=t;\n\tend;\n\tfor i:=1 to m do card(x[num[i]],y[num[i]]);\nend.", "language": "Pascal", "metadata": {"date": 1541388917, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03221.html", "problem_id": "p03221", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03221/input.txt", "sample_output_relpath": "derived/input_output/data/p03221/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03221/Pascal/s268589194.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s268589194", "user_id": "u957998623"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "var\n\ta,b,x,y,num:array[0..100010] of longint;\n\tn,m,i,t:longint;\n\tch:string[20];\nprocedure qsort(l,r:longint);\nvar\n\ti,j,k,l1,t,mid:longint;\nbegin\n\ti:=l; j:=r;\n\tmid:=(l+r) div 2;\n\trepeat\n\t\twhile (x[i]x[mid]) or (x[j]=x[mid]) and (y[j]>y[mid]) do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tt:=y[i]; y[i]:=y[j]; y[j]:=t;\n\t\t\tfor k:=1 to m do\n\t\t\t\tif num[k]=i then break;\n\t\t\tfor l1:=1 to m do\n\t\t\t\tif num[l1]=j then break;\n\t\t\tt:=num[k]; num[k]:=num[l1]; num[l1]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lx[i-1] then t:=1 else inc(t);\n\t\ty[i]:=t;\n\tend;\n\tfor i:=1 to m do card(x[num[i]],y[num[i]]);\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "sample_input": "2 3\n1 32\n2 63\n1 12\n"}, "reference_outputs": ["000001000002\n000002000001\n000001000001\n"], "source_document_id": "p03221", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1116, "cpu_time_ms": 2103, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s078652082", "group_id": "codeNet:p03221", "input_text": "var\n\ta,b,x,y,num:array[0..100010] of longint;\n\tn,m,i,t:longint;\n\tch:string[20];\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r;\n\tmid:=(l+r) div 2;\n\trepeat\n\t\twhile (x[i]x[mid]) or (x[j]=x[mid]) and (y[j]>y[mid]) do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tt:=y[i]; y[i]:=y[j]; y[j]:=t;\n\t\t\tif num[i]<>num[j] then num[num[i]]:=j; num[num[j]]:=i;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lx[i-1] then t:=1 else inc(t);\n\t\ty[i]:=t;\n\tend;\n\tfor i:=1 to m do card(x[num[i]],y[num[i]]);\nend.", "language": "Pascal", "metadata": {"date": 1541388419, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03221.html", "problem_id": "p03221", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03221/input.txt", "sample_output_relpath": "derived/input_output/data/p03221/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03221/Pascal/s078652082.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s078652082", "user_id": "u957998623"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "var\n\ta,b,x,y,num:array[0..100010] of longint;\n\tn,m,i,t:longint;\n\tch:string[20];\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r;\n\tmid:=(l+r) div 2;\n\trepeat\n\t\twhile (x[i]x[mid]) or (x[j]=x[mid]) and (y[j]>y[mid]) do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=x[i]; x[i]:=x[j]; x[j]:=t;\n\t\t\tt:=y[i]; y[i]:=y[j]; y[j]:=t;\n\t\t\tif num[i]<>num[j] then num[num[i]]:=j; num[num[j]]:=i;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lx[i-1] then t:=1 else inc(t);\n\t\ty[i]:=t;\n\tend;\n\tfor i:=1 to m do card(x[num[i]],y[num[i]]);\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "sample_input": "2 3\n1 32\n2 63\n1 12\n"}, "reference_outputs": ["000001000002\n000002000001\n000001000001\n"], "source_document_id": "p03221", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1028, "cpu_time_ms": 95, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s515241744", "group_id": "codeNet:p03223", "input_text": "type \n\tarr=array[0..100010] of longint;\nvar\n\ts,t:int64;\n\ti,n:longint;\n\ta,f1,f2:arr;\nprocedure qsort(var a:arr; l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt then writeln(s)\n\telse writeln(t);\nend.", "language": "Pascal", "metadata": {"date": 1541203062, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s515241744.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s515241744", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "type \n\tarr=array[0..100010] of longint;\nvar\n\ts,t:int64;\n\ti,n:longint;\n\ta,f1,f2:arr;\nprocedure qsort(var a:arr; l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt then writeln(s)\n\telse writeln(t);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 933, "cpu_time_ms": 34, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s305666447", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..100010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tif n mod 2=0 then \n\tbegin\n\t\tt1:=a[(1+n) div 2+1];\n\t\tl:=1; r:=n;\n\t\tfor i:=1 to n-1 do\n\t\tbegin\n\t\t\tx:=abs(a[r]-t1);\n\t\t\ty:=abs(t1-a[l]);\n\t\t\tif x>y then right\n\t\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\t\telse left;\n\t\t\tt:=t+abs(t1-t2);\n\t\t\tt1:=t2;\n\t\tend;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "language": "Pascal", "metadata": {"date": 1541038386, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s305666447.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s305666447", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[-10..100010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tif n mod 2=0 then \n\tbegin\n\t\tt1:=a[(1+n) div 2+1];\n\t\tl:=1; r:=n;\n\t\tfor i:=1 to n-1 do\n\t\tbegin\n\t\t\tx:=abs(a[r]-t1);\n\t\t\ty:=abs(t1-a[l]);\n\t\t\tif x>y then right\n\t\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\t\telse left;\n\t\t\tt:=t+abs(t1-t2);\n\t\t\tt1:=t2;\n\t\tend;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1180, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s941783417", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of int64;\n\tn,i,l,r:longint;\n\tt1,t2,s,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\tend;\n\t\tif xy then \n\t\t\tbegin \n\t\t\t\tt2:=a[r];\n\t\t\t\tdec(r);\n\t\t\tend;\n\t\t\tif x<=y then \n\t\t\tbegin \n\t\t\t\tt2:=a[l];\n\t\t\t\tinc(l);\n\t\t\tend;\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1540752831, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s941783417.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s941783417", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[0..100010] of int64;\n\tn,i,l,r:longint;\n\tt1,t2,s,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\tend;\n\t\tif xy then \n\t\t\tbegin \n\t\t\t\tt2:=a[r];\n\t\t\t\tdec(r);\n\t\t\tend;\n\t\t\tif x<=y then \n\t\t\tbegin \n\t\t\t\tt2:=a[l];\n\t\t\t\tinc(l);\n\t\t\tend;\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 904, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s501452994", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.", "language": "Pascal", "metadata": {"date": 1540694383, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s501452994.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s501452994", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1132, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s936837287", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l1,r1:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l1+r1) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif l1y then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "language": "Pascal", "metadata": {"date": 1540693889, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s936837287.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s936837287", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l1,r1:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l1+r1) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif l1y then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1125, "cpu_time_ms": 2103, "memory_kb": 263040}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s596235243", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lr then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n if l>r then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "language": "Pascal", "metadata": {"date": 1540691248, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s596235243.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s596235243", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[0..100010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lr then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n if l>r then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1273, "cpu_time_ms": 26, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s385316097", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r:longint;\n\ts,t:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lr then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n if l>r then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.", "language": "Pascal", "metadata": {"date": 1540691146, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s385316097.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s385316097", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r:longint;\n\ts,t:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lr then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n if l>r then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1274, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s268984027", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r:longint;\n\ts,t:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt1-a[l] then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tif a[r]-t1>t1-a[l] then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.", "language": "Pascal", "metadata": {"date": 1540691015, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03223.html", "problem_id": "p03223", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03223/input.txt", "sample_output_relpath": "derived/input_output/data/p03223/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03223/Pascal/s268984027.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s268984027", "user_id": "u957998623"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r:longint;\n\ts,t:int64;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt1-a[l] then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tif a[r]-t1>t1-a[l] then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1184, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s494262479", "group_id": "codeNet:p03229", "input_text": "var\n a,c:array[1..100000]of longint;\n b:array[1..100000]of boolean;\n i,n,s,j,x,y,sum:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l=1) and (y<=n) do\n begin\n if (s mod 4=3)and(i<=n) then \n begin\n c[x]:=a[i];inc(i);inc(y);\n\tc[y]:=a[i];inc(i);dec(x);\n\ts:=s+2;\n end;\n if (s mod 4=1)and(j>=1) then \n begin\n c[x]:=a[j];dec(j);dec(x);\n\tc[y]:=a[j];dec(j);inc(y);\n\ts:=s+2;\n end;\n end;\n if odd(x) then c[n]:=a[n div 2+1] else c[x]:=a[n div 2];\n for i:=2 to n do sum:=sum+abs(c[i]-c[i-1]);\n write(sum);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1540693415, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Pascal/s494262479.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s494262479", "user_id": "u380619494"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n a,c:array[1..100000]of longint;\n b:array[1..100000]of boolean;\n i,n,s,j,x,y,sum:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l=1) and (y<=n) do\n begin\n if (s mod 4=3)and(i<=n) then \n begin\n c[x]:=a[i];inc(i);inc(y);\n\tc[y]:=a[i];inc(i);dec(x);\n\ts:=s+2;\n end;\n if (s mod 4=1)and(j>=1) then \n begin\n c[x]:=a[j];dec(j);dec(x);\n\tc[y]:=a[j];dec(j);inc(y);\n\ts:=s+2;\n end;\n end;\n if odd(x) then c[n]:=a[n div 2+1] else c[x]:=a[n div 2];\n for i:=2 to n do sum:=sum+abs(c[i]-c[i-1]);\n write(sum);\n readln(i);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1367, "cpu_time_ms": 25, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s015498508", "group_id": "codeNet:p03229", "input_text": "var\n a,c:array[1..100000]of longint;\n b:array[1..100000]of boolean;\n i,n,s,j,x,y,sum:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l=1) and (y<=n) do\n begin\n if (s mod 4=3)and(i<=n) then \n begin\n if i<=n then begin c[x]:=a[i];inc(i);inc(y); end;\n\tif i<=n then begin c[y]:=a[i];inc(i);dec(x);end;\n\ts:=s+2;\n end;\n if (s mod 4=1)and(j>=1) then \n begin\n if j>=1 then begin c[x]:=a[j];dec(j);dec(x);end;\n\tif j>=1 then begin c[y]:=a[j];dec(j);inc(y);end;\n\ts:=s+2;\n end;\n end;\n if odd(x) then c[n]:=a[n div 2+1] else c[x]:=a[n div 2];\n for i:=2 to n do sum:=sum+abs(c[i]-c[i-1]);\n write(sum);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1540693225, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Pascal/s015498508.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s015498508", "user_id": "u380619494"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n a,c:array[1..100000]of longint;\n b:array[1..100000]of boolean;\n i,n,s,j,x,y,sum:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l=1) and (y<=n) do\n begin\n if (s mod 4=3)and(i<=n) then \n begin\n if i<=n then begin c[x]:=a[i];inc(i);inc(y); end;\n\tif i<=n then begin c[y]:=a[i];inc(i);dec(x);end;\n\ts:=s+2;\n end;\n if (s mod 4=1)and(j>=1) then \n begin\n if j>=1 then begin c[x]:=a[j];dec(j);dec(x);end;\n\tif j>=1 then begin c[y]:=a[j];dec(j);inc(y);end;\n\ts:=s+2;\n end;\n end;\n if odd(x) then c[n]:=a[n div 2+1] else c[x]:=a[n div 2];\n for i:=2 to n do sum:=sum+abs(c[i]-c[i-1]);\n write(sum);\n readln(i);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1460, "cpu_time_ms": 25, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s422166981", "group_id": "codeNet:p03229", "input_text": "var\n a,c:array[1..100000]of longint;\n b:array[1..100000]of boolean;\n i,n,s,j,x,y,sum:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l=1) or (y<=n) do\n if (s mod 4=3)and(i<=n) then \n begin\n if i<=n then begin c[x]:=a[i];inc(i);inc(y); end;\n\tif i<=n then begin c[y]:=a[i];inc(i);dec(x);end;\n\ts:=s+2;\n end;\n if (s mod 4=1)and(j>=1) then \n begin\n if j>=1 then begin c[x]:=a[j];dec(j);dec(x);end;\n\tif j>=1 then begin c[y]:=a[j];dec(j);inc(y);end;\n\ts:=s+2;\n end;\n if odd(x) then c[n]:=a[n div 2+1] else c[x]:=a[n div 2];\n for i:=1 to n do write(c[i],' ');\n writeln;\n for i:=2 to n do sum:=sum+abs(c[i]-c[i-1]);\n write(sum);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1540692878, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Pascal/s422166981.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s422166981", "user_id": "u380619494"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var\n a,c:array[1..100000]of longint;\n b:array[1..100000]of boolean;\n i,n,s,j,x,y,sum:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l=1) or (y<=n) do\n if (s mod 4=3)and(i<=n) then \n begin\n if i<=n then begin c[x]:=a[i];inc(i);inc(y); end;\n\tif i<=n then begin c[y]:=a[i];inc(i);dec(x);end;\n\ts:=s+2;\n end;\n if (s mod 4=1)and(j>=1) then \n begin\n if j>=1 then begin c[x]:=a[j];dec(j);dec(x);end;\n\tif j>=1 then begin c[y]:=a[j];dec(j);inc(y);end;\n\ts:=s+2;\n end;\n if odd(x) then c[n]:=a[n div 2+1] else c[x]:=a[n div 2];\n for i:=1 to n do write(c[i],' ');\n writeln;\n for i:=2 to n do sum:=sum+abs(c[i]-c[i-1]);\n write(sum);\n readln(i);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1491, "cpu_time_ms": 2103, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s087155086", "group_id": "codeNet:p03230", "input_text": "var\n f:array[1..2,1..100001]of boolean;\n t:array[1..100001,1..100001]of longint;\n a:array[1..140]of longint=(1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351,378,406,435,465,496,528,561,595,630,666,703,741,780,820,861,903,946,990,1035,1081,1128,1176,1225,1275,1326,1378,1431,1485,1540,1596,1653,1711,1770,1830,1891,1953,2016,2080,2145,2211,2278,2346,2415,2485,2556,2628,2701,2775,2850,2926,3003,3081,3160,3240,3321,3403,3486,3570,3655,3741,3828,3916,4005,4095,4186,4278,4371,4465,4560,4656,4753,4851,4950,5050,5151,5253,5356,5460,5565,5671,5778,5886,5995,6105,6216,6328,6441,6555,6670,6786,6903,7021,7140,7260,7381,7503,7626,7750,7875,8001,8128,8256,8385,8515,8646,8778,8911,9045,9180,9316,9453,9591,9730,9870);\n i,k,m,p,q,j,n:longint;\n b:boolean;\nbegin\n readln(n);\n i:=1;\n while a[i]<=n do\n begin\n if a[i]=n then begin b:=true; break; end;\n inc(i);\n end;\n if b=false then begin writeln('No'); halt; end;\n if i=1 then begin writeln('Yes'); writeln('1 1'); writeln('1 1'); halt; end;\n b:=false;\n q:=0;\n fillchar(f,sizeof(f),false);\n writeln('Yes');\n writeln(i+1);\n for j:=1 to i+1 do\n begin\n write(i,' ');\n\t for k:=1 to i do\n\t begin\n\t if ki then\n\t\tbegin\n\t for p:=1 to n do\n\t\tbegin\n\t\t if f[2,p]=false then begin write(p,' '); t[j,k]:=p; f[2,p]:=true; end;\n\t\tend;\n\t\tcontinue;\n\t\tend;\n\t\tinc(q); write(q,' '); f[1,q]:=true; t[j,k]:=q;\n\tend;\n\tend;\n\twriteln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1540694381, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03230.html", "problem_id": "p03230", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03230/input.txt", "sample_output_relpath": "derived/input_output/data/p03230/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03230/Pascal/s087155086.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s087155086", "user_id": "u223928734"}, "prompt_components": {"gold_output": "Yes\n3\n2 1 2\n2 3 1\n2 2 3\n", "input_to_evaluate": "var\n f:array[1..2,1..100001]of boolean;\n t:array[1..100001,1..100001]of longint;\n a:array[1..140]of longint=(1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351,378,406,435,465,496,528,561,595,630,666,703,741,780,820,861,903,946,990,1035,1081,1128,1176,1225,1275,1326,1378,1431,1485,1540,1596,1653,1711,1770,1830,1891,1953,2016,2080,2145,2211,2278,2346,2415,2485,2556,2628,2701,2775,2850,2926,3003,3081,3160,3240,3321,3403,3486,3570,3655,3741,3828,3916,4005,4095,4186,4278,4371,4465,4560,4656,4753,4851,4950,5050,5151,5253,5356,5460,5565,5671,5778,5886,5995,6105,6216,6328,6441,6555,6670,6786,6903,7021,7140,7260,7381,7503,7626,7750,7875,8001,8128,8256,8385,8515,8646,8778,8911,9045,9180,9316,9453,9591,9730,9870);\n i,k,m,p,q,j,n:longint;\n b:boolean;\nbegin\n readln(n);\n i:=1;\n while a[i]<=n do\n begin\n if a[i]=n then begin b:=true; break; end;\n inc(i);\n end;\n if b=false then begin writeln('No'); halt; end;\n if i=1 then begin writeln('Yes'); writeln('1 1'); writeln('1 1'); halt; end;\n b:=false;\n q:=0;\n fillchar(f,sizeof(f),false);\n writeln('Yes');\n writeln(i+1);\n for j:=1 to i+1 do\n begin\n write(i,' ');\n\t for k:=1 to i do\n\t begin\n\t if ki then\n\t\tbegin\n\t for p:=1 to n do\n\t\tbegin\n\t\t if f[2,p]=false then begin write(p,' '); t[j,k]:=p; f[2,p]:=true; end;\n\t\tend;\n\t\tcontinue;\n\t\tend;\n\t\tinc(q); write(q,' '); f[1,q]:=true; t[j,k]:=q;\n\tend;\n\tend;\n\twriteln;\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions:\n\nEach of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k.\n\nAny two of the sets S_1,S_2,...,S_k have exactly one element in common.\n\nIf such a tuple exists, construct one such tuple.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf a tuple of subsets of \\{1,2,...N\\} that satisfies the conditions does not exist, print No.\nIf such a tuple exists, print Yes first, then print such subsets in the following format:\n\nk\n|S_1| S_{1,1} S_{1,2} ... S_{1,|S_1|}\n:\n|S_k| S_{k,1} S_{k,2} ... S_{k,|S_k|}\n\nwhere S_i={S_{i,1},S_{i,2},...,S_{i,|S_i|}}.\n\nIf there are multiple such tuples, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nYes\n3\n2 1 2\n2 3 1\n2 2 3\n\nIt can be seen that (S_1,S_2,S_3)=(\\{1,2\\},\\{3,1\\},\\{2,3\\}) satisfies the conditions.\n\nSample Input 2\n\n4\n\nSample Output 2\n\nNo", "sample_input": "3\n"}, "reference_outputs": ["Yes\n3\n2 1 2\n2 3 1\n2 2 3\n"], "source_document_id": "p03230", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions:\n\nEach of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k.\n\nAny two of the sets S_1,S_2,...,S_k have exactly one element in common.\n\nIf such a tuple exists, construct one such tuple.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf a tuple of subsets of \\{1,2,...N\\} that satisfies the conditions does not exist, print No.\nIf such a tuple exists, print Yes first, then print such subsets in the following format:\n\nk\n|S_1| S_{1,1} S_{1,2} ... S_{1,|S_1|}\n:\n|S_k| S_{k,1} S_{k,2} ... S_{k,|S_k|}\n\nwhere S_i={S_{i,1},S_{i,2},...,S_{i,|S_i|}}.\n\nIf there are multiple such tuples, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nYes\n3\n2 1 2\n2 3 1\n2 2 3\n\nIt can be seen that (S_1,S_2,S_3)=(\\{1,2\\},\\{3,1\\},\\{2,3\\}) satisfies the conditions.\n\nSample Input 2\n\n4\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1543, "cpu_time_ms": 12, "memory_kb": 49536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s860586286", "group_id": "codeNet:p03231", "input_text": "var\n a,b,c:string;\n t:char;\n n,m,i,j,p,q,k:longint;\nfunction gcd(a,b:longint):longint;\nbegin\n if b=0 then exit(a)\n else exit(gcd(b,a mod b));\nend;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n if n>m then i:=n\n else i:=m;\n k:=gcd(i,n+m-i);\n p:=k div n;\n q:=k div m;\n i:=1;\n j:=1;\n while (j<=m)and(i<=n) do\n begin\n\t if b[j]<>a[i] then begin writeln('-1'); halt; end;\n i:=i+q;\n\t j:=j+p;\n end;\n writeln(k);\nend.", "language": "Pascal", "metadata": {"date": 1539486614, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03231.html", "problem_id": "p03231", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03231/input.txt", "sample_output_relpath": "derived/input_output/data/p03231/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03231/Pascal/s860586286.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s860586286", "user_id": "u223928734"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n a,b,c:string;\n t:char;\n n,m,i,j,p,q,k:longint;\nfunction gcd(a,b:longint):longint;\nbegin\n if b=0 then exit(a)\n else exit(gcd(b,a mod b));\nend;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n if n>m then i:=n\n else i:=m;\n k:=gcd(i,n+m-i);\n p:=k div n;\n q:=k div m;\n i:=1;\n j:=1;\n while (j<=m)and(i<=n) do\n begin\n\t if b[j]<>a[i] then begin writeln('-1'); halt; end;\n i:=i+q;\n\t j:=j+p;\n end;\n writeln(k);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N and another string T of length M.\nThese strings consist of lowercase English letters.\n\nA string X is called a good string when the following conditions are all met:\n\nLet L be the length of X. L is divisible by both N and M.\n\nConcatenating the 1-st, (\\frac{L}{N}+1)-th, (2 \\times \\frac{L}{N}+1)-th, ..., ((N-1)\\times\\frac{L}{N}+1)-th characters of X, without changing the order, results in S.\n\nConcatenating the 1-st, (\\frac{L}{M}+1)-th, (2 \\times \\frac{L}{M}+1)-th, ..., ((M-1)\\times\\frac{L}{M}+1)-th characters of X, without changing the order, results in T.\n\nDetermine if there exists a good string. If it exists, find the length of the shortest such string.\n\nConstraints\n\n1 \\leq N,M \\leq 10^5\n\nS and T consist of lowercase English letters.\n\n|S|=N\n\n|T|=M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS\nT\n\nOutput\n\nIf a good string does not exist, print -1; if it exists, print the length of the shortest such string.\n\nSample Input 1\n\n3 2\nacp\nae\n\nSample Output 1\n\n6\n\nFor example, the string accept is a good string.\nThere is no good string shorter than this, so the answer is 6.\n\nSample Input 2\n\n6 3\nabcdef\nabc\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n15 9\ndnsusrayukuaiia\ndujrunuma\n\nSample Output 3\n\n45", "sample_input": "3 2\nacp\nae\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03231", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N and another string T of length M.\nThese strings consist of lowercase English letters.\n\nA string X is called a good string when the following conditions are all met:\n\nLet L be the length of X. L is divisible by both N and M.\n\nConcatenating the 1-st, (\\frac{L}{N}+1)-th, (2 \\times \\frac{L}{N}+1)-th, ..., ((N-1)\\times\\frac{L}{N}+1)-th characters of X, without changing the order, results in S.\n\nConcatenating the 1-st, (\\frac{L}{M}+1)-th, (2 \\times \\frac{L}{M}+1)-th, ..., ((M-1)\\times\\frac{L}{M}+1)-th characters of X, without changing the order, results in T.\n\nDetermine if there exists a good string. If it exists, find the length of the shortest such string.\n\nConstraints\n\n1 \\leq N,M \\leq 10^5\n\nS and T consist of lowercase English letters.\n\n|S|=N\n\n|T|=M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS\nT\n\nOutput\n\nIf a good string does not exist, print -1; if it exists, print the length of the shortest such string.\n\nSample Input 1\n\n3 2\nacp\nae\n\nSample Output 1\n\n6\n\nFor example, the string accept is a good string.\nThere is no good string shorter than this, so the answer is 6.\n\nSample Input 2\n\n6 3\nabcdef\nabc\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n15 9\ndnsusrayukuaiia\ndujrunuma\n\nSample Output 3\n\n45", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 430, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s189927166", "group_id": "codeNet:p03231", "input_text": "var\n\tn,m,t1,i:longint;\n\ts,t,t2:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tt,r:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tif ni+1 then\n\t\t\tbegin\n\t\t\t\twriteln(-1);\n\t\t\t\texit;\n\t\t\tend;\n\t\twriteln(n);\n\tend\n\telse writeln(n*m div gcd(n,m));\nend.", "language": "Pascal", "metadata": {"date": 1539480065, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03231.html", "problem_id": "p03231", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03231/input.txt", "sample_output_relpath": "derived/input_output/data/p03231/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03231/Pascal/s189927166.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s189927166", "user_id": "u957998623"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\tn,m,t1,i:longint;\n\ts,t,t2:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tt,r:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tif ni+1 then\n\t\t\tbegin\n\t\t\t\twriteln(-1);\n\t\t\t\texit;\n\t\t\tend;\n\t\twriteln(n);\n\tend\n\telse writeln(n*m div gcd(n,m));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N and another string T of length M.\nThese strings consist of lowercase English letters.\n\nA string X is called a good string when the following conditions are all met:\n\nLet L be the length of X. L is divisible by both N and M.\n\nConcatenating the 1-st, (\\frac{L}{N}+1)-th, (2 \\times \\frac{L}{N}+1)-th, ..., ((N-1)\\times\\frac{L}{N}+1)-th characters of X, without changing the order, results in S.\n\nConcatenating the 1-st, (\\frac{L}{M}+1)-th, (2 \\times \\frac{L}{M}+1)-th, ..., ((M-1)\\times\\frac{L}{M}+1)-th characters of X, without changing the order, results in T.\n\nDetermine if there exists a good string. If it exists, find the length of the shortest such string.\n\nConstraints\n\n1 \\leq N,M \\leq 10^5\n\nS and T consist of lowercase English letters.\n\n|S|=N\n\n|T|=M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS\nT\n\nOutput\n\nIf a good string does not exist, print -1; if it exists, print the length of the shortest such string.\n\nSample Input 1\n\n3 2\nacp\nae\n\nSample Output 1\n\n6\n\nFor example, the string accept is a good string.\nThere is no good string shorter than this, so the answer is 6.\n\nSample Input 2\n\n6 3\nabcdef\nabc\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n15 9\ndnsusrayukuaiia\ndujrunuma\n\nSample Output 3\n\n45", "sample_input": "3 2\nacp\nae\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03231", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N and another string T of length M.\nThese strings consist of lowercase English letters.\n\nA string X is called a good string when the following conditions are all met:\n\nLet L be the length of X. L is divisible by both N and M.\n\nConcatenating the 1-st, (\\frac{L}{N}+1)-th, (2 \\times \\frac{L}{N}+1)-th, ..., ((N-1)\\times\\frac{L}{N}+1)-th characters of X, without changing the order, results in S.\n\nConcatenating the 1-st, (\\frac{L}{M}+1)-th, (2 \\times \\frac{L}{M}+1)-th, ..., ((M-1)\\times\\frac{L}{M}+1)-th characters of X, without changing the order, results in T.\n\nDetermine if there exists a good string. If it exists, find the length of the shortest such string.\n\nConstraints\n\n1 \\leq N,M \\leq 10^5\n\nS and T consist of lowercase English letters.\n\n|S|=N\n\n|T|=M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS\nT\n\nOutput\n\nIf a good string does not exist, print -1; if it exists, print the length of the shortest such string.\n\nSample Input 1\n\n3 2\nacp\nae\n\nSample Output 1\n\n6\n\nFor example, the string accept is a good string.\nThere is no good string shorter than this, so the answer is 6.\n\nSample Input 2\n\n6 3\nabcdef\nabc\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n15 9\ndnsusrayukuaiia\ndujrunuma\n\nSample Output 3\n\n45", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 522, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s345414513", "group_id": "codeNet:p03241", "input_text": "var\n\tn,m,i:Longint;\nbegin\n\tread(n,m);\n\ti:=m div n;\n\twhile m mod i>0 do dec(i);\n\twriteln(i);\nend.\n", "language": "Pascal", "metadata": {"date": 1538891206, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Pascal/s345414513.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s345414513", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,m,i:Longint;\nbegin\n\tread(n,m);\n\ti:=m div n;\n\twhile m mod i>0 do dec(i);\n\twriteln(i);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 97, "cpu_time_ms": 202, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s163354396", "group_id": "codeNet:p03241", "input_text": "var\n\tn,m,ans:int64;\n\ti:Longint;\nbegin\n\tread(n,m);\n\ti:=1;\n\twhile i*i<=m do begin\n\t\tif m mod i=0 then begin\n\t\t\tif(m div i>=n)and(ans=n)and(ans=n)and(ans=n)and(ans=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538880451, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Pascal/s493234646.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s493234646", "user_id": "u914335902"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,m,i,k:longint;\nbegin \n\tread(n,m);\n\tk:=m div n;\n for i:=k downto 1 do \n if (m mod i=0) and (m div i>=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 210, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s572402317", "group_id": "codeNet:p03241", "input_text": "var n,m,i:longint;\nbegin \n\tread(n,m);\n for i:=m-1 downto 2 do \n if (m mod i=0) and (m div i>=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538879731, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Pascal/s572402317.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s572402317", "user_id": "u914335902"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,m,i:longint;\nbegin \n\tread(n,m);\n for i:=m-1 downto 2 do \n if (m mod i=0) and (m div i>=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s939715710", "group_id": "codeNet:p03241", "input_text": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=1 to m div n+1 do\n if m mod i=0 then max:=m;\nwrite(max);\nend.", "language": "Pascal", "metadata": {"date": 1538879502, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Pascal/s939715710.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s939715710", "user_id": "u111363574"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=1 to m div n+1 do\n if m mod i=0 then max:=m;\nwrite(max);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s596585641", "group_id": "codeNet:p03241", "input_text": "var\nn,m,i,t:longint;\nbegin\nread(n,m);\nt:=trunc(sqrt(m));\nfor i:=1 to t do\nif m mod i=0 then\nif i>=n then\nbegin\nwriteln(m div i);\nhalt;\nend;\nfor i:=t-1 downto 1 do\nif m mod i=0 then\nif m div i>=n then\nbegin\nwriteln(i);\nhalt;\nend;\nend.", "language": "Pascal", "metadata": {"date": 1538877257, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Pascal/s596585641.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s596585641", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\nn,m,i,t:longint;\nbegin\nread(n,m);\nt:=trunc(sqrt(m));\nfor i:=1 to t do\nif m mod i=0 then\nif i>=n then\nbegin\nwriteln(m div i);\nhalt;\nend;\nfor i:=t-1 downto 1 do\nif m mod i=0 then\nif m div i>=n then\nbegin\nwriteln(i);\nhalt;\nend;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s626174149", "group_id": "codeNet:p03244", "input_text": "var\n n,i,x,maxo,maxj,oi,ji:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n if (oi=ji) then write(n div 2)\n else write(n-maxo-maxj);\nend.", "language": "Pascal", "metadata": {"date": 1538273477, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Pascal/s626174149.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s626174149", "user_id": "u797897182"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,x,maxo,maxj,oi,ji:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n if (oi=ji) then write(n div 2)\n else write(n-maxo-maxj);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 432, "cpu_time_ms": 12, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s409594782", "group_id": "codeNet:p03244", "input_text": "var n:longint;\nx,i,m1,m11,m22,m2:longint;\na,b:array[0..100001]of integer;\nbegin \n\tread(n);\n\ta[0]:=0;b[0]:=0;//a ou\n\tm1:=0;m2:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x);\n\t\tif i mod 2=0 then \n\t\tbegin \n\t\t\tinc(a[x]);\n\t\t\tif (a[x]>a[m1]) and (x<>m1) then begin m11:=m1;m1:=x;end\n\t\t\telse if (a[x]>a[m11]) and (x<>m11) and (x<>m1) then m11:=x;\n\t\tend\n\t\telse begin \n\t\t\tinc(b[x]);\n\t\t\tif (b[x]>b[m2]) and (x<>m2) then begin m22:=m2;m2:=x;end\n\t\t\telse if (b[x]>b[m22]) and (x<>m22) and (x<>m2) then m22:=x;\n\t\tend;\n\tend;\n\tif m1=m2 then \n\tbegin \n\t\tif a[m11]+b[m2]>a[m1]+b[m22] then write(n-a[m11]-b[m2])\n\t\t\telse write(n-a[m1]-b[m22]);\n\t\texit;\n\tend; \n\twrite(n-a[m1]-b[m2]);\nend.", "language": "Pascal", "metadata": {"date": 1538271837, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Pascal/s409594782.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s409594782", "user_id": "u914335902"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n:longint;\nx,i,m1,m11,m22,m2:longint;\na,b:array[0..100001]of integer;\nbegin \n\tread(n);\n\ta[0]:=0;b[0]:=0;//a ou\n\tm1:=0;m2:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x);\n\t\tif i mod 2=0 then \n\t\tbegin \n\t\t\tinc(a[x]);\n\t\t\tif (a[x]>a[m1]) and (x<>m1) then begin m11:=m1;m1:=x;end\n\t\t\telse if (a[x]>a[m11]) and (x<>m11) and (x<>m1) then m11:=x;\n\t\tend\n\t\telse begin \n\t\t\tinc(b[x]);\n\t\t\tif (b[x]>b[m2]) and (x<>m2) then begin m22:=m2;m2:=x;end\n\t\t\telse if (b[x]>b[m22]) and (x<>m22) and (x<>m2) then m22:=x;\n\t\tend;\n\tend;\n\tif m1=m2 then \n\tbegin \n\t\tif a[m11]+b[m2]>a[m1]+b[m22] then write(n-a[m11]-b[m2])\n\t\t\telse write(n-a[m1]-b[m22]);\n\t\texit;\n\tend; \n\twrite(n-a[m1]-b[m2]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 665, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s833234398", "group_id": "codeNet:p03244", "input_text": "var n:longint;\nx,i,m1,m11,m22,m2:integer;\na,b:array[0..100001]of integer;\nbegin \n\tread(n);\n\ta[0]:=0;b[0]:=0;//a ou\n\tm1:=0;m2:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x);\n\t\tif i mod 2=0 then \n\t\tbegin \n\t\t\tinc(a[x]);\n\t\t\tif (a[x]>a[m1]) and (x<>m1) then begin m11:=m1;m1:=x;end\n\t\t\telse if (a[x]>a[m11]) and (x<>m11) and (x<>m1) then m11:=x;\n\t\tend\n\t\telse begin \n\t\t\tinc(b[x]);\n\t\t\tif (b[x]>b[m2]) and (x<>m2) then begin m22:=m2;m2:=x;end\n\t\t\telse if (b[x]>b[m22]) and (x<>m22) and (x<>m2) then m22:=x;\n\t\tend;\n\tend;\n\tif m1=m2 then \n\tbegin \n\t\tif m11>m22 then m1:=m11\n\t\t\telse m2:=m22;\n\tend; \n\twrite((n div 2)-a[m1]+(n-n div 2)-b[m2]);\nend.", "language": "Pascal", "metadata": {"date": 1538271346, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Pascal/s833234398.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s833234398", "user_id": "u914335902"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n:longint;\nx,i,m1,m11,m22,m2:integer;\na,b:array[0..100001]of integer;\nbegin \n\tread(n);\n\ta[0]:=0;b[0]:=0;//a ou\n\tm1:=0;m2:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x);\n\t\tif i mod 2=0 then \n\t\tbegin \n\t\t\tinc(a[x]);\n\t\t\tif (a[x]>a[m1]) and (x<>m1) then begin m11:=m1;m1:=x;end\n\t\t\telse if (a[x]>a[m11]) and (x<>m11) and (x<>m1) then m11:=x;\n\t\tend\n\t\telse begin \n\t\t\tinc(b[x]);\n\t\t\tif (b[x]>b[m2]) and (x<>m2) then begin m22:=m2;m2:=x;end\n\t\t\telse if (b[x]>b[m22]) and (x<>m22) and (x<>m2) then m22:=x;\n\t\tend;\n\tend;\n\tif m1=m2 then \n\tbegin \n\t\tif m11>m22 then m1:=m11\n\t\t\telse m2:=m22;\n\tend; \n\twrite((n div 2)-a[m1]+(n-n div 2)-b[m2]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s840253640", "group_id": "codeNet:p03244", "input_text": "var\na:array[1..100000]of longint;\nb:array[0..1,0..100000]of longint;\nmax:array[0..1]of longint;\nn,i,s,t,x:longint;\nbegin\nread(n);\nfor i:=1 to n do\nbegin\nread(a[i]);\ninc(b[i mod 2,a[i]]);\n if b[i mod 2,a[i]]>max[i mod 2] then\n begin\n max[i mod 2]:=b[i mod 2,a[i]];\n b[i mod 2,0]:=a[i];\n end;\nend;\nif b[0,0]=b[1,0] then\nbegin\nt:=0;\n for i:=1 to n do\n if (i mod 2=0) and (a[i]<>b[0,0]) and (b[0,a[i]]>t) then\n begin\n t:=b[0,a[i]];\n x:=a[i];\n end;\ns:=0;\n for i:=1 to n do\n if (i mod 2=0) and (a[i]<>x) or (i mod 2=1) and (a[i]<>b[1,0]) then\n inc(s);\nt:=0;\n for i:=1 to n do\n if (i mod 2=1) and (a[i]<>b[1,0]) and (b[1,a[i]]>t) then\n begin\n t:=b[1,a[i]];\n x:=a[i];\n end;\nt:=0;\n for i:=1 to n do\n if (i mod 2=0) and (a[i]<>b[0,0]) or (i mod 2=1) and (a[i]<>x) then\n inc(t);\n if t>s then\n writeln(t)\n else\n writeln(s);\nhalt;\nend;\nfor i:=1 to n do\n if a[i]<>b[i mod 2,0] then\n inc(s);\nwriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1538271065, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Pascal/s840253640.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s840253640", "user_id": "u214724132"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\na:array[1..100000]of longint;\nb:array[0..1,0..100000]of longint;\nmax:array[0..1]of longint;\nn,i,s,t,x:longint;\nbegin\nread(n);\nfor i:=1 to n do\nbegin\nread(a[i]);\ninc(b[i mod 2,a[i]]);\n if b[i mod 2,a[i]]>max[i mod 2] then\n begin\n max[i mod 2]:=b[i mod 2,a[i]];\n b[i mod 2,0]:=a[i];\n end;\nend;\nif b[0,0]=b[1,0] then\nbegin\nt:=0;\n for i:=1 to n do\n if (i mod 2=0) and (a[i]<>b[0,0]) and (b[0,a[i]]>t) then\n begin\n t:=b[0,a[i]];\n x:=a[i];\n end;\ns:=0;\n for i:=1 to n do\n if (i mod 2=0) and (a[i]<>x) or (i mod 2=1) and (a[i]<>b[1,0]) then\n inc(s);\nt:=0;\n for i:=1 to n do\n if (i mod 2=1) and (a[i]<>b[1,0]) and (b[1,a[i]]>t) then\n begin\n t:=b[1,a[i]];\n x:=a[i];\n end;\nt:=0;\n for i:=1 to n do\n if (i mod 2=0) and (a[i]<>b[0,0]) or (i mod 2=1) and (a[i]<>x) then\n inc(t);\n if t>s then\n writeln(t)\n else\n writeln(s);\nhalt;\nend;\nfor i:=1 to n do\n if a[i]<>b[i mod 2,0] then\n inc(s);\nwriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 907, "cpu_time_ms": 20, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s323288468", "group_id": "codeNet:p03245", "input_text": "var\n\ti,j,k,n,max:longint;\n\tt,x,y:array[0..1010] of longint;\n\ts:ansistring;\nbegin\n\treadln(n);\n\tmax:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x[i],y[i]);\n\t\tt[i]:=abs(x[i])+abs(y[i]);\n\t\tif t[i] mod 2<>t[1] mod 2 then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\tif t[i]>max then max:=t[i];\n\tend;\n\twriteln(max);\n\tfor i:=1 to max do write(2-t[i] mod 2,' ');\n\twriteln;\n\tfor i:=1 to n do\n\tbegin\n\t\ts:='';\n\t\tif x[i]<0 then \n\t\t\tfor j:=1 to -x[i] do s:=s+'L'\n\t\telse if x[i]>0 then for j:=1 to x[i] do s:=s+'R';\n\t\tif y[i]<0 then \n\t\t\tfor j:=1 to -y[i] do s:=s+'D'\n\t\telse if y[i]>0 then for j:=1 to y[i] do s:=s+'U';\n\t\tk:=length(s);\n\t\tfor j:=k+1 to max do\n\t\t\tif j mod 2=1 then s:=s+'L' else s:=s+'R';\n\t\twriteln(s);\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1538273486, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03245.html", "problem_id": "p03245", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03245/input.txt", "sample_output_relpath": "derived/input_output/data/p03245/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03245/Pascal/s323288468.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s323288468", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n1 2\nRL\nUU\nDR\n", "input_to_evaluate": "var\n\ti,j,k,n,max:longint;\n\tt,x,y:array[0..1010] of longint;\n\ts:ansistring;\nbegin\n\treadln(n);\n\tmax:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x[i],y[i]);\n\t\tt[i]:=abs(x[i])+abs(y[i]);\n\t\tif t[i] mod 2<>t[1] mod 2 then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\tif t[i]>max then max:=t[i];\n\tend;\n\twriteln(max);\n\tfor i:=1 to max do write(2-t[i] mod 2,' ');\n\twriteln;\n\tfor i:=1 to n do\n\tbegin\n\t\ts:='';\n\t\tif x[i]<0 then \n\t\t\tfor j:=1 to -x[i] do s:=s+'L'\n\t\telse if x[i]>0 then for j:=1 to x[i] do s:=s+'R';\n\t\tif y[i]<0 then \n\t\t\tfor j:=1 to -y[i] do s:=s+'D'\n\t\telse if y[i]>0 then for j:=1 to y[i] do s:=s+'U';\n\t\tk:=length(s);\n\t\tfor j:=k+1 to max do\n\t\t\tif j mod 2=1 then s:=s+'L' else s:=s+'R';\n\t\twriteln(s);\n\tend;\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke is introducing a robot arm with the following properties to his factory:\n\nThe robot arm consists of m sections and m+1 joints. The sections are numbered 1, 2, ..., m, and the joints are numbered 0, 1, ..., m. Section i connects Joint i-1 and Joint i. The length of Section i is d_i.\n\nFor each section, its mode can be specified individually. There are four modes: L, R, D and U. The mode of a section decides the direction of that section. If we consider the factory as a coordinate plane, the position of Joint i will be determined as follows (we denote its coordinates as (x_i, y_i)):\n\n(x_0, y_0) = (0, 0).\n\nIf the mode of Section i is L, (x_{i}, y_{i}) = (x_{i-1} - d_{i}, y_{i-1}).\n\nIf the mode of Section i is R, (x_{i}, y_{i}) = (x_{i-1} + d_{i}, y_{i-1}).\n\nIf the mode of Section i is D, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} - d_{i}).\n\nIf the mode of Section i is U, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} + d_{i}).\n\nSnuke would like to introduce a robot arm so that the position of Joint m can be matched with all of the N points (X_1, Y_1), (X_2, Y_2), ..., (X_N, Y_N) by properly specifying the modes of the sections.\nIs this possible?\nIf so, find such a robot arm and how to bring Joint m to each point (X_j, Y_j).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 1000\n\n-10^9 \\leq X_i \\leq 10^9\n\n-10^9 \\leq Y_i \\leq 10^9\n\nPartial Score\n\nIn the test cases worth 300 points, -10 \\leq X_i \\leq 10 and -10 \\leq Y_i \\leq 10 hold.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 Y_1\nX_2 Y_2\n:\nX_N Y_N\n\nOutput\n\nIf the condition can be satisfied, follow the following format. If the condition cannot be satisfied, print -1.\n\nm\nd_1 d_2 ... d_m\nw_1\nw_2\n:\nw_N\n\nm and d_i are the configurations of the robot arm. Refer to the problem statement for what each of them means.\nHere, 1 \\leq m \\leq 40 and 1 \\leq d_i \\leq 10^{12} must hold. Also, m and d_i must all be integers.\n\nw_j is a string of length m that represents the way to bring Joint m of the robot arm to point (X_j, Y_j).\nThe i-th character of w_j should be one of the letters L, R, D and U, representing the mode of Section i.\n\nSample Input 1\n\n3\n-1 0\n0 3\n2 -1\n\nSample Output 1\n\n2\n1 2\nRL\nUU\nDR\n\nIn the given way to bring Joint m of the robot arm to each (X_j, Y_j), the positions of the joints will be as follows:\n\nTo (X_1, Y_1) = (-1, 0): First, the position of Joint 0 is (x_0, y_0) = (0, 0). As the mode of Section 1 is R, the position of Joint 1 is (x_1, y_1) = (1, 0). Then, as the mode of Section 2 is L, the position of Joint 2 is (x_2, y_2) = (-1, 0).\n\nTo (X_2, Y_2) = (0, 3): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, 1), (x_2, y_2) = (0, 3).\n\nTo (X_3, Y_3) = (2, -1): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, -1), (x_2, y_2) = (2, -1).\n\nSample Input 2\n\n5\n0 0\n1 0\n2 0\n3 0\n4 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n2\n1 1\n1 1\n\nSample Output 3\n\n2\n1 1\nRU\nUR\n\nThere may be duplicated points among (X_j, Y_j).\n\nSample Input 4\n\n3\n-7 -3\n7 3\n-3 -7\n\nSample Output 4\n\n5\n3 1 4 1 5\nLRDUL\nRDULR\nDULRD", "sample_input": "3\n-1 0\n0 3\n2 -1\n"}, "reference_outputs": ["2\n1 2\nRL\nUU\nDR\n"], "source_document_id": "p03245", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke is introducing a robot arm with the following properties to his factory:\n\nThe robot arm consists of m sections and m+1 joints. The sections are numbered 1, 2, ..., m, and the joints are numbered 0, 1, ..., m. Section i connects Joint i-1 and Joint i. The length of Section i is d_i.\n\nFor each section, its mode can be specified individually. There are four modes: L, R, D and U. The mode of a section decides the direction of that section. If we consider the factory as a coordinate plane, the position of Joint i will be determined as follows (we denote its coordinates as (x_i, y_i)):\n\n(x_0, y_0) = (0, 0).\n\nIf the mode of Section i is L, (x_{i}, y_{i}) = (x_{i-1} - d_{i}, y_{i-1}).\n\nIf the mode of Section i is R, (x_{i}, y_{i}) = (x_{i-1} + d_{i}, y_{i-1}).\n\nIf the mode of Section i is D, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} - d_{i}).\n\nIf the mode of Section i is U, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} + d_{i}).\n\nSnuke would like to introduce a robot arm so that the position of Joint m can be matched with all of the N points (X_1, Y_1), (X_2, Y_2), ..., (X_N, Y_N) by properly specifying the modes of the sections.\nIs this possible?\nIf so, find such a robot arm and how to bring Joint m to each point (X_j, Y_j).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 1000\n\n-10^9 \\leq X_i \\leq 10^9\n\n-10^9 \\leq Y_i \\leq 10^9\n\nPartial Score\n\nIn the test cases worth 300 points, -10 \\leq X_i \\leq 10 and -10 \\leq Y_i \\leq 10 hold.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 Y_1\nX_2 Y_2\n:\nX_N Y_N\n\nOutput\n\nIf the condition can be satisfied, follow the following format. If the condition cannot be satisfied, print -1.\n\nm\nd_1 d_2 ... d_m\nw_1\nw_2\n:\nw_N\n\nm and d_i are the configurations of the robot arm. Refer to the problem statement for what each of them means.\nHere, 1 \\leq m \\leq 40 and 1 \\leq d_i \\leq 10^{12} must hold. Also, m and d_i must all be integers.\n\nw_j is a string of length m that represents the way to bring Joint m of the robot arm to point (X_j, Y_j).\nThe i-th character of w_j should be one of the letters L, R, D and U, representing the mode of Section i.\n\nSample Input 1\n\n3\n-1 0\n0 3\n2 -1\n\nSample Output 1\n\n2\n1 2\nRL\nUU\nDR\n\nIn the given way to bring Joint m of the robot arm to each (X_j, Y_j), the positions of the joints will be as follows:\n\nTo (X_1, Y_1) = (-1, 0): First, the position of Joint 0 is (x_0, y_0) = (0, 0). As the mode of Section 1 is R, the position of Joint 1 is (x_1, y_1) = (1, 0). Then, as the mode of Section 2 is L, the position of Joint 2 is (x_2, y_2) = (-1, 0).\n\nTo (X_2, Y_2) = (0, 3): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, 1), (x_2, y_2) = (0, 3).\n\nTo (X_3, Y_3) = (2, -1): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, -1), (x_2, y_2) = (2, -1).\n\nSample Input 2\n\n5\n0 0\n1 0\n2 0\n3 0\n4 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n2\n1 1\n1 1\n\nSample Output 3\n\n2\n1 1\nRU\nUR\n\nThere may be duplicated points among (X_j, Y_j).\n\nSample Input 4\n\n3\n-7 -3\n7 3\n-3 -7\n\nSample Output 4\n\n5\n3 1 4 1 5\nLRDUL\nRDULR\nDULRD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 704, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s954326750", "group_id": "codeNet:p03245", "input_text": "var\n\ti,j,k,n,max:longint;\n\tt,x,y:array[0..1010] of longint;\n\ts:string;\nbegin\n\treadln(n);\n\tmax:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x[i],y[i]);\n\t\tt[i]:=abs(x[i])+abs(y[i]);\n\t\tif t[i] mod 2<>t[1] mod 2 then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\tif t[i]>max then max:=t[i];\n\tend;\n\twriteln(max);\n\tfor i:=1 to max do write(2-t[i] mod 2,' ');\n\twriteln;\n\tfor i:=1 to n do\n\tbegin\n\t\ts:='';\n\t\tif x[i]<0 then \n\t\t\tfor j:=1 to -x[i] do s:=s+'L'\n\t\telse if x[i]>0 then for j:=1 to x[i] do s:=s+'R';\n\t\tif y[i]<0 then \n\t\t\tfor j:=1 to -y[i] do s:=s+'D'\n\t\telse if y[i]>0 then for j:=1 to y[i] do s:=s+'U';\n\t\tk:=length(s);\n\t\tfor j:=k+1 to max do\n\t\t\tif j mod 2=1 then s:=s+'L' else s:=s+'R';\n\t\twriteln(s);\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1538273412, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03245.html", "problem_id": "p03245", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03245/input.txt", "sample_output_relpath": "derived/input_output/data/p03245/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03245/Pascal/s954326750.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s954326750", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n1 2\nRL\nUU\nDR\n", "input_to_evaluate": "var\n\ti,j,k,n,max:longint;\n\tt,x,y:array[0..1010] of longint;\n\ts:string;\nbegin\n\treadln(n);\n\tmax:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x[i],y[i]);\n\t\tt[i]:=abs(x[i])+abs(y[i]);\n\t\tif t[i] mod 2<>t[1] mod 2 then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\tif t[i]>max then max:=t[i];\n\tend;\n\twriteln(max);\n\tfor i:=1 to max do write(2-t[i] mod 2,' ');\n\twriteln;\n\tfor i:=1 to n do\n\tbegin\n\t\ts:='';\n\t\tif x[i]<0 then \n\t\t\tfor j:=1 to -x[i] do s:=s+'L'\n\t\telse if x[i]>0 then for j:=1 to x[i] do s:=s+'R';\n\t\tif y[i]<0 then \n\t\t\tfor j:=1 to -y[i] do s:=s+'D'\n\t\telse if y[i]>0 then for j:=1 to y[i] do s:=s+'U';\n\t\tk:=length(s);\n\t\tfor j:=k+1 to max do\n\t\t\tif j mod 2=1 then s:=s+'L' else s:=s+'R';\n\t\twriteln(s);\n\tend;\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke is introducing a robot arm with the following properties to his factory:\n\nThe robot arm consists of m sections and m+1 joints. The sections are numbered 1, 2, ..., m, and the joints are numbered 0, 1, ..., m. Section i connects Joint i-1 and Joint i. The length of Section i is d_i.\n\nFor each section, its mode can be specified individually. There are four modes: L, R, D and U. The mode of a section decides the direction of that section. If we consider the factory as a coordinate plane, the position of Joint i will be determined as follows (we denote its coordinates as (x_i, y_i)):\n\n(x_0, y_0) = (0, 0).\n\nIf the mode of Section i is L, (x_{i}, y_{i}) = (x_{i-1} - d_{i}, y_{i-1}).\n\nIf the mode of Section i is R, (x_{i}, y_{i}) = (x_{i-1} + d_{i}, y_{i-1}).\n\nIf the mode of Section i is D, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} - d_{i}).\n\nIf the mode of Section i is U, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} + d_{i}).\n\nSnuke would like to introduce a robot arm so that the position of Joint m can be matched with all of the N points (X_1, Y_1), (X_2, Y_2), ..., (X_N, Y_N) by properly specifying the modes of the sections.\nIs this possible?\nIf so, find such a robot arm and how to bring Joint m to each point (X_j, Y_j).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 1000\n\n-10^9 \\leq X_i \\leq 10^9\n\n-10^9 \\leq Y_i \\leq 10^9\n\nPartial Score\n\nIn the test cases worth 300 points, -10 \\leq X_i \\leq 10 and -10 \\leq Y_i \\leq 10 hold.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 Y_1\nX_2 Y_2\n:\nX_N Y_N\n\nOutput\n\nIf the condition can be satisfied, follow the following format. If the condition cannot be satisfied, print -1.\n\nm\nd_1 d_2 ... d_m\nw_1\nw_2\n:\nw_N\n\nm and d_i are the configurations of the robot arm. Refer to the problem statement for what each of them means.\nHere, 1 \\leq m \\leq 40 and 1 \\leq d_i \\leq 10^{12} must hold. Also, m and d_i must all be integers.\n\nw_j is a string of length m that represents the way to bring Joint m of the robot arm to point (X_j, Y_j).\nThe i-th character of w_j should be one of the letters L, R, D and U, representing the mode of Section i.\n\nSample Input 1\n\n3\n-1 0\n0 3\n2 -1\n\nSample Output 1\n\n2\n1 2\nRL\nUU\nDR\n\nIn the given way to bring Joint m of the robot arm to each (X_j, Y_j), the positions of the joints will be as follows:\n\nTo (X_1, Y_1) = (-1, 0): First, the position of Joint 0 is (x_0, y_0) = (0, 0). As the mode of Section 1 is R, the position of Joint 1 is (x_1, y_1) = (1, 0). Then, as the mode of Section 2 is L, the position of Joint 2 is (x_2, y_2) = (-1, 0).\n\nTo (X_2, Y_2) = (0, 3): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, 1), (x_2, y_2) = (0, 3).\n\nTo (X_3, Y_3) = (2, -1): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, -1), (x_2, y_2) = (2, -1).\n\nSample Input 2\n\n5\n0 0\n1 0\n2 0\n3 0\n4 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n2\n1 1\n1 1\n\nSample Output 3\n\n2\n1 1\nRU\nUR\n\nThere may be duplicated points among (X_j, Y_j).\n\nSample Input 4\n\n3\n-7 -3\n7 3\n-3 -7\n\nSample Output 4\n\n5\n3 1 4 1 5\nLRDUL\nRDULR\nDULRD", "sample_input": "3\n-1 0\n0 3\n2 -1\n"}, "reference_outputs": ["2\n1 2\nRL\nUU\nDR\n"], "source_document_id": "p03245", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke is introducing a robot arm with the following properties to his factory:\n\nThe robot arm consists of m sections and m+1 joints. The sections are numbered 1, 2, ..., m, and the joints are numbered 0, 1, ..., m. Section i connects Joint i-1 and Joint i. The length of Section i is d_i.\n\nFor each section, its mode can be specified individually. There are four modes: L, R, D and U. The mode of a section decides the direction of that section. If we consider the factory as a coordinate plane, the position of Joint i will be determined as follows (we denote its coordinates as (x_i, y_i)):\n\n(x_0, y_0) = (0, 0).\n\nIf the mode of Section i is L, (x_{i}, y_{i}) = (x_{i-1} - d_{i}, y_{i-1}).\n\nIf the mode of Section i is R, (x_{i}, y_{i}) = (x_{i-1} + d_{i}, y_{i-1}).\n\nIf the mode of Section i is D, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} - d_{i}).\n\nIf the mode of Section i is U, (x_{i}, y_{i}) = (x_{i-1}, y_{i-1} + d_{i}).\n\nSnuke would like to introduce a robot arm so that the position of Joint m can be matched with all of the N points (X_1, Y_1), (X_2, Y_2), ..., (X_N, Y_N) by properly specifying the modes of the sections.\nIs this possible?\nIf so, find such a robot arm and how to bring Joint m to each point (X_j, Y_j).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 1000\n\n-10^9 \\leq X_i \\leq 10^9\n\n-10^9 \\leq Y_i \\leq 10^9\n\nPartial Score\n\nIn the test cases worth 300 points, -10 \\leq X_i \\leq 10 and -10 \\leq Y_i \\leq 10 hold.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 Y_1\nX_2 Y_2\n:\nX_N Y_N\n\nOutput\n\nIf the condition can be satisfied, follow the following format. If the condition cannot be satisfied, print -1.\n\nm\nd_1 d_2 ... d_m\nw_1\nw_2\n:\nw_N\n\nm and d_i are the configurations of the robot arm. Refer to the problem statement for what each of them means.\nHere, 1 \\leq m \\leq 40 and 1 \\leq d_i \\leq 10^{12} must hold. Also, m and d_i must all be integers.\n\nw_j is a string of length m that represents the way to bring Joint m of the robot arm to point (X_j, Y_j).\nThe i-th character of w_j should be one of the letters L, R, D and U, representing the mode of Section i.\n\nSample Input 1\n\n3\n-1 0\n0 3\n2 -1\n\nSample Output 1\n\n2\n1 2\nRL\nUU\nDR\n\nIn the given way to bring Joint m of the robot arm to each (X_j, Y_j), the positions of the joints will be as follows:\n\nTo (X_1, Y_1) = (-1, 0): First, the position of Joint 0 is (x_0, y_0) = (0, 0). As the mode of Section 1 is R, the position of Joint 1 is (x_1, y_1) = (1, 0). Then, as the mode of Section 2 is L, the position of Joint 2 is (x_2, y_2) = (-1, 0).\n\nTo (X_2, Y_2) = (0, 3): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, 1), (x_2, y_2) = (0, 3).\n\nTo (X_3, Y_3) = (2, -1): (x_0, y_0) = (0, 0), (x_1, y_1) = (0, -1), (x_2, y_2) = (2, -1).\n\nSample Input 2\n\n5\n0 0\n1 0\n2 0\n3 0\n4 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n2\n1 1\n1 1\n\nSample Output 3\n\n2\n1 1\nRU\nUR\n\nThere may be duplicated points among (X_j, Y_j).\n\nSample Input 4\n\n3\n-7 -3\n7 3\n-3 -7\n\nSample Output 4\n\n5\n3 1 4 1 5\nLRDUL\nRDULR\nDULRD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 700, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s593744426", "group_id": "codeNet:p03246", "input_text": "var\n a,a1,a2:array[0..200000] of longint;\n b,c,i,j,k,t,n,m,x,y,xx,yy,x1,y1:longint;\nfunction max(xxx,yyy:longint):longint;\nbegin\n if xxx>yyy then max:=xxx else max:=yyy;\nend;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n if i mod 2=1 then inc(a1[a[i]]);\n if i mod 2=0 then inc(a2[a[i]]);\n end;\n x:=0; y:=0;\n xx:=0; yy:=0;\n b:=0; c:=0;\n t:=0;\n for i:=1 to 100000 do\n begin\n if a1[i]>b then begin x:=i; b:=a1[i]; end;\n if a2[i]>c then begin y:=i; c:=a2[i]; end;\n end;\n x1:=a1[x]; y1:=a2[y];\n a1[x]:=0; b:=0;\n a2[y]:=0; c:=0;\n for i:=1 to 100000 do\n begin\n if a1[i]>b then begin xx:=i; b:=a1[i]; end;\n if a2[i]>c then begin yy:=i; c:=a2[i]; end;\n end;\n if x=y then t:=max(x1+a2[yy],a1[xx]+y1) else t:=x1+y1;\n writeln(n-t);\nend.\n", "language": "Pascal", "metadata": {"date": 1538272491, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03246.html", "problem_id": "p03246", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03246/input.txt", "sample_output_relpath": "derived/input_output/data/p03246/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03246/Pascal/s593744426.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s593744426", "user_id": "u121412807"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a,a1,a2:array[0..200000] of longint;\n b,c,i,j,k,t,n,m,x,y,xx,yy,x1,y1:longint;\nfunction max(xxx,yyy:longint):longint;\nbegin\n if xxx>yyy then max:=xxx else max:=yyy;\nend;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n if i mod 2=1 then inc(a1[a[i]]);\n if i mod 2=0 then inc(a2[a[i]]);\n end;\n x:=0; y:=0;\n xx:=0; yy:=0;\n b:=0; c:=0;\n t:=0;\n for i:=1 to 100000 do\n begin\n if a1[i]>b then begin x:=i; b:=a1[i]; end;\n if a2[i]>c then begin y:=i; c:=a2[i]; end;\n end;\n x1:=a1[x]; y1:=a2[y];\n a1[x]:=0; b:=0;\n a2[y]:=0; c:=0;\n for i:=1 to 100000 do\n begin\n if a1[i]>b then begin xx:=i; b:=a1[i]; end;\n if a2[i]>c then begin yy:=i; c:=a2[i]; end;\n end;\n if x=y then t:=max(x1+a2[yy],a1[xx]+y1) else t:=x1+y1;\n writeln(n-t);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03246", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 779, "cpu_time_ms": 14, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s356315785", "group_id": "codeNet:p03246", "input_text": "var\n n,x,i,max,min,atot1,atot2,btot1,btot2,ta,tb:longint;\n a,b:array[0..100010] of longint;\nbegin\n readln(n);\n max:=0;min:=maxlongint;\n fillchar(a,sizeof(a),0);\n fillchar(b,sizeof(b),0);\n for i:=1 to n do\n begin\n read(x);\n if odd(i) then inc(a[x]) else inc(b[x]);\n if x>max then max:=x \n else if xatot1 then \n begin \n atot2:=atot1;atot1:=a[i];ta:=i;\n end\n else if a[i]>=atot2 then atot2:=a[i];\n if b[i]>btot1 then\n begin \n btot2:=btot1;btot1:=b[i];tb:=i;\n end\n else if b[i]>=btot2 then btot2:=b[i];\n end;\n if ta<>tb then writeln(n-atot1-btot1)\n else if atot1+btot2>atot2+btot1 then writeln(n-atot1-btot2)\n else writeln(n-atot2-btot1);\nend.", "language": "Pascal", "metadata": {"date": 1538270654, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03246.html", "problem_id": "p03246", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03246/input.txt", "sample_output_relpath": "derived/input_output/data/p03246/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03246/Pascal/s356315785.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s356315785", "user_id": "u960852022"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,x,i,max,min,atot1,atot2,btot1,btot2,ta,tb:longint;\n a,b:array[0..100010] of longint;\nbegin\n readln(n);\n max:=0;min:=maxlongint;\n fillchar(a,sizeof(a),0);\n fillchar(b,sizeof(b),0);\n for i:=1 to n do\n begin\n read(x);\n if odd(i) then inc(a[x]) else inc(b[x]);\n if x>max then max:=x \n else if xatot1 then \n begin \n atot2:=atot1;atot1:=a[i];ta:=i;\n end\n else if a[i]>=atot2 then atot2:=a[i];\n if b[i]>btot1 then\n begin \n btot2:=btot1;btot1:=b[i];tb:=i;\n end\n else if b[i]>=btot2 then btot2:=b[i];\n end;\n if ta<>tb then writeln(n-atot1-btot1)\n else if atot1+btot2>atot2+btot1 then writeln(n-atot1-btot2)\n else writeln(n-atot2-btot1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03246", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 948, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s174828688", "group_id": "codeNet:p03248", "input_text": "var\ns:ansistring;\nn,i,j,root :longint;\nbegin\n readln(s);\n n:=length(s);\n\n if (s[1]='0')or(s[n]='1') then\n begin\n writeln('-1');\n exit;\n end;\n\n for i:=2 to n-1 do\n begin\n if s[i]='1' then if s[n-i]='0' then begin writeln('-1'); exit; end;\n if s[i]='0' then if s[n-i]='1' then begin writeln('-1'); exit; end;\n end;\n root:=1;\n // writeln(1,' ',2);\n\n for i:=1 to n-1 do\n begin\n writeln(root,' ',i+1);\n if s[i]='1' then root:=i+1;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538274264, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s174828688.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s174828688", "user_id": "u168380603"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\ns:ansistring;\nn,i,j,root :longint;\nbegin\n readln(s);\n n:=length(s);\n\n if (s[1]='0')or(s[n]='1') then\n begin\n writeln('-1');\n exit;\n end;\n\n for i:=2 to n-1 do\n begin\n if s[i]='1' then if s[n-i]='0' then begin writeln('-1'); exit; end;\n if s[i]='0' then if s[n-i]='1' then begin writeln('-1'); exit; end;\n end;\n root:=1;\n // writeln(1,' ',2);\n\n for i:=1 to n-1 do\n begin\n writeln(root,' ',i+1);\n if s[i]='1' then root:=i+1;\n end;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 26, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s828680167", "group_id": "codeNet:p03248", "input_text": "var\n n,i,j,k,t,root:longint;\n a:array[1..10000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n div 2 do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1; \n for i:=2 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538273771, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s828680167.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s828680167", "user_id": "u249197223"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\n n,i,j,k,t,root:longint;\n a:array[1..10000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n div 2 do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1; \n for i:=2 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 654, "cpu_time_ms": 30, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s358397799", "group_id": "codeNet:p03248", "input_text": "var\n a:array[1..200000] of longint;\n b,c,i,j,k,t,n,m,x,y:longint;\n s:ansistring;\nbegin\n readln(s);\n n:=length(s);\n k:=0;\n for i:=1 to n-1 do\n if s[i]='1' then if s[n-i]='0' then k:=1;\n if s[1]='0' then k:=1;\n if s[n]='1' then k:=1;\n if k=1 then writeln('-1') else\n begin\n x:=1;\n for i:=1 to n-1 do\n begin\n writeln(x,' ',i+1);\n if s[i]='1' then x:=i+1;\n end;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538273215, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s358397799.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s358397799", "user_id": "u121412807"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\n a:array[1..200000] of longint;\n b,c,i,j,k,t,n,m,x,y:longint;\n s:ansistring;\nbegin\n readln(s);\n n:=length(s);\n k:=0;\n for i:=1 to n-1 do\n if s[i]='1' then if s[n-i]='0' then k:=1;\n if s[1]='0' then k:=1;\n if s[n]='1' then k:=1;\n if k=1 then writeln('-1') else\n begin\n x:=1;\n for i:=1 to n-1 do\n begin\n writeln(x,' ',i+1);\n if s[i]='1' then x:=i+1;\n end;\n end;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 404, "cpu_time_ms": 27, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s566342332", "group_id": "codeNet:p03252", "input_text": "var\n\ts,t:String;\n\tc,d:array[0..25]of Longint;\n\ti,j,k:Longint;\nbegin\n\treadln(s);\n\treadln(t);\n\tfor i:=0 to 25 do begin\n\t\tc[i]:=-1;\n\t\td[i]:=-1;\n\tend;\n\tfor i:=1 to length(s) do begin\n\t\tj:=ord(s[i])-97;\n\t\tk:=ord(t[i])-97;\n\t\tif c[j]=-1 then c[j]:=k;\n\t\tif d[k]=-1 then d[k]:=j;\n\t\tif(c[j]<>k)or(d[k]<>j)then begin\n\t\t\twriteln('No');\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1537805226, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Pascal/s566342332.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s566342332", "user_id": "u060797441"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\ts,t:String;\n\tc,d:array[0..25]of Longint;\n\ti,j,k:Longint;\nbegin\n\treadln(s);\n\treadln(t);\n\tfor i:=0 to 25 do begin\n\t\tc[i]:=-1;\n\t\td[i]:=-1;\n\tend;\n\tfor i:=1 to length(s) do begin\n\t\tj:=ord(s[i])-97;\n\t\tk:=ord(t[i])-97;\n\t\tif c[j]=-1 then c[j]:=k;\n\t\tif d[k]=-1 then d[k]:=j;\n\t\tif(c[j]<>k)or(d[k]<>j)then begin\n\t\t\twriteln('No');\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('Yes');\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 368, "cpu_time_ms": 2, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s696960815", "group_id": "codeNet:p03252", "input_text": "var s1,s2:ansistring;\nc:array['a'..'z']of 0..1;\nf:array['a'..'z']of 'a'..'z';\ni:longint;\nbegin \n\treadln(s1);\n\treadln(s2);\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s1[i]]=0 then \n\t\tbegin \n\t\t\tf[s1[i]]:=s2[i];\n\t\t\tc[s1[i]]:=1;\n\t\tend\n\t\telse if s2[i]<>f[s1[i]] then begin write('No1');halt;end;\n\tend;\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s2[i]]=0 then \n\t\tbegin \n\t\t\tf[s2[i]]:=s1[i];\n\t\t\tc[s2[i]]:=1;\n\t\tend\n\t\telse if s1[i]<>f[s2[i]] then begin write('No');halt;end;\n\tend;\n\twrite('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1537760418, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Pascal/s696960815.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s696960815", "user_id": "u914335902"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s1,s2:ansistring;\nc:array['a'..'z']of 0..1;\nf:array['a'..'z']of 'a'..'z';\ni:longint;\nbegin \n\treadln(s1);\n\treadln(s2);\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s1[i]]=0 then \n\t\tbegin \n\t\t\tf[s1[i]]:=s2[i];\n\t\t\tc[s1[i]]:=1;\n\t\tend\n\t\telse if s2[i]<>f[s1[i]] then begin write('No1');halt;end;\n\tend;\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s2[i]]=0 then \n\t\tbegin \n\t\t\tf[s2[i]]:=s1[i];\n\t\t\tc[s2[i]]:=1;\n\t\tend\n\t\telse if s1[i]<>f[s2[i]] then begin write('No');halt;end;\n\tend;\n\twrite('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 540, "cpu_time_ms": 2, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s938487681", "group_id": "codeNet:p03253", "input_text": "var\n\tn,m,ans,mo,p:int64;\n\tfac:array[0..131072]of int64;\n\ti:Longint;\nfunction power(a,b:int64):int64;\nvar ret:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\tret:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then ret:=ret*a mod 1000000007;\n\t\tpower:=ret;\n\tend;\nend;\nbegin\n\tread(n,m);\n\tans:=1;\n\tmo:=1000000007;\n\tfac[0]:=1;\n\tfor i:=1 to 131071 do fac[i]:=fac[i-1]*i mod mo;\n\ti:=2;\n\twhile i*i<=m do begin\n\t\tif m mod i=0 then begin\n\t\t\tp:=0;\n\t\t\twhile m mod i=0 do begin\n\t\t\t\tm:=m div i;\n\t\t\t\tinc(p);\n\t\t\tend;\n\t\t\tans:=ans*fac[n+p-1]mod mo*power(fac[n-1],mo-2)mod mo*power(fac[p],mo-2)mod mo;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif m>1 then ans:=ans*fac[n]mod mo*power(fac[n-1],mo-2)mod mo;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1537764657, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Pascal/s938487681.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s938487681", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tn,m,ans,mo,p:int64;\n\tfac:array[0..131072]of int64;\n\ti:Longint;\nfunction power(a,b:int64):int64;\nvar ret:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\tret:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then ret:=ret*a mod 1000000007;\n\t\tpower:=ret;\n\tend;\nend;\nbegin\n\tread(n,m);\n\tans:=1;\n\tmo:=1000000007;\n\tfac[0]:=1;\n\tfor i:=1 to 131071 do fac[i]:=fac[i-1]*i mod mo;\n\ti:=2;\n\twhile i*i<=m do begin\n\t\tif m mod i=0 then begin\n\t\t\tp:=0;\n\t\t\twhile m mod i=0 do begin\n\t\t\t\tm:=m div i;\n\t\t\t\tinc(p);\n\t\t\tend;\n\t\t\tans:=ans*fac[n+p-1]mod mo*power(fac[n-1],mo-2)mod mo*power(fac[p],mo-2)mod mo;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif m>1 then ans:=ans*fac[n]mod mo*power(fac[n-1],mo-2)mod mo;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 693, "cpu_time_ms": 3, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s282667796", "group_id": "codeNet:p03255", "input_text": "var i,j,len:longint;\n k,l,m,n,q,w,x,ans,rst:int64;\n a,b,s:Array[0..1000000] of int64;\nbegin\n readln(n,x);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do s[i]:=s[i-1]+a[i];\n readln;\n rst:=(maxlongint-100)*maxlongint;\n for len:=1 to n do begin\n ans:=0;\n ans:=ans+(s[n]-s[n-len])*5;\n w:=5;j:=n-len;\n while j>len do begin\n ans:=ans+w*(s[j]-s[j-len]);\n j:=j-len;\n w:=w+2;\n end;\n ans:=ans+w*s[j]+len*x;\n if anslen do begin\n ans:=ans+w*(s[j]-s[j-len]);\n j:=j-len;\n w:=w+2;\n end;\n ans:=ans+w*s[j]+len*x;\n if ans0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536459848, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s793348032.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s793348032", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..200000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1290, "cpu_time_ms": 67, "memory_kb": 4224}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s021330460", "group_id": "codeNet:p03263", "input_text": "var\n n,m,i,j,x,cnt:longint;\n a:array[0..501,0..501] of longint;\n x1,y1,x2,y2:array[0..25001] of longint;\nbegin\n readln(n,m);\n cnt:=0;\n for i:=1 to n do\n begin \n for j:=1 to m-1 do\n begin\n read(x);inc(a[i,j],x);\n if odd(a[i,j]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i;y1[cnt]:=j;y2[cnt]:=j+1;\n inc(a[i,j+1]);\n end;\n end;\n read(x);inc(a[i,m],x);\n if odd(a[i,m]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i+1;y1[cnt]:=m;y2[cnt]:=m;\n inc(a[i+1,m]);\n end;\n end;\n if odd(a[n,m]) then dec(cnt);\n writeln(cnt);\n for i:=1 to cnt do\n writeln(x1[i],' ',y1[i],' ',x2[i],' ',y2[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536459010, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s021330460.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s021330460", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "var\n n,m,i,j,x,cnt:longint;\n a:array[0..501,0..501] of longint;\n x1,y1,x2,y2:array[0..25001] of longint;\nbegin\n readln(n,m);\n cnt:=0;\n for i:=1 to n do\n begin \n for j:=1 to m-1 do\n begin\n read(x);inc(a[i,j],x);\n if odd(a[i,j]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i;y1[cnt]:=j;y2[cnt]:=j+1;\n inc(a[i,j+1]);\n end;\n end;\n read(x);inc(a[i,m],x);\n if odd(a[i,m]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i+1;y1[cnt]:=m;y2[cnt]:=m;\n inc(a[i+1,m]);\n end;\n end;\n if odd(a[n,m]) then dec(cnt);\n writeln(cnt);\n for i:=1 to cnt do\n writeln(x1[i],' ',y1[i],' ',x2[i],' ',y2[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 947, "cpu_time_ms": 101, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s826443273", "group_id": "codeNet:p03263", "input_text": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..3000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536458419, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s826443273.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s826443273", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..3000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1263, "cpu_time_ms": 23, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s628931261", "group_id": "codeNet:p03263", "input_text": "var\n a:array[-10..510,-10..510]of longint;\n i,j,n,m:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n for j:=1 to m do\n begin\n read(a[i,j]);\n if j=m then readln;\n end;\n writeln(n*m-1);\n for i:=1 to n do\n for j:=1 to m-1 do\n writeln(i,' ',j,' ',i,' ',j+1);\n for i:=1 to n-1 do\n writeln(i,' ',m,' ',i+1,' ',m);\nend.", "language": "Pascal", "metadata": {"date": 1536457659, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s628931261.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s628931261", "user_id": "u223928734"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "var\n a:array[-10..510,-10..510]of longint;\n i,j,n,m:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n for j:=1 to m do\n begin\n read(a[i,j]);\n if j=m then readln;\n end;\n writeln(n*m-1);\n for i:=1 to n do\n for j:=1 to m-1 do\n writeln(i,' ',j,' ',i,' ',j+1);\n for i:=1 to n-1 do\n writeln(i,' ',m,' ',i+1,' ',m);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 356, "cpu_time_ms": 107, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s243820869", "group_id": "codeNet:p03266", "input_text": "var\n\ts:int64;\n\ta,n,k:longint;\nfunction ans(x:longint):int64;\nbegin\n\tif x mod k=0 then exit(n div k)\n\telse exit(n div k+1);\nend;\nbegin\n\tread(n,k);\n\ts:=0;\n\tfor a:=1 to n do\n\t\tif (a mod k=0) or (a mod k=k div 2) then\n\t\t\ts:=s+ans(a)*ans(k-a);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535855990, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Pascal/s243820869.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s243820869", "user_id": "u957998623"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n\ts:int64;\n\ta,n,k:longint;\nfunction ans(x:longint):int64;\nbegin\n\tif x mod k=0 then exit(n div k)\n\telse exit(n div k+1);\nend;\nbegin\n\tread(n,k);\n\ts:=0;\n\tfor a:=1 to n do\n\t\tif (a mod k=0) or (a mod k=k div 2) then\n\t\t\ts:=s+ans(a)*ans(k-a);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s047517026", "group_id": "codeNet:p03266", "input_text": "var\n\ta,b,c:longint;\n\tn,k,s:int64;\nfunction ans(x:longint):int64;\nbegin\n\tif x mod k=0 then exit(n div k)\n\telse exit(n div k+1);\nend;\nbegin\n\tread(n,k);\n\ts:=0;\n\tfor a:=1 to n do\n\t\tif (a mod k=0) or (k mod 2=0) and (a mod k=k div 2) then\n\t\t\ts:=s+ans(a)*ans(k-a);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535855783, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Pascal/s047517026.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s047517026", "user_id": "u957998623"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n\ta,b,c:longint;\n\tn,k,s:int64;\nfunction ans(x:longint):int64;\nbegin\n\tif x mod k=0 then exit(n div k)\n\telse exit(n div k+1);\nend;\nbegin\n\tread(n,k);\n\ts:=0;\n\tfor a:=1 to n do\n\t\tif (a mod k=0) or (k mod 2=0) and (a mod k=k div 2) then\n\t\t\ts:=s+ans(a)*ans(k-a);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 276, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s231383904", "group_id": "codeNet:p03266", "input_text": "var n,k,i:longint;\na:array[1..3]of longint;\nb:array[1..200000]of longint;\ncount,m:longint;\nprocedure dfs(x:integer);\nvar j:longint;\nbegin \n\tif x>3 then \n\tbegin \n\t\tif (a[1]+a[3]) mod k=0 then inc(count);\n\t\texit;\n\tend;\n\tfor j:=1 to m do \n\t\tif ((b[j]-a[x-1])<=n) and ((b[j]-a[x-1])>0) then \n\t\tbegin \n\t\t\ta[x]:=b[j]-a[x-1];\n\t\t\tdfs(x+1);\n\t\tend\n\t\telse if b[j]-a[x-1]>n then exit;\nend;\nbegin \n\tread(n,k);\n\tm:=2*n div k;\n\tfor i:=1 to m do b[i]:=i*k;\n\tfor i:=1 to n do \n\tbegin \n\t\ta[1]:=i;\n\t\tdfs(2);\n\tend;\n\twrite(count);\nend.\n", "language": "Pascal", "metadata": {"date": 1535855534, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Pascal/s231383904.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s231383904", "user_id": "u914335902"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var n,k,i:longint;\na:array[1..3]of longint;\nb:array[1..200000]of longint;\ncount,m:longint;\nprocedure dfs(x:integer);\nvar j:longint;\nbegin \n\tif x>3 then \n\tbegin \n\t\tif (a[1]+a[3]) mod k=0 then inc(count);\n\t\texit;\n\tend;\n\tfor j:=1 to m do \n\t\tif ((b[j]-a[x-1])<=n) and ((b[j]-a[x-1])>0) then \n\t\tbegin \n\t\t\ta[x]:=b[j]-a[x-1];\n\t\t\tdfs(x+1);\n\t\tend\n\t\telse if b[j]-a[x-1]>n then exit;\nend;\nbegin \n\tread(n,k);\n\tm:=2*n div k;\n\tfor i:=1 to m do b[i]:=i*k;\n\tfor i:=1 to n do \n\tbegin \n\t\ta[1]:=i;\n\t\tdfs(2);\n\tend;\n\twrite(count);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s774699080", "group_id": "codeNet:p03266", "input_text": "var\n i,k,n,q,j:longint;\n ans:qword;\nbegin\n readln(n,k);\n i:=k div 2;\n while i<=n do\n begin\n j:=k-(i mod k);\n while j<=n do\n begin\n\t q:=i mod k;\n\t if q=0 then q:=k;\n\t if ((i+q) mod k=0) then \n while q<=n do\n\t begin\n if ((i+q) mod k=0)and((q+j) mod k=0) then begin ans:=ans+1; q:=q+k; continue; end;\n\t\t inc(q);\n\t end;\n\t j:=j+k;\n\tend;\n\tinc(i);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1535855071, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Pascal/s774699080.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s774699080", "user_id": "u223928734"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n i,k,n,q,j:longint;\n ans:qword;\nbegin\n readln(n,k);\n i:=k div 2;\n while i<=n do\n begin\n j:=k-(i mod k);\n while j<=n do\n begin\n\t q:=i mod k;\n\t if q=0 then q:=k;\n\t if ((i+q) mod k=0) then \n while q<=n do\n\t begin\n if ((i+q) mod k=0)and((q+j) mod k=0) then begin ans:=ans+1; q:=q+k; continue; end;\n\t\t inc(q);\n\t end;\n\t j:=j+k;\n\tend;\n\tinc(i);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s278780804", "group_id": "codeNet:p03272", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\tif p=k then\n\tbegin\n\t\tif abs(f[1])=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535335367, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03272.html", "problem_id": "p03272", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03272/input.txt", "sample_output_relpath": "derived/input_output/data/p03272/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03272/Pascal/s278780804.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s278780804", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\tif p=k then\n\tbegin\n\t\tif abs(f[1])=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is an N-car train.\n\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN i\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 2\n\nSample Output 1\n\n3\n\nThe second car from the front of a 4-car train is the third car from the back.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n15 11\n\nSample Output 3\n\n5", "sample_input": "4 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03272", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is an N-car train.\n\nYou are given an integer i. Find the value of j such that the following statement is true: \"the i-th car from the front of the train is the j-th car from the back.\"\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN i\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4 2\n\nSample Output 1\n\n3\n\nThe second car from the front of a 4-car train is the third car from the back.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n15 11\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 990, "cpu_time_ms": 1, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s770462016", "group_id": "codeNet:p03273", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array of array of char;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n bh,bw:array of Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Read(h);\n Readln(w);\n count:=0;\n max :=0;\n min :=100;\n\n if (h=1)and(w=1) then begin\n Writeln('#');\n exit\n end;\n\n SetLength(bh,h);\n SetLength(bw,w);\n\n SetLength(l,h);\n for i := 0 to h do\n SetLength(l[i],w);\n\n for i := 0 to h-1 do begin\n for j := 0 to w-1 do begin\n Read(l[i][j]); //読み込む\n if l[i][j]='#' then //ついでに横一行を記憶\n bh[i]:=True;\n end;\n Readln;\n end;\n\n for j := 0 to w-1 do begin //縦\n for i := 0 to h-1 do\n if l[i][j]='#' then\n bw[j]:=True;\n end;\n\n for i := 0 to h-1 do begin\n if bh[i] then begin //消す行なら1行まるごと飛ばす\n for j := 0 to w-1 do begin\n if bw[j] then //消す列なら1個ずつまたぐ\n Write(l[i][j]);\n end;\n Writeln;\n end;\n end;\n\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1540954478, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s770462016.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s770462016", "user_id": "u755925739"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array of array of char;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n bh,bw:array of Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Read(h);\n Readln(w);\n count:=0;\n max :=0;\n min :=100;\n\n if (h=1)and(w=1) then begin\n Writeln('#');\n exit\n end;\n\n SetLength(bh,h);\n SetLength(bw,w);\n\n SetLength(l,h);\n for i := 0 to h do\n SetLength(l[i],w);\n\n for i := 0 to h-1 do begin\n for j := 0 to w-1 do begin\n Read(l[i][j]); //読み込む\n if l[i][j]='#' then //ついでに横一行を記憶\n bh[i]:=True;\n end;\n Readln;\n end;\n\n for j := 0 to w-1 do begin //縦\n for i := 0 to h-1 do\n if l[i][j]='#' then\n bw[j]:=True;\n end;\n\n for i := 0 to h-1 do begin\n if bh[i] then begin //消す行なら1行まるごと飛ばす\n for j := 0 to w-1 do begin\n if bw[j] then //消す列なら1個ずつまたぐ\n Write(l[i][j]);\n end;\n Writeln;\n end;\n end;\n\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1352, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s213354057", "group_id": "codeNet:p03273", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array of array of char;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n bh,bw:array of Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Read(h);\n Readln(w);\n count:=0;\n max :=0;\n min :=100;\n\n SetLength(bh,h);\n SetLength(bw,w);\n\n SetLength(l,h);\n for i := 0 to h do\n SetLength(l[i],w);\n\n for i := 0 to h-1 do begin\n for j := 0 to w-1 do begin\n Read(l[i][j]); //読み込む\n if l[i][j]='#' then //ついでに横一行を記憶\n bh[i]:=True;\n end;\n Readln;\n end;\n\n for j := 0 to w-1 do begin //縦\n for i := 0 to h-1 do\n if l[i][j]='#' then\n bw[j]:=True;\n end;\n\n for i := 0 to h-1 do begin\n if bh[i] then begin //消す行なら1行まるごと飛ばす\n for j := 0 to w-1 do begin\n if bw[j] then //消す列なら1個ずつまたぐ\n Write(l[i][j]);\n end;\n Writeln;\n end;\n end;\n\n Writeln;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1540953511, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s213354057.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s213354057", "user_id": "u755925739"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array of array of char;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n bh,bw:array of Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Read(h);\n Readln(w);\n count:=0;\n max :=0;\n min :=100;\n\n SetLength(bh,h);\n SetLength(bw,w);\n\n SetLength(l,h);\n for i := 0 to h do\n SetLength(l[i],w);\n\n for i := 0 to h-1 do begin\n for j := 0 to w-1 do begin\n Read(l[i][j]); //読み込む\n if l[i][j]='#' then //ついでに横一行を記憶\n bh[i]:=True;\n end;\n Readln;\n end;\n\n for j := 0 to w-1 do begin //縦\n for i := 0 to h-1 do\n if l[i][j]='#' then\n bw[j]:=True;\n end;\n\n for i := 0 to h-1 do begin\n if bh[i] then begin //消す行なら1行まるごと飛ばす\n for j := 0 to w-1 do begin\n if bw[j] then //消す列なら1個ずつまたぐ\n Write(l[i][j]);\n end;\n Writeln;\n end;\n end;\n\n Writeln;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1292, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s118077024", "group_id": "codeNet:p03273", "input_text": "var\n n,m,i,j:longint;\n x,y:array[1..1000]of boolean;\n a:array[1..1000,1..1000]of char;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n read(a[i,j]);\n readln;\n end;\n for i:=1 to n do\n begin\n x[i]:=true;\n for j:=1 to m do\n if a[i,j]='#' then x[i]:=false;\n end;\n for j:=1 to m do\n begin\n y[j]:=true;\n for i:=1 to n do\n if a[i,j]='#' then y[j]:=false;\n end;\n for i:=1 to n do\n begin\n for j:=1 to m do\n if not(x[i] or y[j]) then write(a[i,j]);\n if not x[i] then writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1538775807, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s118077024.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s118077024", "user_id": "u119860177"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n n,m,i,j:longint;\n x,y:array[1..1000]of boolean;\n a:array[1..1000,1..1000]of char;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n read(a[i,j]);\n readln;\n end;\n for i:=1 to n do\n begin\n x[i]:=true;\n for j:=1 to m do\n if a[i,j]='#' then x[i]:=false;\n end;\n for j:=1 to m do\n begin\n y[j]:=true;\n for i:=1 to n do\n if a[i,j]='#' then y[j]:=false;\n end;\n for i:=1 to n do\n begin\n for j:=1 to m do\n if not(x[i] or y[j]) then write(a[i,j]);\n if not x[i] then writeln;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 552, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s840174296", "group_id": "codeNet:p03273", "input_text": "var x,y,i,j,cou,k:integer;\nm:array[1..100,1..100]of char;\nbegin \n readln(x,y);\n for i:=1 to x do \n begin \n cou:=0;\n for j:=1 to y do \n begin read(m[i,j]);if m[i,j]='.' then inc(cou);end;\n if cou=y then for k:=1 to y do m[i,k]:='*';\n readln;\n end;\n for i:=1 to y do\n begin\n cou:=0;\n for j:=1 to x do \n if m[j,i]='#' then inc(cou);\n if cou=0 then for k:=1 to x do m[k,i]:='*';\n end;\n for i:=1 to x do \n begin\n\t\tcou:=0;\n\t\tfor j:=1 to y do\n\t\tif m[i,j]<>'*' then begin write(m[i,j]);cou:=1;end;\n\t\tif cou=1 then writeln; \n end;\nend.", "language": "Pascal", "metadata": {"date": 1535253918, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s840174296.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s840174296", "user_id": "u914335902"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var x,y,i,j,cou,k:integer;\nm:array[1..100,1..100]of char;\nbegin \n readln(x,y);\n for i:=1 to x do \n begin \n cou:=0;\n for j:=1 to y do \n begin read(m[i,j]);if m[i,j]='.' then inc(cou);end;\n if cou=y then for k:=1 to y do m[i,k]:='*';\n readln;\n end;\n for i:=1 to y do\n begin\n cou:=0;\n for j:=1 to x do \n if m[j,i]='#' then inc(cou);\n if cou=0 then for k:=1 to x do m[k,i]:='*';\n end;\n for i:=1 to x do \n begin\n\t\tcou:=0;\n\t\tfor j:=1 to y do\n\t\tif m[i,j]<>'*' then begin write(m[i,j]);cou:=1;end;\n\t\tif cou=1 then writeln; \n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 572, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s855886969", "group_id": "codeNet:p03273", "input_text": "var\n h,w,i,j:longint;\n a:array[0..101,0..101] of char;\n b,c:array[0..101] of boolean;\n flag:boolean;\nbegin\n readln(h,w);\n for i:=1 to h do\n begin \n for j:=1 to w do\n begin \n read(a[i,j]);\n if a[i,j]='#' then \n begin \n b[i]:=true;\n c[j]:=true;\n end;\n end;\n readln;\n end;\n for i:=1 to h do \n begin\n flag:=true;\n for j:=1 to w do\n if b[i] and c[j] then \n begin \n flag:=false;\n write(a[i,j]);\n end;\n if not flag then writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1535246076, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s855886969.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s855886969", "user_id": "u960852022"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n h,w,i,j:longint;\n a:array[0..101,0..101] of char;\n b,c:array[0..101] of boolean;\n flag:boolean;\nbegin\n readln(h,w);\n for i:=1 to h do\n begin \n for j:=1 to w do\n begin \n read(a[i,j]);\n if a[i,j]='#' then \n begin \n b[i]:=true;\n c[j]:=true;\n end;\n end;\n readln;\n end;\n for i:=1 to h do \n begin\n flag:=true;\n for j:=1 to w do\n if b[i] and c[j] then \n begin \n flag:=false;\n write(a[i,j]);\n end;\n if not flag then writeln;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 806, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s849232512", "group_id": "codeNet:p03273", "input_text": "var\n\tx,y:array[0..110] of boolean;\n\ta:array[0..110] of string[110];\n\tn,m,i,j:longint;\n\tch:string[110];\nbegin\n\treadln(n,m);\n\tfillchar(x,sizeof(x),true);\n\tfillchar(y,sizeof(y),true);\n\tfor i:=1 to n do \n\tbegin \n\t\treadln(a[i]);\n\t\tif pos('#',a[i])=0 then x[i]:=false;\n\tend;\n\tfor i:=1 to m do\n\tbegin\n\t\tch:='';\n\t\tfor j:=1 to n do ch:=ch+a[j,i];\n\t\tif pos('#',ch)=0 then y[i]:=false;\n\tend;\n\tfor i:=1 to n do\n\tbegin\n\t\tfor j:=1 to m do\n\t\t\tif (x[i] and y[j]) then write(a[i,j]);\n\t\tif x[i] then writeln;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1535245842, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s849232512.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s849232512", "user_id": "u957998623"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n\tx,y:array[0..110] of boolean;\n\ta:array[0..110] of string[110];\n\tn,m,i,j:longint;\n\tch:string[110];\nbegin\n\treadln(n,m);\n\tfillchar(x,sizeof(x),true);\n\tfillchar(y,sizeof(y),true);\n\tfor i:=1 to n do \n\tbegin \n\t\treadln(a[i]);\n\t\tif pos('#',a[i])=0 then x[i]:=false;\n\tend;\n\tfor i:=1 to m do\n\tbegin\n\t\tch:='';\n\t\tfor j:=1 to n do ch:=ch+a[j,i];\n\t\tif pos('#',ch)=0 then y[i]:=false;\n\tend;\n\tfor i:=1 to n do\n\tbegin\n\t\tfor j:=1 to m do\n\t\t\tif (x[i] and y[j]) then write(a[i,j]);\n\t\tif x[i] then writeln;\n\tend;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 501, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s447911485", "group_id": "codeNet:p03274", "input_text": "var\n a:array[0..100010]of int64;\n k,l,r,n,ans:int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(a[i]);\n ans:=maxlongint;\n for i:=1 to n-k+1 do\n begin\n l:=min(a[i],0);\n r:=max(a[i+k-1],0);\n ans:=min(ans,r-l*2);\n ans:=min(ans,r*2-l);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1540472296, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s447911485.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s447911485", "user_id": "u018679195"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n a:array[0..100010]of int64;\n k,l,r,n,ans:int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(a[i]);\n ans:=maxlongint;\n for i:=1 to n-k+1 do\n begin\n l:=min(a[i],0);\n r:=max(a[i+k-1],0);\n ans:=min(ans,r-l*2);\n ans:=min(ans,r*2-l);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 450, "cpu_time_ms": 15, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s359984427", "group_id": "codeNet:p03274", "input_text": "var\n n,k,ans,t:int64;\n sum,x:array[0..100000]of int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(x[i]);\n ans:=maxlongint;\n for i:=1 to n do\n begin\n if i+k-1>n then continue;\n if (x[i]+x[i+k-1])=((abs(x[i])+abs(x[i+k-1])))\n then ans:=min(ans,max(abs(x[i]),abs(x[i+k-1])))\n else ans:=min(ans,min(abs(x[i]),abs(x[i+k-1]))+abs(x[i])+abs(x[i+k-1]));\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1538776788, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s359984427.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s359984427", "user_id": "u119860177"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n n,k,ans,t:int64;\n sum,x:array[0..100000]of int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(x[i]);\n ans:=maxlongint;\n for i:=1 to n do\n begin\n if i+k-1>n then continue;\n if (x[i]+x[i+k-1])=((abs(x[i])+abs(x[i+k-1])))\n then ans:=min(ans,max(abs(x[i]),abs(x[i+k-1])))\n else ans:=min(ans,min(abs(x[i]),abs(x[i+k-1]))+abs(x[i])+abs(x[i+k-1]));\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 569, "cpu_time_ms": 16, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s393185833", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=0-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535334864, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s393185833.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s393185833", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=0-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 856, "cpu_time_ms": 17, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s402892635", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=0-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535334759, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s402892635.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s402892635", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=0-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 805, "cpu_time_ms": 16, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s128830793", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif f[i]<0 then inc(y);\n\t\tif f[i]=0 then dec(k);\n\t\tif (f[i]>0) and (f[i-1]<=0) then t:=i;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to n do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f[x-1]);\n\tif -y>=k then s:=min(s,f[-y]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535333136, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s128830793.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s128830793", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif f[i]<0 then inc(y);\n\t\tif f[i]=0 then dec(k);\n\t\tif (f[i]>0) and (f[i-1]<=0) then t:=i;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to n do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f[x-1]);\n\tif -y>=k then s:=min(s,f[-y]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 694, "cpu_time_ms": 17, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s347957946", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif f[i]<0 then inc(y);\n\t\tif f[i]=0 then dec(k);\n\t\tif (f[i]>0) and (f[i-1]<=0) then t:=i;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to n do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tfor i:=-min(-y,k) to -1 do\n\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=0 to min(x,k) do\n\t\ts:=min(s,f1[i]*2+f1[-(k+i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535331425, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s347957946.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s347957946", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif f[i]<0 then inc(y);\n\t\tif f[i]=0 then dec(k);\n\t\tif (f[i]>0) and (f[i-1]<=0) then t:=i;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to n do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tfor i:=-min(-y,k) to -1 do\n\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=0 to min(x,k) do\n\t\ts:=min(s,f1[i]*2+f1[-(k+i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 580, "cpu_time_ms": 16, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s489497101", "group_id": "codeNet:p03274", "input_text": "var n,k,i,aa:longint;\nmin,count:int64;\na:array[1..100000]of longint;\nbegin \n\tread(n,k);\n\tmin:=maxlongint;\n\tfor i:=1 to n do begin read(a[i]);if a[i]<=0 then begin a[i]:=-a[i];aa:=i;end;end;\n\tfor i:=1 to k do \n\t\tif (aa>=i) and (n-aa>=k-i)then\n\t\tbegin \n\t\t\tif a[aa-i+1]>a[aa+k-i] then count:=2*a[aa+k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+a[aa+k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\tif (n-aa>=k) and (a[aa+k]=i) and (n-aa>=k-i)then\n\t\tbegin \n\t\t\tif a[aa-i+1]>a[aa+k-i] then count:=2*a[aa+k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+a[aa+k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\tif (n-aa>=k) and (a[aa+k]0 then read(x);end;\n\taa:=i;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "language": "Pascal", "metadata": {"date": 1535321918, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s128287629.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s128287629", "user_id": "u914335902"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var n,k,i,aa,x,bb:longint;\nmin,count:int64;\na,b:array[1..100000]of longint;\nbegin \n\tread(n,k);\n\tmin:=maxlongint;\n\ti:=0;\n\tread(x);\n\twhile (x<0) and (i0 then read(x);end;\n\taa:=i;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 546, "cpu_time_ms": 15, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s455907536", "group_id": "codeNet:p03274", "input_text": "var n,k,i,aa,x,bb:longint;\nmin,count:longint;\na,b:array[1..100000]of integer;\nbegin \n\tread(n,k);\n\tmin:=maxlongint;\n\ti:=0;\n\tread(x);\n\twhile (x<0) and (i0 then read(x);end;\n\taa:=i;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "language": "Pascal", "metadata": {"date": 1535319705, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s455907536.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s455907536", "user_id": "u914335902"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var n,k,i,aa,x,bb:longint;\nmin,count:longint;\na,b:array[1..100000]of integer;\nbegin \n\tread(n,k);\n\tmin:=maxlongint;\n\ti:=0;\n\tread(x);\n\twhile (x<0) and (i0 then read(x);end;\n\taa:=i;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 547, "cpu_time_ms": 15, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s101593120", "group_id": "codeNet:p03274", "input_text": "var n,k,i,aa,x,count,min,bb:integer;\na,b:array[1..100000]of integer;\nbegin \n\tread(n,k);\n\tmin:=maxint;\n\ti:=0;\n\tread(x);\n\twhile (x<0) and (i0 then read(x);end;\n\taa:=i;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "language": "Pascal", "metadata": {"date": 1535319130, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s101593120.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s101593120", "user_id": "u914335902"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var n,k,i,aa,x,count,min,bb:integer;\na,b:array[1..100000]of integer;\nbegin \n\tread(n,k);\n\tmin:=maxint;\n\ti:=0;\n\tread(x);\n\twhile (x<0) and (i0 then read(x);end;\n\taa:=i;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 534, "cpu_time_ms": 15, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s355610956", "group_id": "codeNet:p03274", "input_text": "var\n n,k,i,x:longint;\n ans:int64;\n a:array[0..100010] of int64;\nfunction min(a,b:int64):int64;\nbegin\n if ab then exit(a) else exit(b);\nend;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i]<=0 then x:=i;\n end;\n ans:=maxlongint;\n if x>=k then ans:=min(ans,abs(a[x-k+1]));\n if x+k<=n then ans:=min(ans,abs(a[x+k]));\n for i:=max(x,k) to min(n,x+k) do\n ans:=min(ans,min(abs(a[i]),abs(a[i-k+1]))*2+max(abs(a[i]),abs(a[i-k+1])));\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1535249748, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s355610956.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355610956", "user_id": "u960852022"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n n,k,i,x:longint;\n ans:int64;\n a:array[0..100010] of int64;\nfunction min(a,b:int64):int64;\nbegin\n if ab then exit(a) else exit(b);\nend;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i]<=0 then x:=i;\n end;\n ans:=maxlongint;\n if x>=k then ans:=min(ans,abs(a[x-k+1]));\n if x+k<=n then ans:=min(ans,abs(a[x+k]));\n for i:=max(x,k) to min(n,x+k) do\n ans:=min(ans,min(abs(a[i]),abs(a[i-k+1]))*2+max(abs(a[i]),abs(a[i-k+1])));\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 617, "cpu_time_ms": 15, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s669468248", "group_id": "codeNet:p03275", "input_text": "var n,i:longint;\n a:array[0..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n writeln(a[n>>1]);\nend.", "language": "Pascal", "metadata": {"date": 1581518110, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03275.html", "problem_id": "p03275", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03275/input.txt", "sample_output_relpath": "derived/input_output/data/p03275/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03275/Pascal/s669468248.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s669468248", "user_id": "u743614777"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "var n,i:longint;\n a:array[0..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n writeln(a[n>>1]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe will define the median of a sequence b of length M, as follows:\n\nLet b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down.\n\nFor example, the median of (10, 30, 20) is 20; the median of (10, 30, 20, 40) is 30; the median of (10, 10, 10, 20, 30) is 10.\n\nSnuke comes up with the following problem.\n\nYou are given a sequence a of length N.\nFor each pair (l, r) (1 \\leq l \\leq r \\leq N), let m_{l, r} be the median of the contiguous subsequence (a_l, a_{l + 1}, ..., a_r) of a.\nWe will list m_{l, r} for all pairs (l, r) to create a new sequence m.\nFind the median of m.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the median of m.\n\nSample Input 1\n\n3\n10 30 20\n\nSample Output 1\n\n30\n\nThe median of each contiguous subsequence of a is as follows:\n\nThe median of (10) is 10.\n\nThe median of (30) is 30.\n\nThe median of (20) is 20.\n\nThe median of (10, 30) is 30.\n\nThe median of (30, 20) is 30.\n\nThe median of (10, 30, 20) is 20.\n\nThus, m = (10, 30, 20, 30, 30, 20) and the median of m is 30.\n\nSample Input 2\n\n1\n10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n10\n5 9 5 9 8 9 3 5 4 3\n\nSample Output 3\n\n8", "sample_input": "3\n10 30 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03275", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe will define the median of a sequence b of length M, as follows:\n\nLet b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down.\n\nFor example, the median of (10, 30, 20) is 20; the median of (10, 30, 20, 40) is 30; the median of (10, 10, 10, 20, 30) is 10.\n\nSnuke comes up with the following problem.\n\nYou are given a sequence a of length N.\nFor each pair (l, r) (1 \\leq l \\leq r \\leq N), let m_{l, r} be the median of the contiguous subsequence (a_l, a_{l + 1}, ..., a_r) of a.\nWe will list m_{l, r} for all pairs (l, r) to create a new sequence m.\nFind the median of m.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the median of m.\n\nSample Input 1\n\n3\n10 30 20\n\nSample Output 1\n\n30\n\nThe median of each contiguous subsequence of a is as follows:\n\nThe median of (10) is 10.\n\nThe median of (30) is 30.\n\nThe median of (20) is 20.\n\nThe median of (10, 30) is 30.\n\nThe median of (30, 20) is 30.\n\nThe median of (10, 30, 20) is 20.\n\nThus, m = (10, 30, 20, 30, 30, 20) and the median of m is 30.\n\nSample Input 2\n\n1\n10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n10\n5 9 5 9 8 9 3 5 4 3\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 129, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s097849336", "group_id": "codeNet:p03275", "input_text": "var n,i:longint;\n a:array[0..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n writeln(a[(n+1)>>1]);\nend.", "language": "Pascal", "metadata": {"date": 1581518030, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03275.html", "problem_id": "p03275", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03275/input.txt", "sample_output_relpath": "derived/input_output/data/p03275/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03275/Pascal/s097849336.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s097849336", "user_id": "u743614777"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "var n,i:longint;\n a:array[0..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n writeln(a[(n+1)>>1]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe will define the median of a sequence b of length M, as follows:\n\nLet b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down.\n\nFor example, the median of (10, 30, 20) is 20; the median of (10, 30, 20, 40) is 30; the median of (10, 10, 10, 20, 30) is 10.\n\nSnuke comes up with the following problem.\n\nYou are given a sequence a of length N.\nFor each pair (l, r) (1 \\leq l \\leq r \\leq N), let m_{l, r} be the median of the contiguous subsequence (a_l, a_{l + 1}, ..., a_r) of a.\nWe will list m_{l, r} for all pairs (l, r) to create a new sequence m.\nFind the median of m.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the median of m.\n\nSample Input 1\n\n3\n10 30 20\n\nSample Output 1\n\n30\n\nThe median of each contiguous subsequence of a is as follows:\n\nThe median of (10) is 10.\n\nThe median of (30) is 30.\n\nThe median of (20) is 20.\n\nThe median of (10, 30) is 30.\n\nThe median of (30, 20) is 30.\n\nThe median of (10, 30, 20) is 20.\n\nThus, m = (10, 30, 20, 30, 30, 20) and the median of m is 30.\n\nSample Input 2\n\n1\n10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n10\n5 9 5 9 8 9 3 5 4 3\n\nSample Output 3\n\n8", "sample_input": "3\n10 30 20\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03275", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe will define the median of a sequence b of length M, as follows:\n\nLet b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down.\n\nFor example, the median of (10, 30, 20) is 20; the median of (10, 30, 20, 40) is 30; the median of (10, 10, 10, 20, 30) is 10.\n\nSnuke comes up with the following problem.\n\nYou are given a sequence a of length N.\nFor each pair (l, r) (1 \\leq l \\leq r \\leq N), let m_{l, r} be the median of the contiguous subsequence (a_l, a_{l + 1}, ..., a_r) of a.\nWe will list m_{l, r} for all pairs (l, r) to create a new sequence m.\nFind the median of m.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the median of m.\n\nSample Input 1\n\n3\n10 30 20\n\nSample Output 1\n\n30\n\nThe median of each contiguous subsequence of a is as follows:\n\nThe median of (10) is 10.\n\nThe median of (30) is 30.\n\nThe median of (20) is 20.\n\nThe median of (10, 30) is 30.\n\nThe median of (30, 20) is 30.\n\nThe median of (10, 30, 20) is 20.\n\nThus, m = (10, 30, 20, 30, 30, 20) and the median of m is 30.\n\nSample Input 2\n\n1\n10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n10\n5 9 5 9 8 9 3 5 4 3\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 16, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s401269225", "group_id": "codeNet:p03275", "input_text": "var\n\ta:array[0..100010] of longint;\n\ti,n:longint;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r;\n\tmid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif l 0 then begin\n for i := 1 to 35 do //kazoeru\n if j mod (i*2-1) = 0 then\n inc(count);\n if count=7 then\n inc(max);\n end;\n end;\n\n Writeln(max);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1537846221, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Pascal/s985979428.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s985979428", "user_id": "u755925739"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n so:array[0..24] of integer = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97);\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Readln(n);\n count:=0;\n max :=0;\n min :=100;\n\n for j:=1 to n do begin //sagasu\n count:=0;\n if j mod 2 <> 0 then begin\n for i := 1 to 35 do //kazoeru\n if j mod (i*2-1) = 0 then\n inc(count);\n if count=7 then\n inc(max);\n end;\n end;\n\n Writeln(max);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 868, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s731338258", "group_id": "codeNet:p03281", "input_text": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : Integer;\n\tvar\n\t\ti, j, k : Integer;\n\t\tarrayNum : array of Integer;\n\tbegin\n\tResult := 0;\n\tSetLength(arrayNum, 5);\n\tarrayNum[0] := 3;\n\tarrayNum[1] := 5;\n\tarrayNum[2] := 7;\n\tarrayNum[3] := 11;\n\tarrayNum[4] := 13;\n\tfor i := 1 to Value do\n\t\tbegin\n\t\tif not Odd(i) then\n\t\t\tContinue;\n\t\tj := 0;\n\t\tfor k := 0 to Length(arrayNum) - 1 do\n\t\t\tbegin\n\t\t\tif i mod arrayNum[k] = 0then\n\t\t\t\tj := j + 1;\n\t\t\tend;\n\t\tif j = 3 then\n\t\t\tInc(Result);\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : Integer;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.", "language": "Pascal", "metadata": {"date": 1537243867, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Pascal/s731338258.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s731338258", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : Integer;\n\tvar\n\t\ti, j, k : Integer;\n\t\tarrayNum : array of Integer;\n\tbegin\n\tResult := 0;\n\tSetLength(arrayNum, 5);\n\tarrayNum[0] := 3;\n\tarrayNum[1] := 5;\n\tarrayNum[2] := 7;\n\tarrayNum[3] := 11;\n\tarrayNum[4] := 13;\n\tfor i := 1 to Value do\n\t\tbegin\n\t\tif not Odd(i) then\n\t\t\tContinue;\n\t\tj := 0;\n\t\tfor k := 0 to Length(arrayNum) - 1 do\n\t\t\tbegin\n\t\t\tif i mod arrayNum[k] = 0then\n\t\t\t\tj := j + 1;\n\t\t\tend;\n\t\tif j = 3 then\n\t\t\tInc(Result);\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : Integer;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 676, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s281499236", "group_id": "codeNet:p03281", "input_text": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : Integer;\n\tvar\n\t\ti, j, k : Integer;\n\t\tarrayNum : array of Integer;\n\tbegin\n\tResult := 0;\n\tSetLength(arrayNum, 5);\n\tarrayNum[0] := 3;\n\tarrayNum[1] := 5;\n\tarrayNum[2] := 7;\n\tarrayNum[3] := 11;\n\tarrayNum[4] := 13;\n\tfor i := 1 to Value do\n\t\tbegin\n\t\tif Odd(i) then\n\t\t\tContinue;\n\t\tj := 0;\n\t\tfor k := 0 to Length(arrayNum) - 1 do\n\t\t\tbegin\n\t\t\tif i mod arrayNum[k] = 0then\n\t\t\t\tj := j + 1;\n\t\t\tend;\n\t\tif j = 3 then\n\t\t\tInc(Result);\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : Integer;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.", "language": "Pascal", "metadata": {"date": 1537243803, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Pascal/s281499236.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s281499236", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : Integer;\n\tvar\n\t\ti, j, k : Integer;\n\t\tarrayNum : array of Integer;\n\tbegin\n\tResult := 0;\n\tSetLength(arrayNum, 5);\n\tarrayNum[0] := 3;\n\tarrayNum[1] := 5;\n\tarrayNum[2] := 7;\n\tarrayNum[3] := 11;\n\tarrayNum[4] := 13;\n\tfor i := 1 to Value do\n\t\tbegin\n\t\tif Odd(i) then\n\t\t\tContinue;\n\t\tj := 0;\n\t\tfor k := 0 to Length(arrayNum) - 1 do\n\t\t\tbegin\n\t\t\tif i mod arrayNum[k] = 0then\n\t\t\t\tj := j + 1;\n\t\t\tend;\n\t\tif j = 3 then\n\t\t\tInc(Result);\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : Integer;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 672, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s859006218", "group_id": "codeNet:p03281", "input_text": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : Integer;\n\tvar\n\t\ti, j, k : Integer;\n\t\tarrayNum : array of Integer;\n\tbegin\n\tResult := 0;\n\tSetLength(arrayNum, 5);\n\tarrayNum[0] := 3;\n\tarrayNum[1] := 5;\n\tarrayNum[2] := 7;\n\tarrayNum[3] := 11;\n\tarrayNum[4] := 13;\n\t\n\tfor i := 1 to Value do\n\t\tbegin\n\t\tj := 0;\n\t\tfor k := 0 to Length(arrayNum) - 1 do\n\t\t\tbegin\n\t\t\tif i mod arrayNum[k] = 0then\n\t\t\t\tj := j + 1;\n\t\t\tend;\n\t\tif j = 3 then\n\t\t\tInc(Result);\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : Integer;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.", "language": "Pascal", "metadata": {"date": 1537243353, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Pascal/s859006218.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s859006218", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : Integer;\n\tvar\n\t\ti, j, k : Integer;\n\t\tarrayNum : array of Integer;\n\tbegin\n\tResult := 0;\n\tSetLength(arrayNum, 5);\n\tarrayNum[0] := 3;\n\tarrayNum[1] := 5;\n\tarrayNum[2] := 7;\n\tarrayNum[3] := 11;\n\tarrayNum[4] := 13;\n\t\n\tfor i := 1 to Value do\n\t\tbegin\n\t\tj := 0;\n\t\tfor k := 0 to Length(arrayNum) - 1 do\n\t\t\tbegin\n\t\t\tif i mod arrayNum[k] = 0then\n\t\t\t\tj := j + 1;\n\t\t\tend;\n\t\tif j = 3 then\n\t\t\tInc(Result);\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : Integer;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 644, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s617134252", "group_id": "codeNet:p03282", "input_text": "uses crt;\nvar\n a,b:string;\n i,j,x,y,k,code:longint;\nbegin\n readln(a);\n read(k);\n for y:=1 to k-1 do\n begin\n i:=1;\n while i<=k do\n begin\n val(a[i],j,code);\n for x:=1 to j-1 do\n begin\n insert(a[i],a,i);\n inc(i);\n end;\n inc(i);\n end;\n end;\n writeln(a[k]);\n // writeln(a);\n\n // readln;\n // readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1534643558, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03282.html", "problem_id": "p03282", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03282/input.txt", "sample_output_relpath": "derived/input_output/data/p03282/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03282/Pascal/s617134252.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s617134252", "user_id": "u004929494"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses crt;\nvar\n a,b:string;\n i,j,x,y,k,code:longint;\nbegin\n readln(a);\n read(k);\n for y:=1 to k-1 do\n begin\n i:=1;\n while i<=k do\n begin\n val(a[i],j,code);\n for x:=1 to j-1 do\n begin\n insert(a[i],a,i);\n inc(i);\n end;\n inc(i);\n end;\n end;\n writeln(a[k]);\n // writeln(a);\n\n // readln;\n // readln;\nend.\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "sample_input": "1214\n4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03282", "source_text": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 472, "cpu_time_ms": 10, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s603041691", "group_id": "codeNet:p03283", "input_text": "var\n n,m,q,x,y,i,j:longint;\n b,a:array[0..1000,0..1000]of longint;\nbegin\n readln(n,m,q);\n for i:=1 to m do\n begin\n readln(x,y);\n inc(a[x,y]);\n end;\n for i:=n downto 1 do\n for j:=1 to n do\n b[i,j]:=a[i,j]+b[i+1,j]+b[i,j-1]-b[i+1,j-1];\n for i:=1 to q do\n begin\n readln(x,y);\n writeln(b[x,y]);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1538862035, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Pascal/s603041691.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603041691", "user_id": "u353919145"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,m,q,x,y,i,j:longint;\n b,a:array[0..1000,0..1000]of longint;\nbegin\n readln(n,m,q);\n for i:=1 to m do\n begin\n readln(x,y);\n inc(a[x,y]);\n end;\n for i:=n downto 1 do\n for j:=1 to n do\n b[i,j]:=a[i,j]+b[i+1,j]+b[i,j-1]-b[i+1,j-1];\n for i:=1 to q do\n begin\n readln(x,y);\n writeln(b[x,y]);\n end;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 331, "cpu_time_ms": 68, "memory_kb": 6784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s689410941", "group_id": "codeNet:p03284", "input_text": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tif cracker = person then\n\t\tWriteLn(0)\n\telse\n\t\tWriteLn(1);\n\tend;\n \nbegin\nMainProc;\nend.\n", "language": "Pascal", "metadata": {"date": 1536892393, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Pascal/s689410941.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s689410941", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tif cracker = person then\n\t\tWriteLn(0)\n\telse\n\t\tWriteLn(1);\n\tend;\n \nbegin\nMainProc;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 476, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s487144713", "group_id": "codeNet:p03284", "input_text": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tif cracker >= person then\n\t\tWriteLn(cracker mod person)\n\telse\n\t\tWriteLn(0);\n\tend;\n \nbegin\nMainProc;\nend.\n", "language": "Pascal", "metadata": {"date": 1536891799, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Pascal/s487144713.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s487144713", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tif cracker >= person then\n\t\tWriteLn(cracker mod person)\n\telse\n\t\tWriteLn(0);\n\tend;\n \nbegin\nMainProc;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 494, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s238379016", "group_id": "codeNet:p03284", "input_text": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tWriteLn(cracker mod person);\n\tend;\n \nbegin\nMainProc;\nend.\n", "language": "Pascal", "metadata": {"date": 1536891618, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Pascal/s238379016.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s238379016", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tWriteLn(cracker mod person);\n\tend;\n \nbegin\nMainProc;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 447, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s231185732", "group_id": "codeNet:p03285", "input_text": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : string;\n\tconst\n\t\tcake = 4;\n\t\tdonut = 7;\n\tvar\n\t\ti : Integer;\n\t\tremaining : Integer;\n\tbegin\n\tResult := 'No';\n\tfor i := 0 to Value div donut do\n\t\tbegin\n\t\tremaining := Value - (i * donut);\n\t\tif (remaining = 0) or ((remaining mod cake) = 0) then\n\t\t\tResult := 'Yes';\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : string;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.\n", "language": "Pascal", "metadata": {"date": 1537241003, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03285.html", "problem_id": "p03285", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03285/input.txt", "sample_output_relpath": "derived/input_output/data/p03285/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03285/Pascal/s231185732.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s231185732", "user_id": "u397546896"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n\n function JudgeFunc(const Value : Integer) : string;\n\tconst\n\t\tcake = 4;\n\t\tdonut = 7;\n\tvar\n\t\ti : Integer;\n\t\tremaining : Integer;\n\tbegin\n\tResult := 'No';\n\tfor i := 0 to Value div donut do\n\t\tbegin\n\t\tremaining := Value - (i * donut);\n\t\tif (remaining = 0) or ((remaining mod cake) = 0) then\n\t\t\tResult := 'Yes';\n\t\tend;\n\tend;\n \n procedure MainProc;\n\tvar\n\t\tinput : Integer;\n\t\toutput : string;\n\tbegin\n\tReadLn(input);\n\toutput := JudgeFunc(input);\n\tWriteLn(output);\n\tend;\n \nbegin\nMainProc;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLa Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each.\nDetermine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.\n\nConstraints\n\nN is an integer between 1 and 100, inclusive.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there is a way to buy some cakes and some doughnuts for exactly N dollars, print Yes; otherwise, print No.\n\nSample Input 1\n\n11\n\nSample Output 1\n\nYes\n\nIf you buy one cake and one doughnut, the total will be 4 + 7 = 11 dollars.\n\nSample Input 2\n\n40\n\nSample Output 2\n\nYes\n\nIf you buy ten cakes, the total will be 4 \\times 10 = 40 dollars.\n\nSample Input 3\n\n3\n\nSample Output 3\n\nNo\n\nThe prices of cakes (4 dollars) and doughnuts (7 dollars) are both higher than 3 dollars, so there is no such way.", "sample_input": "11\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03285", "source_text": "Score : 200 points\n\nProblem Statement\n\nLa Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each.\nDetermine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.\n\nConstraints\n\nN is an integer between 1 and 100, inclusive.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there is a way to buy some cakes and some doughnuts for exactly N dollars, print Yes; otherwise, print No.\n\nSample Input 1\n\n11\n\nSample Output 1\n\nYes\n\nIf you buy one cake and one doughnut, the total will be 4 + 7 = 11 dollars.\n\nSample Input 2\n\n40\n\nSample Output 2\n\nYes\n\nIf you buy ten cakes, the total will be 4 \\times 10 = 40 dollars.\n\nSample Input 3\n\n3\n\nSample Output 3\n\nNo\n\nThe prices of cakes (4 dollars) and doughnuts (7 dollars) are both higher than 3 dollars, so there is no such way.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s860454682", "group_id": "codeNet:p03287", "input_text": "const\n key=100001651;\nvar\n n,m,i,j:longint;\n k:int64;\n ans:extended;\n a,c,f:array[0..100010] of int64;\n b:array[0..100002000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans:0:0);\nend.", "language": "Pascal", "metadata": {"date": 1534041581, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s860454682.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s860454682", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=100001651;\nvar\n n,m,i,j:longint;\n k:int64;\n ans:extended;\n a,c,f:array[0..100010] of int64;\n b:array[0..100002000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans:0:0);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 618, "cpu_time_ms": 97, "memory_kb": 391424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s707023573", "group_id": "codeNet:p03288", "input_text": "var a:longint;\nbegin \n read(a);\n if a<1200 then write('ABC')\nelse if a<2800 then write('ARC')\nelse write('AGC');\nend.", "language": "Pascal", "metadata": {"date": 1533569111, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03288.html", "problem_id": "p03288", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03288/input.txt", "sample_output_relpath": "derived/input_output/data/p03288/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03288/Pascal/s707023573.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s707023573", "user_id": "u914335902"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "var a:longint;\nbegin \n read(a);\n if a<1200 then write('ABC')\nelse if a<2800 then write('ARC')\nelse write('AGC');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA programming competition site AtCode regularly holds programming contests.\n\nThe next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.\n\nThe contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.\n\nThe contest after the ARC is called AGC, which is rated for all contestants.\n\nTakahashi's rating on AtCode is R. What is the next contest rated for him?\n\nConstraints\n\n0 ≤ R ≤ 4208\n\nR is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the name of the next contest rated for Takahashi (ABC, ARC or AGC).\n\nSample Input 1\n\n1199\n\nSample Output 1\n\nABC\n\n1199 is less than 1200, so ABC will be rated.\n\nSample Input 2\n\n1200\n\nSample Output 2\n\nARC\n\n1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.\n\nSample Input 3\n\n4208\n\nSample Output 3\n\nAGC", "sample_input": "1199\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03288", "source_text": "Score : 100 points\n\nProblem Statement\n\nA programming competition site AtCode regularly holds programming contests.\n\nThe next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.\n\nThe contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.\n\nThe contest after the ARC is called AGC, which is rated for all contestants.\n\nTakahashi's rating on AtCode is R. What is the next contest rated for him?\n\nConstraints\n\n0 ≤ R ≤ 4208\n\nR is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the name of the next contest rated for Takahashi (ABC, ARC or AGC).\n\nSample Input 1\n\n1199\n\nSample Output 1\n\nABC\n\n1199 is less than 1200, so ABC will be rated.\n\nSample Input 2\n\n1200\n\nSample Output 2\n\nARC\n\n1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.\n\nSample Input 3\n\n4208\n\nSample Output 3\n\nAGC", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s801047058", "group_id": "codeNet:p03289", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Readln(s);\n count:=0;\n max :=0;\n min :=100;\n tf :=true;\n\n if not(s[1]='A') then\n tf:=false;\n if ord(s[2])'A') or (s[2]='C') or (s[length(s)]='C') then\nbegin\nwriteln('WA');\nhalt;\nend;\nb:=false;\nfor i:=2 to length(s) do\n if s[i]='C' then\n begin\n if b then\n begin\n writeln('WA');\n halt;\n end;\n b:=true;\n end\n else\n if s[i] in ['A'..'Z'] then\n begin\n writeln('WA');\n halt;\n end;\nif b then\nwriteln('AC')\nelse\nwriteln('WA');\nend.\n", "language": "Pascal", "metadata": {"date": 1581518012, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s754184843.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s754184843", "user_id": "u214724132"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\ni:longint;\ns:string;\nb:boolean;\nbegin\nreadln(s);\nif (s[1]<>'A') or (s[2]='C') or (s[length(s)]='C') then\nbegin\nwriteln('WA');\nhalt;\nend;\nb:=false;\nfor i:=2 to length(s) do\n if s[i]='C' then\n begin\n if b then\n begin\n writeln('WA');\n halt;\n end;\n b:=true;\n end\n else\n if s[i] in ['A'..'Z'] then\n begin\n writeln('WA');\n halt;\n end;\nif b then\nwriteln('AC')\nelse\nwriteln('WA');\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 392, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s389803831", "group_id": "codeNet:p03290", "input_text": "var\n d,g,i,j:longint;\n f:array[0..20,0..200010] of longint;\n p,c:array[0..20] of longint;\nfunction min(a,b:longint):longint;\nbegin\n if a999999999 then exit(f[n,m]);\n for i:=0 to p[n]-1 do\n f[n,m]:=min(f[n,m],dp(n-1,m-i*n)+i);\n f[n,m]:=min(f[n,m],dp(n-1,m-p[n]*n-c[n])+p[n]);\n exit(f[n,m]);\nend;\nbegin\n readln(d,g);g:=g div 100;\n for i:=1 to d do\n begin\n readln(p[i],c[i]);\n c[i]:=c[i] div 100;\n end;\n for i:=1 to d do\n for j:=1 to g do\n f[i,j]:=999999999;\n writeln(dp(d,g));\nend.", "language": "Pascal", "metadata": {"date": 1533596524, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s389803831.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s389803831", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n d,g,i,j:longint;\n f:array[0..20,0..200010] of longint;\n p,c:array[0..20] of longint;\nfunction min(a,b:longint):longint;\nbegin\n if a999999999 then exit(f[n,m]);\n for i:=0 to p[n]-1 do\n f[n,m]:=min(f[n,m],dp(n-1,m-i*n)+i);\n f[n,m]:=min(f[n,m],dp(n-1,m-p[n]*n-c[n])+p[n]);\n exit(f[n,m]);\nend;\nbegin\n readln(d,g);g:=g div 100;\n for i:=1 to d do\n begin\n readln(p[i],c[i]);\n c[i]:=c[i] div 100;\n end;\n for i:=1 to d do\n for j:=1 to g do\n f[i,j]:=999999999;\n writeln(dp(d,g));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 741, "cpu_time_ms": 2103, "memory_kb": 9088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s864376019", "group_id": "codeNet:p03293", "input_text": "uses\n SysUtils,\n Classes;\n \nfunction CheckFunc(strS : String; const strT : String) : Boolean;\n\tvar\n\t\tcount : Integer;\n\t\tstr : String;\n\tbegin\n\tResult := False;\n\tcount := 1;\n\twhile (Length(strS) <> count) do\n\t\tbegin\n\t\tif (strS = strT )then\n\t\t\tbegin\n\t\t\tResult := True;\n\t\t\texit;\n\t\t\tend;\n\t\tstr := strS[Length(strS)];\n\t\tstr := str + Copy(strS, 1, Length(strS) - 1);\n\t\tstrS := str;\n\t\tcount := count + 1;\n\t\tend;\n\tend;\n\nvar\n\tstrS, strT : String;\nbegin\t\n\treadln(strS);\n\treadln(strT);\n\t\n\tif CheckFunc(strS, strT) then\n\t\twriteln('Yes')\n\telse\n\t\twriteln('No');\nend.", "language": "Pascal", "metadata": {"date": 1532226283, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03293.html", "problem_id": "p03293", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03293/input.txt", "sample_output_relpath": "derived/input_output/data/p03293/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03293/Pascal/s864376019.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s864376019", "user_id": "u397546896"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \nfunction CheckFunc(strS : String; const strT : String) : Boolean;\n\tvar\n\t\tcount : Integer;\n\t\tstr : String;\n\tbegin\n\tResult := False;\n\tcount := 1;\n\twhile (Length(strS) <> count) do\n\t\tbegin\n\t\tif (strS = strT )then\n\t\t\tbegin\n\t\t\tResult := True;\n\t\t\texit;\n\t\t\tend;\n\t\tstr := strS[Length(strS)];\n\t\tstr := str + Copy(strS, 1, Length(strS) - 1);\n\t\tstrS := str;\n\t\tcount := count + 1;\n\t\tend;\n\tend;\n\nvar\n\tstrS, strT : String;\nbegin\t\n\treadln(strS);\n\treadln(strT);\n\t\n\tif CheckFunc(strS, strT) then\n\t\twriteln('Yes')\n\telse\n\t\twriteln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given string S and T consisting of lowercase English letters.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOperation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.\n\nHere, |X| denotes the length of the string X.\n\nConstraints\n\n2 \\leq |S| \\leq 100\n\n|S| = |T|\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S equals T after rotation, print Yes; if it does not, print No.\n\nSample Input 1\n\nkyoto\ntokyo\n\nSample Output 1\n\nYes\n\nIn the first operation, kyoto becomes okyot.\n\nIn the second operation, okyot becomes tokyo.\n\nSample Input 2\n\nabc\narc\n\nSample Output 2\n\nNo\n\nabc does not equal arc after any number of operations.\n\nSample Input 3\n\naaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab\n\nSample Output 3\n\nYes", "sample_input": "kyoto\ntokyo\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03293", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given string S and T consisting of lowercase English letters.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOperation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.\n\nHere, |X| denotes the length of the string X.\n\nConstraints\n\n2 \\leq |S| \\leq 100\n\n|S| = |T|\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S equals T after rotation, print Yes; if it does not, print No.\n\nSample Input 1\n\nkyoto\ntokyo\n\nSample Output 1\n\nYes\n\nIn the first operation, kyoto becomes okyot.\n\nIn the second operation, okyot becomes tokyo.\n\nSample Input 2\n\nabc\narc\n\nSample Output 2\n\nNo\n\nabc does not equal arc after any number of operations.\n\nSample Input 3\n\naaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 554, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s108165212", "group_id": "codeNet:p03294", "input_text": "var n,i,x,s:Longint;\nbegin\nread(n);\ns:=-n;\nfor i:=1 to n do begin read(x);inc(s,x);end;\nwriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1544176723, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Pascal/s108165212.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s108165212", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var n,i,x,s:Longint;\nbegin\nread(n);\ns:=-n;\nfor i:=1 to n do begin read(x);inc(s,x);end;\nwriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s917315803", "group_id": "codeNet:p03294", "input_text": "var a:array[0..3020] of longint;\nvar i,j,n,ans:longint;\nbegin\n read(n);\n for i:=1 to n do begin read(a[i]);ans:=ans+a[i]-1;end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1532222440, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Pascal/s917315803.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s917315803", "user_id": "u379604713"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var a:array[0..3020] of longint;\nvar i,j,n,ans:longint;\nbegin\n read(n);\n for i:=1 to n do begin read(a[i]);ans:=ans+a[i]-1;end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s625240162", "group_id": "codeNet:p03297", "input_text": "var\n\tT,i:Longint;\n\tA,B,C,D,G:int64;\nfunction gcd(a,b:int64):int64;\nbegin\n\tif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\n\tread(T);\n\tfor i:=1 to T do begin\n\t\tread(A,B,C,D);\n\t\tG:=gcd(B,D);\n\t\tif(B>A)or(B>D)or(B>(-A-1 mod G+G)mod G+C+1)then writeln('No')else writeln('Yes');\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1579680235, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03297.html", "problem_id": "p03297", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03297/input.txt", "sample_output_relpath": "derived/input_output/data/p03297/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03297/Pascal/s625240162.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s625240162", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n", "input_to_evaluate": "var\n\tT,i:Longint;\n\tA,B,C,D,G:int64;\nfunction gcd(a,b:int64):int64;\nbegin\n\tif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\n\tread(T);\n\tfor i:=1 to T do begin\n\t\tread(A,B,C,D);\n\t\tG:=gcd(B,D);\n\t\tif(B>A)or(B>D)or(B>(-A-1 mod G+G)mod G+C+1)then writeln('No')else writeln('Yes');\n\tend;\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nRingo Mart, a convenience store, sells apple juice.\n\nOn the opening day of Ringo Mart, there were A cans of juice in stock in the morning.\nSnuke buys B cans of juice here every day in the daytime.\nThen, the manager checks the number of cans of juice remaining in stock every night.\nIf there are C or less cans, D new cans will be added to the stock by the next morning.\n\nDetermine if Snuke can buy juice indefinitely, that is, there is always B or more cans of juice in stock when he attempts to buy them.\nNobody besides Snuke buy juice at this store.\n\nNote that each test case in this problem consists of T queries.\n\nConstraints\n\n1 \\leq T \\leq 300\n\n1 \\leq A, B, C, D \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\nA_1 B_1 C_1 D_1\nA_2 B_2 C_2 D_2\n:\nA_T B_T C_T D_T\n\nIn the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.\n\nOutput\n\nPrint T lines. The i-th line should contain Yes if Snuke can buy apple juice indefinitely in the i-th query; No otherwise.\n\nSample Input 1\n\n14\n9 7 5 9\n9 7 6 9\n14 10 7 12\n14 10 8 12\n14 10 9 12\n14 10 7 11\n14 10 8 11\n14 10 9 11\n9 10 5 10\n10 10 5 10\n11 10 5 10\n16 10 5 10\n1000000000000000000 17 14 999999999999999985\n1000000000000000000 17 15 999999999999999985\n\nSample Output 1\n\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n\nIn the first query, the number of cans of juice in stock changes as follows: (D represents daytime and N represents night.)\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 6\n→D x\n\nIn the second query, the number of cans of juice in stock changes as follows:\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 15\n→D 8\n→N 8\n→D 1\n→N 10\n→D 3\n→N 12\n→D 5\n→N 14\n→D 7\n→N 7\n→D 0\n→N 9\n→D 2\n→N 11\n→D …\n\nand so on, thus Snuke can buy juice indefinitely.\n\nSample Input 2\n\n24\n1 2 3 4\n1 2 4 3\n1 3 2 4\n1 3 4 2\n1 4 2 3\n1 4 3 2\n2 1 3 4\n2 1 4 3\n2 3 1 4\n2 3 4 1\n2 4 1 3\n2 4 3 1\n3 1 2 4\n3 1 4 2\n3 2 1 4\n3 2 4 1\n3 4 1 2\n3 4 2 1\n4 1 2 3\n4 1 3 2\n4 2 1 3\n4 2 3 1\n4 3 1 2\n4 3 2 1\n\nSample Output 2\n\nNo\nNo\nNo\nNo\nNo\nNo\nYes\nYes\nNo\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo", "sample_input": "14\n9 7 5 9\n9 7 6 9\n14 10 7 12\n14 10 8 12\n14 10 9 12\n14 10 7 11\n14 10 8 11\n14 10 9 11\n9 10 5 10\n10 10 5 10\n11 10 5 10\n16 10 5 10\n1000000000000000000 17 14 999999999999999985\n1000000000000000000 17 15 999999999999999985\n"}, "reference_outputs": ["No\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n"], "source_document_id": "p03297", "source_text": "Score : 600 points\n\nProblem Statement\n\nRingo Mart, a convenience store, sells apple juice.\n\nOn the opening day of Ringo Mart, there were A cans of juice in stock in the morning.\nSnuke buys B cans of juice here every day in the daytime.\nThen, the manager checks the number of cans of juice remaining in stock every night.\nIf there are C or less cans, D new cans will be added to the stock by the next morning.\n\nDetermine if Snuke can buy juice indefinitely, that is, there is always B or more cans of juice in stock when he attempts to buy them.\nNobody besides Snuke buy juice at this store.\n\nNote that each test case in this problem consists of T queries.\n\nConstraints\n\n1 \\leq T \\leq 300\n\n1 \\leq A, B, C, D \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\nA_1 B_1 C_1 D_1\nA_2 B_2 C_2 D_2\n:\nA_T B_T C_T D_T\n\nIn the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.\n\nOutput\n\nPrint T lines. The i-th line should contain Yes if Snuke can buy apple juice indefinitely in the i-th query; No otherwise.\n\nSample Input 1\n\n14\n9 7 5 9\n9 7 6 9\n14 10 7 12\n14 10 8 12\n14 10 9 12\n14 10 7 11\n14 10 8 11\n14 10 9 11\n9 10 5 10\n10 10 5 10\n11 10 5 10\n16 10 5 10\n1000000000000000000 17 14 999999999999999985\n1000000000000000000 17 15 999999999999999985\n\nSample Output 1\n\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n\nIn the first query, the number of cans of juice in stock changes as follows: (D represents daytime and N represents night.)\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 6\n→D x\n\nIn the second query, the number of cans of juice in stock changes as follows:\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 15\n→D 8\n→N 8\n→D 1\n→N 10\n→D 3\n→N 12\n→D 5\n→N 14\n→D 7\n→N 7\n→D 0\n→N 9\n→D 2\n→N 11\n→D …\n\nand so on, thus Snuke can buy juice indefinitely.\n\nSample Input 2\n\n24\n1 2 3 4\n1 2 4 3\n1 3 2 4\n1 3 4 2\n1 4 2 3\n1 4 3 2\n2 1 3 4\n2 1 4 3\n2 3 1 4\n2 3 4 1\n2 4 1 3\n2 4 3 1\n3 1 2 4\n3 1 4 2\n3 2 1 4\n3 2 4 1\n3 4 1 2\n3 4 2 1\n4 1 2 3\n4 1 3 2\n4 2 1 3\n4 2 3 1\n4 3 1 2\n4 3 2 1\n\nSample Output 2\n\nNo\nNo\nNo\nNo\nNo\nNo\nYes\nYes\nNo\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 290, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s039583415", "group_id": "codeNet:p03310", "input_text": "var\n n,i,l,r:longint;\n a,b:array[0..200010] of int64;\n c:array[0..5] of int64;\n ans:int64;\nfunction max(a,b:int64):int64;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nfunction min(a,b:int64):int64;\nbegin\n if a=abs(b[l+1]-(b[i]-b[l+1]))) do inc(l);\n while (r=abs((b[r+1]-b[i])-(b[n]-b[r+1]))) do inc(r);\n c[1]:=b[l];\n c[2]:=b[i]-b[l];\n c[3]:=b[r]-b[i];\n c[4]:=b[n]-b[r];\n ans:=min(ans,max(c[1],max(c[2],max(c[3],c[4])))-min(c[1],min(c[2],min(c[3],c[4]))));\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1530918900, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03310.html", "problem_id": "p03310", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03310/input.txt", "sample_output_relpath": "derived/input_output/data/p03310/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03310/Pascal/s039583415.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s039583415", "user_id": "u960852022"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,l,r:longint;\n a,b:array[0..200010] of int64;\n c:array[0..5] of int64;\n ans:int64;\nfunction max(a,b:int64):int64;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nfunction min(a,b:int64):int64;\nbegin\n if a=abs(b[l+1]-(b[i]-b[l+1]))) do inc(l);\n while (r=abs((b[r+1]-b[i])-(b[n]-b[r+1]))) do inc(r);\n c[1]:=b[l];\n c[2]:=b[i]-b[l];\n c[3]:=b[r]-b[i];\n c[4]:=b[n]-b[r];\n ans:=min(ans,max(c[1],max(c[2],max(c[3],c[4])))-min(c[1],min(c[2],min(c[3],c[4]))));\n end;\n writeln(ans);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the sums of the elements in B,C,D,E, respectively.\nSnuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller.\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nConstraints\n\n4 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nSample Input 1\n\n5\n3 2 4 1 2\n\nSample Output 1\n\n2\n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3.\nHere, the maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute difference of 2.\nWe cannot make the absolute difference of the maximum and the minimum less than 2, so the answer is 2.\n\nSample Input 2\n\n10\n10 71 84 33 6 47 23 25 52 64\n\nSample Output 2\n\n36\n\nSample Input 3\n\n7\n1 2 3 1000000000 4 5 6\n\nSample Output 3\n\n999999994", "sample_input": "5\n3 2 4 1 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03310", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the sums of the elements in B,C,D,E, respectively.\nSnuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller.\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nConstraints\n\n4 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nSample Input 1\n\n5\n3 2 4 1 2\n\nSample Output 1\n\n2\n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3.\nHere, the maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute difference of 2.\nWe cannot make the absolute difference of the maximum and the minimum less than 2, so the answer is 2.\n\nSample Input 2\n\n10\n10 71 84 33 6 47 23 25 52 64\n\nSample Output 2\n\n36\n\nSample Input 3\n\n7\n1 2 3 1000000000 4 5 6\n\nSample Output 3\n\n999999994", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 892, "cpu_time_ms": 38, "memory_kb": 3200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s148993691", "group_id": "codeNet:p03310", "input_text": "var\n n,i,l,r:longint;\n a,b:array[0..200010] of int64;\n c:array[0..5] of longint;\n ans:int64;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nfunction min(a,b:longint):longint;\nbegin\n if a=abs(b[l+1]-(b[i]-b[l+1]))) do inc(l);\n while (r=abs((b[r+1]-b[i])-(b[n]-b[r+1]))) do inc(r);\n c[1]:=b[l];\n c[2]:=b[i]-b[l];\n c[3]:=b[r]-b[i];\n c[4]:=b[n]-b[r];\n ans:=min(ans,max(c[1],max(c[2],max(c[3],c[4])))-min(c[1],min(c[2],min(c[3],c[4]))));\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1530918781, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03310.html", "problem_id": "p03310", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03310/input.txt", "sample_output_relpath": "derived/input_output/data/p03310/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03310/Pascal/s148993691.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s148993691", "user_id": "u960852022"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,l,r:longint;\n a,b:array[0..200010] of int64;\n c:array[0..5] of longint;\n ans:int64;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nfunction min(a,b:longint):longint;\nbegin\n if a=abs(b[l+1]-(b[i]-b[l+1]))) do inc(l);\n while (r=abs((b[r+1]-b[i])-(b[n]-b[r+1]))) do inc(r);\n c[1]:=b[l];\n c[2]:=b[i]-b[l];\n c[3]:=b[r]-b[i];\n c[4]:=b[n]-b[r];\n ans:=min(ans,max(c[1],max(c[2],max(c[3],c[4])))-min(c[1],min(c[2],min(c[3],c[4]))));\n end;\n writeln(ans);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the sums of the elements in B,C,D,E, respectively.\nSnuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller.\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nConstraints\n\n4 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nSample Input 1\n\n5\n3 2 4 1 2\n\nSample Output 1\n\n2\n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3.\nHere, the maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute difference of 2.\nWe cannot make the absolute difference of the maximum and the minimum less than 2, so the answer is 2.\n\nSample Input 2\n\n10\n10 71 84 33 6 47 23 25 52 64\n\nSample Output 2\n\n36\n\nSample Input 3\n\n7\n1 2 3 1000000000 4 5 6\n\nSample Output 3\n\n999999994", "sample_input": "5\n3 2 4 1 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03310", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the sums of the elements in B,C,D,E, respectively.\nSnuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller.\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nConstraints\n\n4 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nSample Input 1\n\n5\n3 2 4 1 2\n\nSample Output 1\n\n2\n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3.\nHere, the maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute difference of 2.\nWe cannot make the absolute difference of the maximum and the minimum less than 2, so the answer is 2.\n\nSample Input 2\n\n10\n10 71 84 33 6 47 23 25 52 64\n\nSample Output 2\n\n36\n\nSample Input 3\n\n7\n1 2 3 1000000000 4 5 6\n\nSample Output 3\n\n999999994", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 902, "cpu_time_ms": 39, "memory_kb": 3200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s588960298", "group_id": "codeNet:p03312", "input_text": "Uses math;\nvar\n\tn,i:Longint;\n\ta:array[1..200000]of Longint;\n\ts:array[0..200000]of int64;\n\treta,retb,x,y,z,w,ans:int64;\nprocedure f(L,R:Longint);\nvar\n\tsum,c,d,e,f:int64;\n\tll,rr,mm,k:Longint;\nbegin\n\tsum:=(s[R]+s[L])div 2;\n\tll:=L;\n\trr:=R-1;\n\twhile rr-ll>1 do begin\n\t\tmm:=(ll+rr)div 2;\n\t\tif s[mm]>sum then rr:=mm else ll:=mm;\n\tend;\n\tk:=rr;\n\tc:=s[k]-s[L];\n\td:=s[R]-s[k];\n\tdec(k);\n\tif k>L then begin\n\t\te:=s[k]-s[L];\n\t\tf:=s[R]-s[k];\n\t\tif Max(c,d)-Min(c,d)>Max(e,f)-Min(e,f)then begin\n\t\t\treta:=Min(e,f);\n\t\t\tretb:=Max(e,f);\n\t\t\texit;\n\t\tend;\n\tend;\n\treta:=Min(c,d);\n\tretb:=Max(c,d);\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(a[i]);\n\t\ts[i]:=s[i-1]+a[i];\n\tend;\n\tans:=s[n];\n\tfor i:=2 to n-2 do begin\n\t\tf(0,i);\n\t\tx:=reta;\n\t\tz:=retb;\n\t\tf(i,n);\n\t\ty:=reta;\n\t\tw:=retb;\n\t\tans:=Min(ans,Max(z,w)-Min(x,y));\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1540021520, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03312.html", "problem_id": "p03312", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03312/input.txt", "sample_output_relpath": "derived/input_output/data/p03312/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03312/Pascal/s588960298.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s588960298", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Uses math;\nvar\n\tn,i:Longint;\n\ta:array[1..200000]of Longint;\n\ts:array[0..200000]of int64;\n\treta,retb,x,y,z,w,ans:int64;\nprocedure f(L,R:Longint);\nvar\n\tsum,c,d,e,f:int64;\n\tll,rr,mm,k:Longint;\nbegin\n\tsum:=(s[R]+s[L])div 2;\n\tll:=L;\n\trr:=R-1;\n\twhile rr-ll>1 do begin\n\t\tmm:=(ll+rr)div 2;\n\t\tif s[mm]>sum then rr:=mm else ll:=mm;\n\tend;\n\tk:=rr;\n\tc:=s[k]-s[L];\n\td:=s[R]-s[k];\n\tdec(k);\n\tif k>L then begin\n\t\te:=s[k]-s[L];\n\t\tf:=s[R]-s[k];\n\t\tif Max(c,d)-Min(c,d)>Max(e,f)-Min(e,f)then begin\n\t\t\treta:=Min(e,f);\n\t\t\tretb:=Max(e,f);\n\t\t\texit;\n\t\tend;\n\tend;\n\treta:=Min(c,d);\n\tretb:=Max(c,d);\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(a[i]);\n\t\ts[i]:=s[i-1]+a[i];\n\tend;\n\tans:=s[n];\n\tfor i:=2 to n-2 do begin\n\t\tf(0,i);\n\t\tx:=reta;\n\t\tz:=retb;\n\t\tf(i,n);\n\t\ty:=reta;\n\t\tw:=retb;\n\t\tans:=Min(ans,Max(z,w)-Min(x,y));\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the sums of the elements in B,C,D,E, respectively.\nSnuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller.\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nConstraints\n\n4 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nSample Input 1\n\n5\n3 2 4 1 2\n\nSample Output 1\n\n2\n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3.\nHere, the maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute difference of 2.\nWe cannot make the absolute difference of the maximum and the minimum less than 2, so the answer is 2.\n\nSample Input 2\n\n10\n10 71 84 33 6 47 23 25 52 64\n\nSample Output 2\n\n36\n\nSample Input 3\n\n7\n1 2 3 1000000000 4 5 6\n\nSample Output 3\n\n999999994", "sample_input": "5\n3 2 4 1 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03312", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E.\nThe positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the sums of the elements in B,C,D,E, respectively.\nSnuke is happier when the absolute difference of the maximum and the minimum among P,Q,R,S is smaller.\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nConstraints\n\n4 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the minimum possible absolute difference of the maximum and the minimum among P,Q,R,S.\n\nSample Input 1\n\n5\n3 2 4 1 2\n\nSample Output 1\n\n2\n\nIf we divide A as B,C,D,E=(3),(2),(4),(1,2), then P=3,Q=2,R=4,S=1+2=3.\nHere, the maximum and the minimum among P,Q,R,S are 4 and 2, with the absolute difference of 2.\nWe cannot make the absolute difference of the maximum and the minimum less than 2, so the answer is 2.\n\nSample Input 2\n\n10\n10 71 84 33 6 47 23 25 52 64\n\nSample Output 2\n\n36\n\nSample Input 3\n\n7\n1 2 3 1000000000 4 5 6\n\nSample Output 3\n\n999999994", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 820, "cpu_time_ms": 55, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s627770846", "group_id": "codeNet:p03317", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n dbTest:double;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Read(n);\n Readln(k);\n Readln(s);\n\n count:=0;\n max :=0;\n\n if n=k then begin\n Writeln('1');\n Readln;\n exit;\n end;\n\n if frac((n-k)/(k-1)) <> 0.0 then\n Writeln((n-k)div(k-1)+2)\n else\n Writeln((n-k)div(k-1)+1);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1529805934, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03317.html", "problem_id": "p03317", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03317/input.txt", "sample_output_relpath": "derived/input_output/data/p03317/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03317/Pascal/s627770846.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s627770846", "user_id": "u755925739"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\n dbTest:double;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Read(n);\n Readln(k);\n Readln(s);\n\n count:=0;\n max :=0;\n\n if n=k then begin\n Writeln('1');\n Readln;\n exit;\n end;\n\n if frac((n-k)/(k-1)) <> 0.0 then\n Writeln((n-k)div(k-1)+2)\n else\n Writeln((n-k)div(k-1)+1);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "sample_input": "4 3\n2 3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03317", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 709, "cpu_time_ms": 2, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s568395773", "group_id": "codeNet:p03317", "input_text": "var\n n,k,min,i,t,ans,s:longint;\n a:array[0..100010] of longint;\nbegin\n readln(n,k);\n min:=maxlongint;\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i]1 then if (i-1) mod (k-1)=0 then s:=(i-1) div (k-1) else s:=(i-1) div (k-1)+1;\n if i<>n then if (n-i) mod (k-1)=0 then s:=s+(n-i) div (k-1) else s:=s+(n-i) div (k-1)+1;\n if s1 then if (i-1) mod (k-1)=0 then s:=(i-1) div (k-1) else s:=(i-1) div (k-1)+1;\n if i<>n then if (n-i) mod (k-1)=0 then s:=s+(n-i) div (k-1) else s:=s+(n-i) div (k-1)+1;\n if s0 do\n begin\n writeln(ans);\n tot1:=ans+k;\n tot2:=ans+k*10;\n if tot1*s(tot2)<=tot2*s(tot1) then ans:=tot1\n else\n begin\n ans:=tot2;\n k:=k*10;\n end;\n dec(n);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1530922238, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03318.html", "problem_id": "p03318", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03318/input.txt", "sample_output_relpath": "derived/input_output/data/p03318/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03318/Pascal/s297362660.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s297362660", "user_id": "u960852022"}, "prompt_components": {"gold_output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n", "input_to_evaluate": "var\n ans,k,tot1,tot2:int64;\n n:longint;\nfunction s(x:int64):int64;\nbegin\n if x=0 then exit(0)\n else exit(x mod 10+s(x div 10));\nend;\nbegin\n readln(n);\n ans:=1;k:=1;\n while n>0 do\n begin\n writeln(ans);\n tot1:=ans+k;\n tot2:=ans+k*10;\n if tot1*s(tot2)<=tot2*s(tot1) then ans:=tot1\n else\n begin\n ans:=tot2;\n k:=k*10;\n end;\n dec(n);\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "sample_input": "10\n"}, "reference_outputs": ["1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n"], "source_document_id": "p03318", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 507, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s980718218", "group_id": "codeNet:p03318", "input_text": "var\n ans,k,tot1,tot2:int64;\n n:longint;\nfunction s(x:longint):longint;\nbegin\n if x=0 then exit(0)\n else exit(x mod 10+s(x div 10));\nend;\nbegin\n readln(n);\n ans:=1;k:=1;\n while n>0 do\n begin\n writeln(ans);\n tot1:=ans+k;\n tot2:=ans+k*10;\n if tot1*s(tot2)<=tot2*s(tot1) then ans:=tot1\n else\n begin\n ans:=tot2;\n k:=k*10;\n end;\n dec(n);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1530921990, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03318.html", "problem_id": "p03318", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03318/input.txt", "sample_output_relpath": "derived/input_output/data/p03318/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03318/Pascal/s980718218.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s980718218", "user_id": "u960852022"}, "prompt_components": {"gold_output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n", "input_to_evaluate": "var\n ans,k,tot1,tot2:int64;\n n:longint;\nfunction s(x:longint):longint;\nbegin\n if x=0 then exit(0)\n else exit(x mod 10+s(x div 10));\nend;\nbegin\n readln(n);\n ans:=1;k:=1;\n while n>0 do\n begin\n writeln(ans);\n tot1:=ans+k;\n tot2:=ans+k*10;\n if tot1*s(tot2)<=tot2*s(tot1) then ans:=tot1\n else\n begin\n ans:=tot2;\n k:=k*10;\n end;\n dec(n);\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "sample_input": "10\n"}, "reference_outputs": ["1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n"], "source_document_id": "p03318", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 511, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s785515356", "group_id": "codeNet:p03320", "input_text": "var\n\tn,a:int64;\n\ti,k:Longint;\nfunction S(n:int64):real;\nvar x,m:int64;\nbegin\n\tm:=n;\n\tx:=0;\n\twhile n>0 do begin\n\t\tx:=x+n mod 10;\n\t\tn:=n div 10;\n\tend;\n\tS:=m/x;\nend;\nbegin\n\tn:=1;\n\ta:=1;\n\tread(k);\n\twriteln(1);\n\tfor i:=2 to k do begin\n\t\tif S(n+a)>S(n+a*10)then a:=a*10;\n\t\tn:=n+a;\n\t\twriteln(n);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1540012217, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03320.html", "problem_id": "p03320", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03320/input.txt", "sample_output_relpath": "derived/input_output/data/p03320/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03320/Pascal/s785515356.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s785515356", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n", "input_to_evaluate": "var\n\tn,a:int64;\n\ti,k:Longint;\nfunction S(n:int64):real;\nvar x,m:int64;\nbegin\n\tm:=n;\n\tx:=0;\n\twhile n>0 do begin\n\t\tx:=x+n mod 10;\n\t\tn:=n div 10;\n\tend;\n\tS:=m/x;\nend;\nbegin\n\tn:=1;\n\ta:=1;\n\tread(k);\n\twriteln(1);\n\tfor i:=2 to k do begin\n\t\tif S(n+a)>S(n+a*10)then a:=a*10;\n\t\tn:=n+a;\n\t\twriteln(n);\n\tend;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "sample_input": "10\n"}, "reference_outputs": ["1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n"], "source_document_id": "p03320", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s750178991", "group_id": "codeNet:p03325", "input_text": "var\n\tn,i,a,s:Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(a);\n\t\twhile a and 1=0 do begin\n\t\t\tinc(s);\n\t\t\ta:=a shr 1;\n\t\tend;\n\tend;\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1544083797, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Pascal/s750178991.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s750178991", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\tn,i,a,s:Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(a);\n\t\twhile a and 1=0 do begin\n\t\t\tinc(s);\n\t\t\ta:=a shr 1;\n\t\tend;\n\tend;\n\twriteln(s);\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s869910804", "group_id": "codeNet:p03325", "input_text": "function FuncSum(const x : Integer) : Integer;\n\tbegin\n\tResult := 0;\n\twhile x mod 2 = 0 do\n\t\tResult := Result + 1;\n\tend;\n\nprocedure ProcMain;\n\tvar\n\t\tn, i, sum : Integer;\n\t\ta : array of Integer;\n\tbegin\n\t\treadln(n);\n\t\tsetLength(a, n);\n\t\tsum := 0;\n\t\tfor i := 0 to n - 1 do\n\t\t\tbegin\n\t\t\tread(a[i]);\n\t\t\tsum := sum + FuncSum(a[i]);\n\t\t\tend;\n\t\tWriteLn(sum);\n\tend;\nbegin\nProcMain;\nend.\n", "language": "Pascal", "metadata": {"date": 1529268648, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Pascal/s869910804.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s869910804", "user_id": "u397546896"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function FuncSum(const x : Integer) : Integer;\n\tbegin\n\tResult := 0;\n\twhile x mod 2 = 0 do\n\t\tResult := Result + 1;\n\tend;\n\nprocedure ProcMain;\n\tvar\n\t\tn, i, sum : Integer;\n\t\ta : array of Integer;\n\tbegin\n\t\treadln(n);\n\t\tsetLength(a, n);\n\t\tsum := 0;\n\t\tfor i := 0 to n - 1 do\n\t\t\tbegin\n\t\t\tread(a[i]);\n\t\t\tsum := sum + FuncSum(a[i]);\n\t\t\tend;\n\t\tWriteLn(sum);\n\tend;\nbegin\nProcMain;\nend.\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 375, "cpu_time_ms": 2107, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s732069154", "group_id": "codeNet:p03325", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,math,classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr,owari:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n nyu := TStringList.Create;\n Readln(a);\n Readln(s);\n nyu.CommaText := s;\n count:=0;\n owari:=true;\n j:=0;\n\n while owari do begin\n for i:=j to a-1 do begin\n if strtoint(nyu[i])mod 268435456 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 268435456);\n count:=count+28;\n j:=i;\n break\n end;\n if strtoint(nyu[i])mod 16384 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 16384);\n count:=count+14;\n j:=i;\n break\n end;\n if strtoint(nyu[i])mod 64 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 64);\n count:=count+6;\n j:=i;\n break\n end;\n if strtoint(nyu[i])mod 2 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 2);\n inc(count);\n j:=i;\n break\n end;\n\n if i=a-1 then\n owari:=false;\n end;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1529201218, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Pascal/s732069154.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s732069154", "user_id": "u755925739"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,math,classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr,owari:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n nyu := TStringList.Create;\n Readln(a);\n Readln(s);\n nyu.CommaText := s;\n count:=0;\n owari:=true;\n j:=0;\n\n while owari do begin\n for i:=j to a-1 do begin\n if strtoint(nyu[i])mod 268435456 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 268435456);\n count:=count+28;\n j:=i;\n break\n end;\n if strtoint(nyu[i])mod 16384 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 16384);\n count:=count+14;\n j:=i;\n break\n end;\n if strtoint(nyu[i])mod 64 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 64);\n count:=count+6;\n j:=i;\n break\n end;\n if strtoint(nyu[i])mod 2 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 2);\n inc(count);\n j:=i;\n break\n end;\n\n if i=a-1 then\n owari:=false;\n end;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1445, "cpu_time_ms": 32, "memory_kb": 1760}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s754764135", "group_id": "codeNet:p03325", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,math,classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr,owari:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n nyu := TStringList.Create;\n Readln(a);\n Readln(s);\n nyu.CommaText := s;\n count:=0;\n owari:=true;\n\n while owari do begin\n for i:=0 to a-1 do begin\n if strtoint(nyu[i])mod 16384 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 16384);\n count:=count+14;\n break\n end;\n if strtoint(nyu[i])mod 64 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 64);\n count:=count+6;\n break\n end;\n if strtoint(nyu[i])mod 2 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 2);\n inc(count);\n break\n end;\n if i=a-1 then\n owari:=false;\n end;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1529200122, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Pascal/s754764135.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s754764135", "user_id": "u755925739"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,math,classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr,owari:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n nyu := TStringList.Create;\n Readln(a);\n Readln(s);\n nyu.CommaText := s;\n count:=0;\n owari:=true;\n\n while owari do begin\n for i:=0 to a-1 do begin\n if strtoint(nyu[i])mod 16384 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 16384);\n count:=count+14;\n break\n end;\n if strtoint(nyu[i])mod 64 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 64);\n count:=count+6;\n break\n end;\n if strtoint(nyu[i])mod 2 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 2);\n inc(count);\n break\n end;\n if i=a-1 then\n owari:=false;\n end;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1199, "cpu_time_ms": 2103, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s266246140", "group_id": "codeNet:p03325", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,math,classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr,owari:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n nyu := TStringList.Create;\n Readln(a);\n Readln(s);\n nyu.CommaText := s;\n count:=0;\n owari:=true;\n\n while owari do begin\n for i:=0 to a-1 do begin\n sum:=strtoint(nyu[i]);\n if strtoint(nyu[i])mod 2 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 2);\n inc(count);\n break\n end;\n if i=a-1 then\n owari:=false;\n end;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1529199376, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Pascal/s266246140.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s266246140", "user_id": "u755925739"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,math,classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr,owari:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n nyu := TStringList.Create;\n Readln(a);\n Readln(s);\n nyu.CommaText := s;\n count:=0;\n owari:=true;\n\n while owari do begin\n for i:=0 to a-1 do begin\n sum:=strtoint(nyu[i]);\n if strtoint(nyu[i])mod 2 = 0 then begin\n nyu[i]:=inttostr(strtoint(nyu[i])div 2);\n inc(count);\n break\n end;\n if i=a-1 then\n owari:=false;\n end;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 911, "cpu_time_ms": 2103, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s372501189", "group_id": "codeNet:p03329", "input_text": "const maxn=trunc(1e5);\n max=trunc(1e9);\nvar f:array[0..maxn+10] of longint;\n n:longint;\n\nfunction min(x,y:longint):longint;\nbegin\n\tif x>y then min:=y\n\telse min:=x;\nend;\n\nprocedure dp;\nvar power,i:longint;\nbegin\n\tf[0]:=0;\n\tfor i:=1 to 100000 do\n\t begin\n\t f[i]:=max;\n\t power:=1;\n\t while power<=i do\n\t begin\n\t f[i]:=min(f[i],f[i-power]+1);\n\t power:=power*6;\n\t end;\n\t power:=1;\n\t while power<=i do\n\t begin\n\t f[i]:=min(f[i],f[i-power]+1);\n\t power:=power*9;\n\t end;\n\t end;\nend;\n\nbegin\n\treadln(N);\n\tdp;\n\twrite(f[n]);\nend.", "language": "Pascal", "metadata": {"date": 1560743340, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03329.html", "problem_id": "p03329", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03329/input.txt", "sample_output_relpath": "derived/input_output/data/p03329/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03329/Pascal/s372501189.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s372501189", "user_id": "u017143931"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const maxn=trunc(1e5);\n max=trunc(1e9);\nvar f:array[0..maxn+10] of longint;\n n:longint;\n\nfunction min(x,y:longint):longint;\nbegin\n\tif x>y then min:=y\n\telse min:=x;\nend;\n\nprocedure dp;\nvar power,i:longint;\nbegin\n\tf[0]:=0;\n\tfor i:=1 to 100000 do\n\t begin\n\t f[i]:=max;\n\t power:=1;\n\t while power<=i do\n\t begin\n\t f[i]:=min(f[i],f[i-power]+1);\n\t power:=power*6;\n\t end;\n\t power:=1;\n\t while power<=i do\n\t begin\n\t f[i]:=min(f[i],f[i-power]+1);\n\t power:=power*9;\n\t end;\n\t end;\nend;\n\nbegin\n\treadln(N);\n\tdp;\n\twrite(f[n]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "sample_input": "127\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03329", "source_text": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 586, "cpu_time_ms": 4, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s890320950", "group_id": "codeNet:p03329", "input_text": "const max=trunc(1e5);\nvar f:array[0..max] of longint;\n n:longint;\n\nfunction min(x,y:longint):longint;\nbegin\n\tif x>y then min:=y\n\telse min:=x;\nend;\n\nprocedure dp;\nvar power,i:longint;\nbegin\n\tf[0]:=0;\n\tfor i:=1 to 100000 do\n\t begin\n\t f[i]:=max;\n\t power:=1;\n\t while power<=i do\n\t begin\n\t f[i]:=min(f[i],f[i-power]+1);\n\t power:=power*6;\n\t end;\n\t end;\nend;\n\nbegin\n\treadln(N);\n\tdp;\n\twrite(f[n]);\nend.", "language": "Pascal", "metadata": {"date": 1560742851, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03329.html", "problem_id": "p03329", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03329/input.txt", "sample_output_relpath": "derived/input_output/data/p03329/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03329/Pascal/s890320950.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s890320950", "user_id": "u017143931"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const max=trunc(1e5);\nvar f:array[0..max] of longint;\n n:longint;\n\nfunction min(x,y:longint):longint;\nbegin\n\tif x>y then min:=y\n\telse min:=x;\nend;\n\nprocedure dp;\nvar power,i:longint;\nbegin\n\tf[0]:=0;\n\tfor i:=1 to 100000 do\n\t begin\n\t f[i]:=max;\n\t power:=1;\n\t while power<=i do\n\t begin\n\t f[i]:=min(f[i],f[i-power]+1);\n\t power:=power*6;\n\t end;\n\t end;\nend;\n\nbegin\n\treadln(N);\n\tdp;\n\twrite(f[n]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "sample_input": "127\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03329", "source_text": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 432, "cpu_time_ms": 3, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s646385841", "group_id": "codeNet:p03331", "input_text": " var f,g:text; i,p:longint; n,a,b,k,tong,so,tong1,tong2:int64;\n gt,rev,rev1:array[0..300010] of int64;\n\n\n function mu(a1,b1,p1:int64):int64;\n var q:int64;\n begin\n if b1=1 then exit(a1);\n if b1=0 then exit(1);\n q:=mu(a1,b1 div 2,p1);\n if b1 mod 2 = 0 then exit(q*q mod p1)\n else exit((((q*q) mod p1) *a1 mod p1) mod p1);\n end;\n\n begin\n\n gt[0]:=1;\n p:=998244353; rev[0]:=1;\n for i:=1 to 300005 do\n begin\n gt[i]:=(gt[i-1] mod p * i mod p ) mod p;\n end;\n for i:=1 to 300005 do\n begin\n rev[i]:=mu(gt[i],p-2,p);\n end;\n\n// write(g,((gt[n]* (rev[i] mod p)) mod p * (rev[n-i] mod p)) mod p ,' ');\n\n readln(n,a,b,k);\n //n:=90081; a:=33447; b:=90629; k:=6391049189;\n tong:=0;\n for i:=0 to n do\n begin\n if (k-i*A)<0 then break;\n if (k-i*A) mod b = 0 then\n begin\n so:=(k-i*A) div B;\n tong1:=((((gt[n]* rev[i] ) mod p) * (rev[n-i] mod p)) mod p);\n tong2:=((((gt[n]* rev[so]) mod p) * (rev[n-so] mod p)) mod p);\n tong:=(tong+(tong1*tong2) mod p) mod p;\n end;\n end;\n write(tong);\n\n end.", "language": "Pascal", "metadata": {"date": 1534799881, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03331.html", "problem_id": "p03331", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03331/input.txt", "sample_output_relpath": "derived/input_output/data/p03331/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03331/Pascal/s646385841.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s646385841", "user_id": "u868920489"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": " var f,g:text; i,p:longint; n,a,b,k,tong,so,tong1,tong2:int64;\n gt,rev,rev1:array[0..300010] of int64;\n\n\n function mu(a1,b1,p1:int64):int64;\n var q:int64;\n begin\n if b1=1 then exit(a1);\n if b1=0 then exit(1);\n q:=mu(a1,b1 div 2,p1);\n if b1 mod 2 = 0 then exit(q*q mod p1)\n else exit((((q*q) mod p1) *a1 mod p1) mod p1);\n end;\n\n begin\n\n gt[0]:=1;\n p:=998244353; rev[0]:=1;\n for i:=1 to 300005 do\n begin\n gt[i]:=(gt[i-1] mod p * i mod p ) mod p;\n end;\n for i:=1 to 300005 do\n begin\n rev[i]:=mu(gt[i],p-2,p);\n end;\n\n// write(g,((gt[n]* (rev[i] mod p)) mod p * (rev[n-i] mod p)) mod p ,' ');\n\n readln(n,a,b,k);\n //n:=90081; a:=33447; b:=90629; k:=6391049189;\n tong:=0;\n for i:=0 to n do\n begin\n if (k-i*A)<0 then break;\n if (k-i*A) mod b = 0 then\n begin\n so:=(k-i*A) div B;\n tong1:=((((gt[n]* rev[i] ) mod p) * (rev[n-i] mod p)) mod p);\n tong2:=((((gt[n]* rev[so]) mod p) * (rev[n-so] mod p)) mod p);\n tong:=(tong+(tong1*tong2) mod p) mod p;\n end;\n end;\n write(tong);\n\n end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N.\nFind the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\".\n\nSample Input 1\n\n15\n\nSample Output 1\n\n6\n\nWhen A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.\n\nSample Input 2\n\n100000\n\nSample Output 2\n\n10", "sample_input": "15\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03331", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N.\nFind the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\".\n\nSample Input 1\n\n15\n\nSample Output 1\n\n6\n\nWhen A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.\n\nSample Input 2\n\n100000\n\nSample Output 2\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1044, "cpu_time_ms": 432, "memory_kb": 6144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s549330458", "group_id": "codeNet:p03332", "input_text": "const\n\tmodd=998244353;\nvar\n\tn,a,b,k,sum,max,w:int64;\n\tx,y,i:longint;\n\tf:array[0..300000] of int64;\n\nfunction pow(q,w:int64):int64;\nvar\n\tres:int64;\nbegin\n\tres:=1;\n\twhile w>0 do begin\n\t\tif w mod 2=1 then res:=res*q mod modd;\n\t\tq:=q*q mod modd;\n\t\tw:=w shr 1;\n\tend;\n\texit(res);\nend;\n\nfunction comb(q,w:int64):int64;\nbegin\n\tif q0 do begin\n\t\tif w mod 2=1 then res:=res*q mod modd;\n\t\tq:=q*q mod modd;\n\t\tw:=w shr 1;\n\tend;\n\texit(res);\nend;\n\nfunction comb(q,w:int64):int64;\nbegin\n\tif q0 do begin\n\t\tif w mod 2=1 then res:=res*q mod modd;\n\t\tq:=q*q mod modd;\n\t\tw:=w shr 1;\n\tend;\n\texit(res);\nend;\n\nfunction comb(q,w:int64):int64;\nbegin\n\tif q0 do begin\n\t\tif w mod 2=1 then res:=res*q mod modd;\n\t\tq:=q*q mod modd;\n\t\tw:=w shr 1;\n\tend;\n\texit(res);\nend;\n\nfunction comb(q,w:int64):int64;\nbegin\n\tif qmax then max:=t;\n end;\n write(max);\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1563335460, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03338.html", "problem_id": "p03338", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03338/input.txt", "sample_output_relpath": "derived/input_output/data/p03338/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03338/Pascal/s250907159.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s250907159", "user_id": "u863370423"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses crt;\nvar\n z:string;\n max,i,j,k,t:longint;\nbegin\n clrscr;\n read(z);\n writeln;\n for i:=1 to length(z)-1 do\n begin\n t:=0;\n for j:=1 to i do\n for k:=i+1 to length(z) do\n if z[j]=z[k] then\n begin\n inc(t);\n break;\n end;\n if t>max then max:=t;\n end;\n write(max);\n readln\nend.\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\nWe will cut this string at one position into two strings X and Y.\nHere, we would like to maximize the number of different letters contained in both X and Y.\nFind the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the largest possible number of different letters contained in both X and Y.\n\nSample Input 1\n\n6\naabbca\n\nSample Output 1\n\n2\n\nIf we cut the string between the third and fourth letters into X = aab and Y = bca, the letters contained in both X and Y are a and b.\nThere will never be three or more different letters contained in both X and Y, so the answer is 2.\n\nSample Input 2\n\n10\naaaaaaaaaa\n\nSample Output 2\n\n1\n\nHowever we divide S, only a will be contained in both X and Y.\n\nSample Input 3\n\n45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir\n\nSample Output 3\n\n9", "sample_input": "6\naabbca\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03338", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\nWe will cut this string at one position into two strings X and Y.\nHere, we would like to maximize the number of different letters contained in both X and Y.\nFind the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the largest possible number of different letters contained in both X and Y.\n\nSample Input 1\n\n6\naabbca\n\nSample Output 1\n\n2\n\nIf we cut the string between the third and fourth letters into X = aab and Y = bca, the letters contained in both X and Y are a and b.\nThere will never be three or more different letters contained in both X and Y, so the answer is 2.\n\nSample Input 2\n\n10\naaaaaaaaaa\n\nSample Output 2\n\n1\n\nHowever we divide S, only a will be contained in both X and Y.\n\nSample Input 3\n\n45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 705, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s729580292", "group_id": "codeNet:p03339", "input_text": "uses crt;\nvar\n s:string;\n a,b:array[1..10000000] of longint;\n i,j,k:longint;\nbegin\n clrscr;\n read(s);\n writeln;\n k:=0;\n j:=0;\n for i:=1 to length(s) do\n if s[i]='W' then\n begin\n inc(j);\n a[i]:=j;\n end\n else a[i]:=j;\n for i:=length(s) downto 1 do\n if s[i]='E' then\n begin\n inc(k);\n b[i]:=k;\n end\n else b[i]:=k;\n k:=0;\n for i:=1 to length(s) do\n if k<(a[i]+b[i]) then k:=a[i]+b[i];\n write(k);\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1563335426, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03339.html", "problem_id": "p03339", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03339/input.txt", "sample_output_relpath": "derived/input_output/data/p03339/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03339/Pascal/s729580292.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s729580292", "user_id": "u863370423"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar\n s:string;\n a,b:array[1..10000000] of longint;\n i,j,k:longint;\nbegin\n clrscr;\n read(s);\n writeln;\n k:=0;\n j:=0;\n for i:=1 to length(s) do\n if s[i]='W' then\n begin\n inc(j);\n a[i]:=j;\n end\n else a[i]:=j;\n for i:=length(s) downto 1 do\n if s[i]='E' then\n begin\n inc(k);\n b[i]:=k;\n end\n else b[i]:=k;\n k:=0;\n for i:=1 to length(s) do\n if k<(a[i]+b[i]) then k:=a[i]+b[i];\n write(k);\n readln\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people standing in a row from west to east.\nEach person is facing east or west.\nThe directions of the people is given as a string S of length N.\nThe i-th person from the west is facing east if S_i = E, and west if S_i = W.\n\nYou will appoint one of the N people as the leader, then command the rest of them to face in the direction of the leader.\nHere, we do not care which direction the leader is facing.\n\nThe people in the row hate to change their directions, so you would like to select the leader so that the number of people who have to change their directions is minimized.\nFind the minimum number of people who have to change their directions.\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n|S| = N\n\nS_i is E or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of people who have to change their directions.\n\nSample Input 1\n\n5\nWEEWW\n\nSample Output 1\n\n1\n\nAssume that we appoint the third person from the west as the leader.\nThen, the first person from the west needs to face east and has to turn around.\nThe other people do not need to change their directions, so the number of people who have to change their directions is 1 in this case.\nIt is not possible to have 0 people who have to change their directions, so the answer is 1.\n\nSample Input 2\n\n12\nWEWEWEEEWWWE\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\nWWWWWEEE\n\nSample Output 3\n\n3", "sample_input": "5\nWEEWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03339", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people standing in a row from west to east.\nEach person is facing east or west.\nThe directions of the people is given as a string S of length N.\nThe i-th person from the west is facing east if S_i = E, and west if S_i = W.\n\nYou will appoint one of the N people as the leader, then command the rest of them to face in the direction of the leader.\nHere, we do not care which direction the leader is facing.\n\nThe people in the row hate to change their directions, so you would like to select the leader so that the number of people who have to change their directions is minimized.\nFind the minimum number of people who have to change their directions.\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n|S| = N\n\nS_i is E or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of people who have to change their directions.\n\nSample Input 1\n\n5\nWEEWW\n\nSample Output 1\n\n1\n\nAssume that we appoint the third person from the west as the leader.\nThen, the first person from the west needs to face east and has to turn around.\nThe other people do not need to change their directions, so the number of people who have to change their directions is 1 in this case.\nIt is not possible to have 0 people who have to change their directions, so the answer is 1.\n\nSample Input 2\n\n12\nWEWEWEEEWWWE\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\nWWWWWEEE\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 778, "cpu_time_ms": 1, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s288638480", "group_id": "codeNet:p03355", "input_text": "var\n\ts:String;\n\ti,j,k:Longint;\n\ta,b,c,d,e,f:String[5];\nbegin\n\treadln(s);\n\tread(k);\n\ta:='zzzzz';\n\tb:=a;\n\tc:=b;\n\td:=c;\n\te:=d;\n\tfor i:=1 to length(s)do begin\n\t\tfor j:=1 to k do begin\n\t\t\tif i+j-1>length(s)then break;\n\t\t\tf:=copy(s,i,j);\n\t\t\tif a>f then begin\n\t\t\t\te:=d;\n\t\t\t\td:=c;\n\t\t\t\tc:=b;\n\t\t\t\tb:=a;\n\t\t\t\ta:=f;\n\t\t\tend else if a<>f then begin\n\t\t\t\tif b>f then begin\n\t\t\t\t\te:=d;\n\t\t\t\t\td:=c;\n\t\t\t\t\tc:=b;\n\t\t\t\t\tb:=f;\n\t\t\t\tend else if b<>f then begin\n\t\t\t\t\tif c>f then begin\n\t\t\t\t\t\te:=d;\n\t\t\t\t\t\td:=c;\n\t\t\t\t\t\tc:=f;\n\t\t\t\t\tend else if c<>f then begin\n\t\t\t\t\t\tif d>f then begin\n\t\t\t\t\t\t\te:=d;\n\t\t\t\t\t\t\td:=f;\n\t\t\t\t\t\tend else if d<>f then begin\n\t\t\t\t\t\t\tif e>f then begin\n\t\t\t\t\t\t\t\te:=f;\n\t\t\t\t\t\t\tend;\n\t\t\t\t\t\tend;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tif k=1 then writeln(a)else if k=2 then writeln(b)else if k=3 then writeln(c)else if k=4 then writeln(d)else writeln(e);\nend.", "language": "Pascal", "metadata": {"date": 1544009152, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03355.html", "problem_id": "p03355", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03355/input.txt", "sample_output_relpath": "derived/input_output/data/p03355/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03355/Pascal/s288638480.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s288638480", "user_id": "u657913472"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "var\n\ts:String;\n\ti,j,k:Longint;\n\ta,b,c,d,e,f:String[5];\nbegin\n\treadln(s);\n\tread(k);\n\ta:='zzzzz';\n\tb:=a;\n\tc:=b;\n\td:=c;\n\te:=d;\n\tfor i:=1 to length(s)do begin\n\t\tfor j:=1 to k do begin\n\t\t\tif i+j-1>length(s)then break;\n\t\t\tf:=copy(s,i,j);\n\t\t\tif a>f then begin\n\t\t\t\te:=d;\n\t\t\t\td:=c;\n\t\t\t\tc:=b;\n\t\t\t\tb:=a;\n\t\t\t\ta:=f;\n\t\t\tend else if a<>f then begin\n\t\t\t\tif b>f then begin\n\t\t\t\t\te:=d;\n\t\t\t\t\td:=c;\n\t\t\t\t\tc:=b;\n\t\t\t\t\tb:=f;\n\t\t\t\tend else if b<>f then begin\n\t\t\t\t\tif c>f then begin\n\t\t\t\t\t\te:=d;\n\t\t\t\t\t\td:=c;\n\t\t\t\t\t\tc:=f;\n\t\t\t\t\tend else if c<>f then begin\n\t\t\t\t\t\tif d>f then begin\n\t\t\t\t\t\t\te:=d;\n\t\t\t\t\t\t\td:=f;\n\t\t\t\t\t\tend else if d<>f then begin\n\t\t\t\t\t\t\tif e>f then begin\n\t\t\t\t\t\t\t\te:=f;\n\t\t\t\t\t\t\tend;\n\t\t\t\t\t\tend;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tif k=1 then writeln(a)else if k=2 then writeln(b)else if k=3 then writeln(c)else if k=4 then writeln(d)else writeln(e);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "sample_input": "aba\n4\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03355", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 835, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s752316377", "group_id": "codeNet:p03355", "input_text": "var\n\ts:String;\n\ti,j,k:Longint;\n\ta,b,c,d,e:String[5];\nbegin\n\treadln(s);\n\tread(k);\n\ta:='zzzzz';\n\tb:=a;\n\tc:=b;\n\td:=c;\n\te:=d;\n\tfor i:=1 to length(s)do begin\n\t\tfor j:=1 to k do begin\n\t\t\tif i+j-1>length(s)then break;\n\t\t\tif a>copy(s,i,j)then begin\n\t\t\t\te:=d;\n\t\t\t\td:=c;\n\t\t\t\tc:=b;\n\t\t\t\tb:=a;\n\t\t\t\ta:=copy(s,i,j);\n\t\t\tend else if a<>copy(s,i,j)then begin\n\t\t\t\tif b>copy(s,i,j)then begin\n\t\t\t\t\te:=d;\n\t\t\t\t\td:=c;\n\t\t\t\t\tc:=b;\n\t\t\t\t\tb:=copy(s,i,j);\n\t\t\t\tend else if b<>copy(s,i,j)then begin\n\t\t\t\t\tif c>copy(s,i,j)then begin\n\t\t\t\t\t\te:=d;\n\t\t\t\t\t\td:=c;\n\t\t\t\t\t\tc:=copy(s,i,j);\n\t\t\t\t\tend else if c<>copy(s,i,j)then begin\n\t\t\t\t\t\tif d>copy(s,i,j)then begin\n\t\t\t\t\t\t\te:=d;\n\t\t\t\t\t\t\td:=copy(s,i,j);\n\t\t\t\t\t\tend else if d<>copy(s,i,j)then begin\n\t\t\t\t\t\t\tif e>copy(s,i,j)then begin\n\t\t\t\t\t\t\t\te:=copy(s,i,j);\n\t\t\t\t\t\t\tend;\n\t\t\t\t\t\tend;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tif k=1 then writeln(a)else if k=2 then writeln(b)else if k=3 then writeln(c)else if k=4 then writeln(d)else writeln(e);\nend.", "language": "Pascal", "metadata": {"date": 1544009065, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03355.html", "problem_id": "p03355", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03355/input.txt", "sample_output_relpath": "derived/input_output/data/p03355/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03355/Pascal/s752316377.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s752316377", "user_id": "u657913472"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "var\n\ts:String;\n\ti,j,k:Longint;\n\ta,b,c,d,e:String[5];\nbegin\n\treadln(s);\n\tread(k);\n\ta:='zzzzz';\n\tb:=a;\n\tc:=b;\n\td:=c;\n\te:=d;\n\tfor i:=1 to length(s)do begin\n\t\tfor j:=1 to k do begin\n\t\t\tif i+j-1>length(s)then break;\n\t\t\tif a>copy(s,i,j)then begin\n\t\t\t\te:=d;\n\t\t\t\td:=c;\n\t\t\t\tc:=b;\n\t\t\t\tb:=a;\n\t\t\t\ta:=copy(s,i,j);\n\t\t\tend else if a<>copy(s,i,j)then begin\n\t\t\t\tif b>copy(s,i,j)then begin\n\t\t\t\t\te:=d;\n\t\t\t\t\td:=c;\n\t\t\t\t\tc:=b;\n\t\t\t\t\tb:=copy(s,i,j);\n\t\t\t\tend else if b<>copy(s,i,j)then begin\n\t\t\t\t\tif c>copy(s,i,j)then begin\n\t\t\t\t\t\te:=d;\n\t\t\t\t\t\td:=c;\n\t\t\t\t\t\tc:=copy(s,i,j);\n\t\t\t\t\tend else if c<>copy(s,i,j)then begin\n\t\t\t\t\t\tif d>copy(s,i,j)then begin\n\t\t\t\t\t\t\te:=d;\n\t\t\t\t\t\t\td:=copy(s,i,j);\n\t\t\t\t\t\tend else if d<>copy(s,i,j)then begin\n\t\t\t\t\t\t\tif e>copy(s,i,j)then begin\n\t\t\t\t\t\t\t\te:=copy(s,i,j);\n\t\t\t\t\t\t\tend;\n\t\t\t\t\t\tend;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tif k=1 then writeln(a)else if k=2 then writeln(b)else if k=3 then writeln(c)else if k=4 then writeln(d)else writeln(e);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "sample_input": "aba\n4\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03355", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 945, "cpu_time_ms": 20, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s281848300", "group_id": "codeNet:p03356", "input_text": "var i,j:longint;\n fx,fy,x,y:longint;\n n,m:longint;\n a,next,last,father:array[0..200050]of longint;\n v,newv:array[0..200050]of boolean;\n ans:longint;\nfunction gf(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=gf(father[x]);\n gf:=father[x];\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n do\n father[i]:=i;\n for i:=1 to m do\n begin\n read(x,y);\n fx:=gf(x);\n fy:=gf(y);\n if fx<>fy then father[fx]:=fy;\n end;\n for i:=n downto 1 do\n begin\n next[i]:=last[gf(i)];\n last[gf(i)]:=i;\n end;\n for i:=1 to n do\n if not v[i] then\n begin\n x:=i;\n repeat\n newv[x]:=true;\n x:=next[x];\n until x=0;\n x:=i;\n repeat\n if newv[a[x]] then inc(ans);\n x:=next[x];\n until x=0;\n x:=i;\n repeat\n v[x]:=true;\n newv[x]:=false;\n x:=next[x];\n until x=0;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1526175915, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03356.html", "problem_id": "p03356", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03356/input.txt", "sample_output_relpath": "derived/input_output/data/p03356/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03356/Pascal/s281848300.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s281848300", "user_id": "u809476955"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var i,j:longint;\n fx,fy,x,y:longint;\n n,m:longint;\n a,next,last,father:array[0..200050]of longint;\n v,newv:array[0..200050]of boolean;\n ans:longint;\nfunction gf(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=gf(father[x]);\n gf:=father[x];\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n do\n father[i]:=i;\n for i:=1 to m do\n begin\n read(x,y);\n fx:=gf(x);\n fy:=gf(y);\n if fx<>fy then father[fx]:=fy;\n end;\n for i:=n downto 1 do\n begin\n next[i]:=last[gf(i)];\n last[gf(i)]:=i;\n end;\n for i:=1 to n do\n if not v[i] then\n begin\n x:=i;\n repeat\n newv[x]:=true;\n x:=next[x];\n until x=0;\n x:=i;\n repeat\n if newv[a[x]] then inc(ans);\n x:=next[x];\n until x=0;\n x:=i;\n repeat\n v[x]:=true;\n newv[x]:=false;\n x:=next[x];\n until x=0;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N.\nWe also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M).\nAtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized:\n\nChoose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}.\n\nFind the maximum possible number of i such that p_i = i after operations.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ M ≤ 10^5\n\np is a permutation of integers from 1 through N.\n\n1 ≤ x_j,y_j ≤ N\n\nx_j ≠ y_j\n\nIf i ≠ j, \\{x_i,y_i\\} ≠ \\{x_j,y_j\\}.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 p_2 .. p_N\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the maximum possible number of i such that p_i = i after operations.\n\nSample Input 1\n\n5 2\n5 3 1 4 2\n1 3\n5 4\n\nSample Output 1\n\n2\n\nIf we perform the operation by choosing j=1, p becomes 1 3 5 4 2, which is optimal, so the answer is 2.\n\nSample Input 2\n\n3 2\n3 2 1\n1 2\n2 3\n\nSample Output 2\n\n3\n\nIf we perform the operation by, for example, choosing j=1, j=2, j=1 in this order, p becomes 1 2 3, which is obviously optimal.\nNote that we may choose the same j any number of times.\n\nSample Input 3\n\n10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9\n\nSample Output 3\n\n8\n\nSample Input 4\n\n5 1\n1 2 3 4 5\n1 5\n\nSample Output 4\n\n5\n\nWe do not have to perform the operation.", "sample_input": "5 2\n5 3 1 4 2\n1 3\n5 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03356", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N.\nWe also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M).\nAtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized:\n\nChoose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}.\n\nFind the maximum possible number of i such that p_i = i after operations.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ M ≤ 10^5\n\np is a permutation of integers from 1 through N.\n\n1 ≤ x_j,y_j ≤ N\n\nx_j ≠ y_j\n\nIf i ≠ j, \\{x_i,y_i\\} ≠ \\{x_j,y_j\\}.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 p_2 .. p_N\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the maximum possible number of i such that p_i = i after operations.\n\nSample Input 1\n\n5 2\n5 3 1 4 2\n1 3\n5 4\n\nSample Output 1\n\n2\n\nIf we perform the operation by choosing j=1, p becomes 1 3 5 4 2, which is optimal, so the answer is 2.\n\nSample Input 2\n\n3 2\n3 2 1\n1 2\n2 3\n\nSample Output 2\n\n3\n\nIf we perform the operation by, for example, choosing j=1, j=2, j=1 in this order, p becomes 1 2 3, which is obviously optimal.\nNote that we may choose the same j any number of times.\n\nSample Input 3\n\n10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9\n\nSample Output 3\n\n8\n\nSample Input 4\n\n5 1\n1 2 3 4 5\n1 5\n\nSample Output 4\n\n5\n\nWe do not have to perform the operation.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 924, "cpu_time_ms": 42, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s482727167", "group_id": "codeNet:p03362", "input_text": "var n,num,max,sum:longint;\n i,j:longint;\n v:array[0..100000]of boolean;\n a:array[0..10000]of longint;\nbegin\n readln(n);\n max:=55555;\n for i:=2 to max do\n if not v[i] then\n begin\n inc(num);\n a[num]:=i;\n for j:=1 to max div i do\n v[i*j]:=true;\n end;\n for i:=1 to num do\n begin\n if a[i] mod 10=1 then\n begin\n write(a[i],' ');\n dec(n);\n end;\n if n=0 then exit;\n end;\n\nend.", "language": "Pascal", "metadata": {"date": 1525570548, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03362.html", "problem_id": "p03362", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03362/input.txt", "sample_output_relpath": "derived/input_output/data/p03362/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03362/Pascal/s482727167.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s482727167", "user_id": "u165920140"}, "prompt_components": {"gold_output": "3 5 7 11 31\n", "input_to_evaluate": "var n,num,max,sum:longint;\n i,j:longint;\n v:array[0..100000]of boolean;\n a:array[0..10000]of longint;\nbegin\n readln(n);\n max:=55555;\n for i:=2 to max do\n if not v[i] then\n begin\n inc(num);\n a[num]:=i;\n for j:=1 to max div i do\n v[i*j]:=true;\n end;\n for i:=1 to num do\n begin\n if a[i] mod 10=1 then\n begin\n write(a[i],' ');\n dec(n);\n end;\n if n=0 then exit;\n end;\n\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "sample_input": "5\n"}, "reference_outputs": ["3 5 7 11 31\n"], "source_document_id": "p03362", "source_text": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 420, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s808958949", "group_id": "codeNet:p03362", "input_text": "var n,num,max:longint;\n i,j:longint;\n v:array[0..100000]of boolean;\n a:array[0..10000]of longint;\nbegin\n readln(n);\n max:=55555;\n for i:=2 to max do\n if not v[i] then\n begin\n inc(num);\n a[num]:=i;\n for j:=1 to max div i do\n v[i*j]:=true;\n end;\n if n mod 2=0 then\n begin\n for i:=2 to n+1 do\n write(a[i],' ');\n writeln;\n end else\n begin\n for i:=1 to n do\n write(a[i],' ');\n writeln;\n end;\n\nend.", "language": "Pascal", "metadata": {"date": 1525569437, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03362.html", "problem_id": "p03362", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03362/input.txt", "sample_output_relpath": "derived/input_output/data/p03362/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03362/Pascal/s808958949.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s808958949", "user_id": "u165920140"}, "prompt_components": {"gold_output": "3 5 7 11 31\n", "input_to_evaluate": "var n,num,max:longint;\n i,j:longint;\n v:array[0..100000]of boolean;\n a:array[0..10000]of longint;\nbegin\n readln(n);\n max:=55555;\n for i:=2 to max do\n if not v[i] then\n begin\n inc(num);\n a[num]:=i;\n for j:=1 to max div i do\n v[i*j]:=true;\n end;\n if n mod 2=0 then\n begin\n for i:=2 to n+1 do\n write(a[i],' ');\n writeln;\n end else\n begin\n for i:=1 to n do\n write(a[i],' ');\n writeln;\n end;\n\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "sample_input": "5\n"}, "reference_outputs": ["3 5 7 11 31\n"], "source_document_id": "p03362", "source_text": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s285180924", "group_id": "codeNet:p03366", "input_text": "var\n i,j,flag:longint;\n n,s,left,right,tot:qword;\n p,x:array[1..100000]of qword;\nbegin\n readln(n,s);\n for i:=1 to n do\n readln(x[i],p[i]);\n if s<=x[1] then\n begin\n write(x[n]-s);\n exit;\n end;\n if s>x[n] then\n begin\n write(s-x[1]);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]>=p[n] then begin p[1]:=p[1]+p[n]; dec(right);flag:=1;end\n else begin p[n+1]:=p[n]+p[1]; inc(left);flag:=-1;end;\n tot:=tot+x[n]-x[1];\n while (x[left]s) do\n begin\n if p[left]>=p[right] then begin\n p[left]:=p[left]+p[right];\n if flag<>1 then begin tot:=tot+x[right]-x[left]; flag:=1;end;\n dec(right); end\n else begin\n p[right]:=p[left]+p[right];\n if flag<>-1 then begin tot:=tot+x[right]-x[left]; flag:=-1;end;\n inc(left); end;\n end;\n if x[left]>s then writeln(tot+x[right]-s)\n else writeln(tot+s-x[left]);\nend.", "language": "Pascal", "metadata": {"date": 1530840134, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03366.html", "problem_id": "p03366", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03366/input.txt", "sample_output_relpath": "derived/input_output/data/p03366/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03366/Pascal/s285180924.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s285180924", "user_id": "u658406065"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n i,j,flag:longint;\n n,s,left,right,tot:qword;\n p,x:array[1..100000]of qword;\nbegin\n readln(n,s);\n for i:=1 to n do\n readln(x[i],p[i]);\n if s<=x[1] then\n begin\n write(x[n]-s);\n exit;\n end;\n if s>x[n] then\n begin\n write(s-x[1]);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]>=p[n] then begin p[1]:=p[1]+p[n]; dec(right);flag:=1;end\n else begin p[n+1]:=p[n]+p[1]; inc(left);flag:=-1;end;\n tot:=tot+x[n]-x[1];\n while (x[left]s) do\n begin\n if p[left]>=p[right] then begin\n p[left]:=p[left]+p[right];\n if flag<>1 then begin tot:=tot+x[right]-x[left]; flag:=1;end;\n dec(right); end\n else begin\n p[right]:=p[left]+p[right];\n if flag<>-1 then begin tot:=tot+x[right]-x[left]; flag:=-1;end;\n inc(left); end;\n end;\n if x[left]>s then writeln(tot+x[right]-s)\n else writeln(tot+s-x[left]);\nend.", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "sample_input": "3 2\n1 3\n3 4\n4 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03366", "source_text": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 968, "cpu_time_ms": 45, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s644301303", "group_id": "codeNet:p03366", "input_text": "var n,s,max,i,left,right:longint;\n count:int64; \n x,p:array[1..100000]of longint;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n count:=x[n]-s;\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n until(x[left]>s)or(x[right]s then write(count+x[right]-s);\n if x[right]=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n until(x[left]>s)or(x[right]s then write(count+x[right]-s);\n if x[right]=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n until(x[left]>s)or(x[right]s then write(count+x[right]-x[left]);\n if x[right]=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n until(x[left]>s)or(x[right]s then write(count+x[right]-x[left]);\n if x[right]ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524363377, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03373.html", "problem_id": "p03373", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03373/input.txt", "sample_output_relpath": "derived/input_output/data/p03373/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03373/Pascal/s792288074.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s792288074", "user_id": "u809476955"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "sample_input": "1500 2000 1600 3 2\n"}, "reference_outputs": ["7900\n"], "source_document_id": "p03373", "source_text": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1209, "cpu_time_ms": 4, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s769534935", "group_id": "codeNet:p03374", "input_text": "{$mode objfpc}\nprogram D;\nuses\n fgl, math;\n\ntype\n TIntLIst = specialize TFPGList;\n\nvar\n N: Integer;\n C: Int64;\n xi, li, ri, vi: TIntLIst;\n\nprocedure ReadData;\nvar\n i: Integer;\n x, v: Int64;\n\nbegin\n ReadLn(N, C);\n\n li := TIntLIst.Create;\n ri := TIntLIst.Create;\n ri.Count := N;\n xi := TIntLIst.Create;\n vi := TIntLIst.Create;\n\n for i := 1 to N do\n begin\n ReadLn(x, v);\n xi.Add(x);\n li.Add(x);\n vi.Add(v);\n end;\n\n ri.Count := N;\n for i := N - 1 downto 0 do\n ri[i] := c - xi[i];\nend;\n\nvar\n L1, L2, R1, R2: TIntList;\n L1M, L2M, R1M, R2M: TIntList;\n\nfunction Solve: Int64;\nvar\n i: Integer;\n l, r: Integer;\n Current: Int64;\n CurSum: Int64;\n\nbegin\n L1 := TIntLIst.Create;\n L2 := TIntLIst.Create;\n R1 := TIntLIst.Create;\n R2 := TIntLIst.Create;\n L1M := TIntLIst.Create;\n L2M := TIntLIst.Create;\n R1M := TIntLIst.Create;\n R2M := TIntLIst.Create;\n L1.Count := N + 1;\n L2.Count := N + 1;\n R1.Count := N + 1;\n R2.Count := N + 1;\n L1M.Count := N + 1;\n L2M.Count := N + 1;\n R1M.Count := N + 1;\n R2M.Count := N + 1;\n\n{\nl1(l) := v0+...+vl-(xl)\nl2(l) := v0+...+vr-2(xl)\nr2(r) := vr+...+vN-1-(C - xr)\nr2(r) := vr+...+vN-1-2(C - xr)\n}\n l := 0;\n L1[l] := vi[l] - xi[l];\n L2[l] := vi[l] - 2 * xi[l];\n L1M[l] := L1[l];\n L2M[l] := L2[l];\n CurSum := vi[l];\n for l := 1 to N - 1 do\n begin\n Inc(CurSum, vi[l]);\n L1[l] := CurSum - xi[l];\n L2[l] := CurSum - 2 * li[l];\n L1M[l] := Max(L1[l], L1M[l - 1]);\n L2M[l] := Max(L2[l], L2M[l - 1]);\n end;\n\n r := N - 1;\n CurSum := vi[r];\n R1[r] := CurSum - (C - xi[r]);\n R2[r] := CurSum - 2 * (C - xi[r]);\n R1M[r] := R1[r];\n R2M[r] := R2[r];\n for r := N - 2 downto 0 do\n begin\n Inc(CurSum, vi[r]);\n R1[r] := CurSum - ri[r];\n R2[r] := CurSum - 2 * ri[r];\n R1M[r] := Max(R1[r], R1M[r + 1]);\n R2M[r] := Max(R2[r], R2M[r + 1]);\n end;\n\n Result := 0;\n\n for i := 0 to N - 2 do\n begin\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\n\n l := i;\n r := (i + 1);\n {\n WriteLn('L1:', L1[l], ' L2:', L2[l]); \n WriteLn('R1:', R1[r], ' R2:', R2[r]); \n WriteLn('LM:', L1M[l], ' L2M:', L2M[l]); \n WriteLn('RM:', R1M[r], ' R2M:', R2M[r]); \n }\n\n if Result < L2[l] + R1M[r] then\n Result := L2[l] + R1M[r];\n\n if Result < L1M[l] + R2[r] then\n Result := L1M[l] + R2[r];\n end;\n i := N - 1;\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\nend;\n\nbegin\n ReadData;\n\n WriteLn(Solve);\nend.", "language": "Pascal", "metadata": {"date": 1529918225, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s769534935.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s769534935", "user_id": "u422041582"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "{$mode objfpc}\nprogram D;\nuses\n fgl, math;\n\ntype\n TIntLIst = specialize TFPGList;\n\nvar\n N: Integer;\n C: Int64;\n xi, li, ri, vi: TIntLIst;\n\nprocedure ReadData;\nvar\n i: Integer;\n x, v: Int64;\n\nbegin\n ReadLn(N, C);\n\n li := TIntLIst.Create;\n ri := TIntLIst.Create;\n ri.Count := N;\n xi := TIntLIst.Create;\n vi := TIntLIst.Create;\n\n for i := 1 to N do\n begin\n ReadLn(x, v);\n xi.Add(x);\n li.Add(x);\n vi.Add(v);\n end;\n\n ri.Count := N;\n for i := N - 1 downto 0 do\n ri[i] := c - xi[i];\nend;\n\nvar\n L1, L2, R1, R2: TIntList;\n L1M, L2M, R1M, R2M: TIntList;\n\nfunction Solve: Int64;\nvar\n i: Integer;\n l, r: Integer;\n Current: Int64;\n CurSum: Int64;\n\nbegin\n L1 := TIntLIst.Create;\n L2 := TIntLIst.Create;\n R1 := TIntLIst.Create;\n R2 := TIntLIst.Create;\n L1M := TIntLIst.Create;\n L2M := TIntLIst.Create;\n R1M := TIntLIst.Create;\n R2M := TIntLIst.Create;\n L1.Count := N + 1;\n L2.Count := N + 1;\n R1.Count := N + 1;\n R2.Count := N + 1;\n L1M.Count := N + 1;\n L2M.Count := N + 1;\n R1M.Count := N + 1;\n R2M.Count := N + 1;\n\n{\nl1(l) := v0+...+vl-(xl)\nl2(l) := v0+...+vr-2(xl)\nr2(r) := vr+...+vN-1-(C - xr)\nr2(r) := vr+...+vN-1-2(C - xr)\n}\n l := 0;\n L1[l] := vi[l] - xi[l];\n L2[l] := vi[l] - 2 * xi[l];\n L1M[l] := L1[l];\n L2M[l] := L2[l];\n CurSum := vi[l];\n for l := 1 to N - 1 do\n begin\n Inc(CurSum, vi[l]);\n L1[l] := CurSum - xi[l];\n L2[l] := CurSum - 2 * li[l];\n L1M[l] := Max(L1[l], L1M[l - 1]);\n L2M[l] := Max(L2[l], L2M[l - 1]);\n end;\n\n r := N - 1;\n CurSum := vi[r];\n R1[r] := CurSum - (C - xi[r]);\n R2[r] := CurSum - 2 * (C - xi[r]);\n R1M[r] := R1[r];\n R2M[r] := R2[r];\n for r := N - 2 downto 0 do\n begin\n Inc(CurSum, vi[r]);\n R1[r] := CurSum - ri[r];\n R2[r] := CurSum - 2 * ri[r];\n R1M[r] := Max(R1[r], R1M[r + 1]);\n R2M[r] := Max(R2[r], R2M[r + 1]);\n end;\n\n Result := 0;\n\n for i := 0 to N - 2 do\n begin\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\n\n l := i;\n r := (i + 1);\n {\n WriteLn('L1:', L1[l], ' L2:', L2[l]); \n WriteLn('R1:', R1[r], ' R2:', R2[r]); \n WriteLn('LM:', L1M[l], ' L2M:', L2M[l]); \n WriteLn('RM:', R1M[r], ' R2M:', R2M[r]); \n }\n\n if Result < L2[l] + R1M[r] then\n Result := L2[l] + R1M[r];\n\n if Result < L1M[l] + R2[r] then\n Result := L1M[l] + R2[r];\n end;\n i := N - 1;\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\nend;\n\nbegin\n ReadData;\n\n WriteLn(Solve);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2516, "cpu_time_ms": 76, "memory_kb": 10568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s854113502", "group_id": "codeNet:p03374", "input_text": "{$mode objfpc}\nprogram D;\nuses\n fgl, math;\n\ntype\n TIntLIst = specialize TFPGList;\n\nvar\n N: Integer;\n C: Int64;\n xi, li, ri, vi: TIntLIst;\n x, v: Int64;\n\nprocedure ReadData;\nvar\n i: Integer;\n CurSum: Int64;\n\nbegin\n ReadLn(N, C);\n\n li := TIntLIst.Create;\n ri := TIntLIst.Create;\n ri.Count := N;\n xi := TIntLIst.Create;\n vi := TIntLIst.Create;\n\n for i := 1 to N do\n begin\n ReadLn(x, v);\n xi.Add(x);\n li.Add(x);\n vi.Add(v);\n end;\n\n ri.Count := N;\n for i := N - 1 downto 0 do\n ri[i] := c - xi[i];\nend;\n\nvar\n L1, L2, R1, R2: TIntList;\n L1M, L2M, R1M, R2M: TIntList;\n\nfunction Solve: Int64;\nvar\n i: Integer;\n l, r: Integer;\n Current: Int64;\n CurSum: Int64;\n\nbegin\n L1 := TIntLIst.Create;\n L2 := TIntLIst.Create;\n R1 := TIntLIst.Create;\n R2 := TIntLIst.Create;\n L1M := TIntLIst.Create;\n L2M := TIntLIst.Create;\n R1M := TIntLIst.Create;\n R2M := TIntLIst.Create;\n L1.Count := N + 1;\n L2.Count := N + 1;\n R1.Count := N + 1;\n R2.Count := N + 1;\n L1M.Count := N + 1;\n L2M.Count := N + 1;\n R1M.Count := N + 1;\n R2M.Count := N + 1;\n\n{\nl1(l) := v0+...+vl-(xl)\nl2(l) := v0+...+vr-2(xl)\nr2(r) := vr+...+vN-1-(C - xr)\nr2(r) := vr+...+vN-1-2(C - xr)\n}\n l := 0;\n L1[l] := vi[l] - xi[l];\n L2[l] := vi[l] - 2 * xi[l];\n L1M[l] := L1[l];\n L2M[l] := L2[l];\n CurSum := vi[l];\n for l := 1 to N - 1 do\n begin\n Inc(CurSum, vi[l]);\n L1[l] := CurSum - xi[l];\n L2[l] := CurSum - 2 * li[l];\n L1M[l] := Max(L1[l], L1M[l - 1]);\n L2M[l] := Max(L2[l], L2M[l - 1]);\n end;\n\n r := N - 1;\n CurSum := vi[r];\n R1[r] := CurSum - (C - xi[r]);\n R2[r] := CurSum - 2 * (C - xi[r]);\n R1M[r] := R1[r];\n R2M[r] := R2[r];\n for r := N - 2 downto 0 do\n begin\n Inc(CurSum, vi[r]);\n R1[r] := CurSum - ri[r];\n R2[r] := CurSum - 2 * ri[r];\n R1M[r] := Max(R1[r], R1M[r + 1]);\n R2M[r] := Max(R2[r], R2M[r + 1]);\n end;\n\n Result := -1;\n for i := 0 to N - 2 do\n begin\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\n\n l := i;\n r := (i + 1);\n\n{ WriteLn('L1:', L1[l], ' L2:', L2[l]); \n WriteLn('R1:', R1[r], ' R2:', R2[r]); \n WriteLn('LM:', L1M[l], ' L2M:', L2M[l]); \n WriteLn('RM:', R1M[r], ' R2M:', R2M[r]); \n}\n\n if Result < L2[l] + R1M[r] then\n Result := L2[l] + R1M[r];\n\n if Result < L1M[l] + R2[r] then\n Result := L1M[l] + R2[r];\n end;\n \n if Result < 0 then\n Result := 0;\nend;\n\nbegin\n ReadData;\n\n WriteLn(Solve);\nend.", "language": "Pascal", "metadata": {"date": 1529917243, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s854113502.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s854113502", "user_id": "u422041582"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "{$mode objfpc}\nprogram D;\nuses\n fgl, math;\n\ntype\n TIntLIst = specialize TFPGList;\n\nvar\n N: Integer;\n C: Int64;\n xi, li, ri, vi: TIntLIst;\n x, v: Int64;\n\nprocedure ReadData;\nvar\n i: Integer;\n CurSum: Int64;\n\nbegin\n ReadLn(N, C);\n\n li := TIntLIst.Create;\n ri := TIntLIst.Create;\n ri.Count := N;\n xi := TIntLIst.Create;\n vi := TIntLIst.Create;\n\n for i := 1 to N do\n begin\n ReadLn(x, v);\n xi.Add(x);\n li.Add(x);\n vi.Add(v);\n end;\n\n ri.Count := N;\n for i := N - 1 downto 0 do\n ri[i] := c - xi[i];\nend;\n\nvar\n L1, L2, R1, R2: TIntList;\n L1M, L2M, R1M, R2M: TIntList;\n\nfunction Solve: Int64;\nvar\n i: Integer;\n l, r: Integer;\n Current: Int64;\n CurSum: Int64;\n\nbegin\n L1 := TIntLIst.Create;\n L2 := TIntLIst.Create;\n R1 := TIntLIst.Create;\n R2 := TIntLIst.Create;\n L1M := TIntLIst.Create;\n L2M := TIntLIst.Create;\n R1M := TIntLIst.Create;\n R2M := TIntLIst.Create;\n L1.Count := N + 1;\n L2.Count := N + 1;\n R1.Count := N + 1;\n R2.Count := N + 1;\n L1M.Count := N + 1;\n L2M.Count := N + 1;\n R1M.Count := N + 1;\n R2M.Count := N + 1;\n\n{\nl1(l) := v0+...+vl-(xl)\nl2(l) := v0+...+vr-2(xl)\nr2(r) := vr+...+vN-1-(C - xr)\nr2(r) := vr+...+vN-1-2(C - xr)\n}\n l := 0;\n L1[l] := vi[l] - xi[l];\n L2[l] := vi[l] - 2 * xi[l];\n L1M[l] := L1[l];\n L2M[l] := L2[l];\n CurSum := vi[l];\n for l := 1 to N - 1 do\n begin\n Inc(CurSum, vi[l]);\n L1[l] := CurSum - xi[l];\n L2[l] := CurSum - 2 * li[l];\n L1M[l] := Max(L1[l], L1M[l - 1]);\n L2M[l] := Max(L2[l], L2M[l - 1]);\n end;\n\n r := N - 1;\n CurSum := vi[r];\n R1[r] := CurSum - (C - xi[r]);\n R2[r] := CurSum - 2 * (C - xi[r]);\n R1M[r] := R1[r];\n R2M[r] := R2[r];\n for r := N - 2 downto 0 do\n begin\n Inc(CurSum, vi[r]);\n R1[r] := CurSum - ri[r];\n R2[r] := CurSum - 2 * ri[r];\n R1M[r] := Max(R1[r], R1M[r + 1]);\n R2M[r] := Max(R2[r], R2M[r + 1]);\n end;\n\n Result := -1;\n for i := 0 to N - 2 do\n begin\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\n\n l := i;\n r := (i + 1);\n\n{ WriteLn('L1:', L1[l], ' L2:', L2[l]); \n WriteLn('R1:', R1[r], ' R2:', R2[r]); \n WriteLn('LM:', L1M[l], ' L2M:', L2M[l]); \n WriteLn('RM:', R1M[r], ' R2M:', R2M[r]); \n}\n\n if Result < L2[l] + R1M[r] then\n Result := L2[l] + R1M[r];\n\n if Result < L1M[l] + R2[r] then\n Result := L1M[l] + R2[r];\n end;\n \n if Result < 0 then\n Result := 0;\nend;\n\nbegin\n ReadData;\n\n WriteLn(Solve);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2464, "cpu_time_ms": 77, "memory_kb": 10568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s417895180", "group_id": "codeNet:p03374", "input_text": "{$mode objfpc}\nprogram D;\nuses\n fgl, math;\n\ntype\n TIntLIst = specialize TFPGList;\n\nvar\n N: Integer;\n C: Int64;\n xi, li, ri, vi, SVi: TIntLIst;\n x, v: Int64;\n\nprocedure ReadData;\nvar\n i: Integer;\n Last: Integer;\n CurSum: Integer;\n\nbegin\n ReadLn(N, C);\n\n li := TIntLIst.Create;\n ri := TIntLIst.Create;\n ri.Count := N;\n xi := TIntLIst.Create;\n vi := TIntLIst.Create;\n SVi := TIntLIst.Create;\n\n CurSum := 0;\n\n for i := 1 to N do\n begin\n ReadLn(x, v);\n xi.Add(x);\n li.Add(x);\n vi.Add(v);\n CurSum := CurSum + v;\n SVi.Add(CurSum);\n end;\n\n ri.Count := N;\n for i := N - 1 downto 0 do\n ri[i] := c - xi[i];\n\n\nend;\n\nvar\n L1, L2, R1, R2: TIntList;\n L1M, L2M, R1M, R2M: TIntList;\n\nfunction Solve: Int64;\nvar\n i: Integer;\n l, r: Integer;\n Current: Int64;\n CurSum: Int64;\n Lefts, Rights: Integer;\n\nbegin\n L1 := TIntLIst.Create;\n L2 := TIntLIst.Create;\n R1 := TIntLIst.Create;\n R2 := TIntLIst.Create;\n L1M := TIntLIst.Create;\n L2M := TIntLIst.Create;\n R1M := TIntLIst.Create;\n R2M := TIntLIst.Create;\n L1.Count := N + 1;\n L2.Count := N + 1;\n R1.Count := N + 1;\n R2.Count := N + 1;\n L1M.Count := N + 1;\n L2M.Count := N + 1;\n R1M.Count := N + 1;\n R2M.Count := N + 1;\n\n{\nl1(l) := v0+...+vl-(xl)\nl2(l) := v0+...+vr-2(xl)\nr2(r) := vr+...+vN-1-(C - xr)\nr2(r) := vr+...+vN-1-2(C - xr)\n}\n l := 0;\n L1[l] := vi[l] - xi[l];\n L2[l] := vi[l] - 2 * xi[l];\n L1M[l] := L1[l];\n L2M[l] := L2[l];\n for l := 1 to N - 1 do\n begin\n L1[l] := SVi[l] - xi[l];\n L2[l] := SVi[l] - 2 * li[l];\n L1M[l] := Max(L1[l], L1M[l - 1]);\n L2M[l] := Max(L2[l], L2M[l - 1]);\n end;\n\n r := N - 1;\n CurSum := vi[r];\n R1[r] := CurSum - (C - xi[r]);\n R2[r] := CurSum - 2 * (C - xi[r]);\n R1M[r] := R1[r];\n R2M[r] := R2[r];\n for r := N - 2 downto 0 do\n begin\n Inc(CurSum, vi[r]);\n R1[r] := CurSum - ri[r];\n R2[r] := CurSum - 2 * ri[r];\n R1M[r] := Max(R1[r], R1M[r + 1]);\n R2M[r] := Max(R2[r], R2M[r + 1]);\n end;\n\n Result := -1;\n for i := 0 to N - 2 do\n begin\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\n\n l := i;\n r := (i + 1);\n\n{ WriteLn('L1:', L1[l], ' L2:', L2[l]); \n WriteLn('R1:', R1[r], ' R2:', R2[r]); \n WriteLn('LM:', L1M[l], ' L2M:', L2M[l]); \n WriteLn('RM:', R1M[r], ' R2M:', R2M[r]); \n}\n\n if Result < L2[l] + R1M[r] then\n Result := L2[l] + R1M[r];\n\n if Result < L1M[l] + R2[r] then\n Result := L1M[l] + R2[r];\n end;\n \nend;\n\nbegin\n ReadData;\n\n WriteLn(Solve);\nend.", "language": "Pascal", "metadata": {"date": 1529916779, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s417895180.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s417895180", "user_id": "u422041582"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "{$mode objfpc}\nprogram D;\nuses\n fgl, math;\n\ntype\n TIntLIst = specialize TFPGList;\n\nvar\n N: Integer;\n C: Int64;\n xi, li, ri, vi, SVi: TIntLIst;\n x, v: Int64;\n\nprocedure ReadData;\nvar\n i: Integer;\n Last: Integer;\n CurSum: Integer;\n\nbegin\n ReadLn(N, C);\n\n li := TIntLIst.Create;\n ri := TIntLIst.Create;\n ri.Count := N;\n xi := TIntLIst.Create;\n vi := TIntLIst.Create;\n SVi := TIntLIst.Create;\n\n CurSum := 0;\n\n for i := 1 to N do\n begin\n ReadLn(x, v);\n xi.Add(x);\n li.Add(x);\n vi.Add(v);\n CurSum := CurSum + v;\n SVi.Add(CurSum);\n end;\n\n ri.Count := N;\n for i := N - 1 downto 0 do\n ri[i] := c - xi[i];\n\n\nend;\n\nvar\n L1, L2, R1, R2: TIntList;\n L1M, L2M, R1M, R2M: TIntList;\n\nfunction Solve: Int64;\nvar\n i: Integer;\n l, r: Integer;\n Current: Int64;\n CurSum: Int64;\n Lefts, Rights: Integer;\n\nbegin\n L1 := TIntLIst.Create;\n L2 := TIntLIst.Create;\n R1 := TIntLIst.Create;\n R2 := TIntLIst.Create;\n L1M := TIntLIst.Create;\n L2M := TIntLIst.Create;\n R1M := TIntLIst.Create;\n R2M := TIntLIst.Create;\n L1.Count := N + 1;\n L2.Count := N + 1;\n R1.Count := N + 1;\n R2.Count := N + 1;\n L1M.Count := N + 1;\n L2M.Count := N + 1;\n R1M.Count := N + 1;\n R2M.Count := N + 1;\n\n{\nl1(l) := v0+...+vl-(xl)\nl2(l) := v0+...+vr-2(xl)\nr2(r) := vr+...+vN-1-(C - xr)\nr2(r) := vr+...+vN-1-2(C - xr)\n}\n l := 0;\n L1[l] := vi[l] - xi[l];\n L2[l] := vi[l] - 2 * xi[l];\n L1M[l] := L1[l];\n L2M[l] := L2[l];\n for l := 1 to N - 1 do\n begin\n L1[l] := SVi[l] - xi[l];\n L2[l] := SVi[l] - 2 * li[l];\n L1M[l] := Max(L1[l], L1M[l - 1]);\n L2M[l] := Max(L2[l], L2M[l - 1]);\n end;\n\n r := N - 1;\n CurSum := vi[r];\n R1[r] := CurSum - (C - xi[r]);\n R2[r] := CurSum - 2 * (C - xi[r]);\n R1M[r] := R1[r];\n R2M[r] := R2[r];\n for r := N - 2 downto 0 do\n begin\n Inc(CurSum, vi[r]);\n R1[r] := CurSum - ri[r];\n R2[r] := CurSum - 2 * ri[r];\n R1M[r] := Max(R1[r], R1M[r + 1]);\n R2M[r] := Max(R2[r], R2M[r + 1]);\n end;\n\n Result := -1;\n for i := 0 to N - 2 do\n begin\n if Result < L1[i] then\n Result := L1[i];\n if Result < R1[i] then\n Result := R1[i];\n\n l := i;\n r := (i + 1);\n\n{ WriteLn('L1:', L1[l], ' L2:', L2[l]); \n WriteLn('R1:', R1[r], ' R2:', R2[r]); \n WriteLn('LM:', L1M[l], ' L2M:', L2M[l]); \n WriteLn('RM:', R1M[r], ' R2M:', R2M[r]); \n}\n\n if Result < L2[l] + R1M[r] then\n Result := L2[l] + R1M[r];\n\n if Result < L1M[l] + R2[r] then\n Result := L1M[l] + R2[r];\n end;\n \nend;\n\nbegin\n ReadData;\n\n WriteLn(Solve);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2524, "cpu_time_ms": 76, "memory_kb": 11600}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s172569755", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then ans:=sum-x[i];\n\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then ans2:=sum-(c-x[i]);\n end;\n if ans2>ans then ans:=ans2;\n ans2:=-maxlongint;\n for i:=1 to n do\n if (num[n]-num[i-1]-(c-x[i])>ans2)and(x[i]>=c div 2) then\n begin\n firstr:=i;\n ans2:=num[n]-num[i]-(c-x[i]);\n end;\n ans2:=-maxlongint;\n for i:=1 to n do\n if (num[i]-x[i]>ans2)and(x[i]0 then\n begin\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end; \n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524364547, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s172569755.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s172569755", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then ans:=sum-x[i];\n\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then ans2:=sum-(c-x[i]);\n end;\n if ans2>ans then ans:=ans2;\n ans2:=-maxlongint;\n for i:=1 to n do\n if (num[n]-num[i-1]-(c-x[i])>ans2)and(x[i]>=c div 2) then\n begin\n firstr:=i;\n ans2:=num[n]-num[i]-(c-x[i]);\n end;\n ans2:=-maxlongint;\n for i:=1 to n do\n if (num[i]-x[i]>ans2)and(x[i]0 then\n begin\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end; \n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1184, "cpu_time_ms": 40, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s466995446", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n ans2:=0;\n for i:=1 to n do\n if (num[n]-num[i-1]-(c-x[i])>ans2)and(x[i]>=c div 2) then\n begin\n firstr:=i;\n ans2:=num[n]-num[i]-(c-x[i]);\n end;\n ans2:=0;\n for i:=1 to n do\n if (num[i]-x[i]>ans2)and(x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524364260, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s466995446.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s466995446", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n ans2:=0;\n for i:=1 to n do\n if (num[n]-num[i-1]-(c-x[i])>ans2)and(x[i]>=c div 2) then\n begin\n firstr:=i;\n ans2:=num[n]-num[i]-(c-x[i]);\n end;\n ans2:=0;\n for i:=1 to n do\n if (num[i]-x[i]>ans2)and(x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1215, "cpu_time_ms": 41, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s094850894", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n ans2:=0;\n for i:=1 to n do\n if (num[n]-num[i-1]-(c-x[i])>ans2)and(x[i]>=c div 2) then\n begin\n firstr:=i;\n ans2:=num[n]-num[i]-(c-x[i]);\n end;\n ans2:=0;\n for i:=1 to n do\n if (num[i]-x[i]>ans2)and(x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]>num[firstl]-x[firstl])and(firstl>1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524364191, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s094850894.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s094850894", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n ans2:=0;\n for i:=1 to n do\n if (num[n]-num[i-1]-(c-x[i])>ans2)and(x[i]>=c div 2) then\n begin\n firstr:=i;\n ans2:=num[n]-num[i]-(c-x[i]);\n end;\n ans2:=0;\n for i:=1 to n do\n if (num[i]-x[i]>ans2)and(x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]>num[firstl]-x[firstl])and(firstl>1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1303, "cpu_time_ms": 40, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s928193653", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]x[firstr]-num[firstr-1])and(firstrans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]>num[firstl]-x[firstl])and(firstl>1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524363693, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s928193653.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s928193653", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]x[firstr]-num[firstr-1])and(firstrans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]>num[firstl]-x[firstl])and(firstl>1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1209, "cpu_time_ms": 41, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s423673885", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]>num[firstl]-x[firstl])and(firstl>1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524363546, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s423673885.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s423673885", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then\n begin\n ans2:=sum-(c-x[i]);\n //writeln(i);\n end;\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]>num[firstl]-x[firstl])and(firstl>1)do dec(firstl);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1209, "cpu_time_ms": 40, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s798173414", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then ans2:=sum-(c-x[i]);\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]1)do inc(firstr);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524362833, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s798173414.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798173414", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then ans2:=sum-(c-x[i]);\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n if firstl>0 then\n begin\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]1)do inc(firstr);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1164, "cpu_time_ms": 40, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s905654652", "group_id": "codeNet:p03374", "input_text": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then ans2:=sum-(c-x[i]);\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]<=c div 2 then\n begin\n while (x[firstr+1]-num[firstr]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]1)do inc(firstr);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1524362656, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03374.html", "problem_id": "p03374", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03374/input.txt", "sample_output_relpath": "derived/input_output/data/p03374/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03374/Pascal/s905654652.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s905654652", "user_id": "u809476955"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "var n,c:int64;\n i:longint;\n sum,ans,ans2:int64;\n firstl,firstr:longint;\n x,v,num:array[0..100500]of int64;\nbegin\n read(n,c);\n for i:=1 to n do\n begin\n read(x[i],v[i]);\n num[i]:=num[i-1]+v[i];\n inc(sum,v[i]);\n if sum-x[i]>ans then\n begin\n ans:=sum-x[i];\n firstl:=i;\n end;\n end;\n sum:=0;\n for i:=n downto 1 do\n begin\n inc(sum,v[i]);\n if sum-(c-x[i])>ans2 then ans2:=sum-(c-x[i]);\n end;\n if ans2>ans then ans:=ans2;\n for i:=1 to n do\n if x[i]>=c div 2 then\n begin\n firstr:=i;\n firstl:=i-1;\n break;\n end;\n for i:=1 to n do\n if x[i]<=c div 2 then\n begin\n while (x[firstr+1]-num[firstr]ans then\n ans:=num[i]+num[n]-num[firstr-1]-2*x[i]+x[firstr]-c;\n end;\n for i:=n downto 1 do\n if x[i]>=c div 2 then\n begin\n while (num[firstl-1]-x[firstl-1]1)do inc(firstr);\n if num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl]>ans then\n ans:=num[n]-num[i-1]+num[firstl]-2*(c-x[i])-x[firstl];\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03374", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1131, "cpu_time_ms": 40, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s918346837", "group_id": "codeNet:p03378", "input_text": "Uses math;\nvar m,x,a,c,i:Longint;\nbegin\n\tread(i,m,x);\n\tfor i:=1 to m do\n\tbegin\n\t\tread(a);\n\t\tif a>x then c:=c+1;\n\tend;\n\twrite(Min(c,m-c))\nend.\n", "language": "Pascal", "metadata": {"date": 1533127132, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03378.html", "problem_id": "p03378", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03378/input.txt", "sample_output_relpath": "derived/input_output/data/p03378/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03378/Pascal/s918346837.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s918346837", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "Uses math;\nvar m,x,a,c,i:Longint;\nbegin\n\tread(i,m,x);\n\tfor i:=1 to m do\n\tbegin\n\t\tread(a);\n\t\tif a>x then c:=c+1;\n\tend;\n\twrite(Min(c,m-c))\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "sample_input": "5 3 3\n1 2 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03378", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s639662727", "group_id": "codeNet:p03401", "input_text": "program aaa;\nvar\n n,i:longint;\n ans:int64;\n a:array[0..100010]of longint;\nbegin\n readln(n);\n a[0]:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n ans:=ans+abs(a[i]-a[i-1]);\n end;\n a[n+1]:=0;\n ans:=ans+abs(a[n]);\n for i:=1 to n do\n writeln(ans+abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i]));\n readln;\n readln;\nend. ", "language": "Pascal", "metadata": {"date": 1522026600, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03401.html", "problem_id": "p03401", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03401/input.txt", "sample_output_relpath": "derived/input_output/data/p03401/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03401/Pascal/s639662727.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s639662727", "user_id": "u516562331"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "program aaa;\nvar\n n,i:longint;\n ans:int64;\n a:array[0..100010]of longint;\nbegin\n readln(n);\n a[0]:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n ans:=ans+abs(a[i]-a[i-1]);\n end;\n a[n+1]:=0;\n ans:=ans+abs(a[n]);\n for i:=1 to n do\n writeln(ans+abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i]));\n readln;\n readln;\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03401", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 341, "cpu_time_ms": 33, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s979015872", "group_id": "codeNet:p03403", "input_text": "var\n\tN,sum,i:Longint;\n\tA:Array[0..100001]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tfor i:=1 to N+1 do begin\n\t\tif A[i]>A[i-1] then inc(sum,A[i]-A[i-1])else inc(sum,A[i-1]-A[i]);\n\tend;\n\tfor i:=1 to N do writeln(sum-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])+abs(A[i-1]-A[i+1]));\nend.\n", "language": "Pascal", "metadata": {"date": 1582186330, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03403.html", "problem_id": "p03403", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03403/input.txt", "sample_output_relpath": "derived/input_output/data/p03403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03403/Pascal/s979015872.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s979015872", "user_id": "u657913472"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "var\n\tN,sum,i:Longint;\n\tA:Array[0..100001]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tfor i:=1 to N+1 do begin\n\t\tif A[i]>A[i-1] then inc(sum,A[i]-A[i-1])else inc(sum,A[i-1]-A[i]);\n\tend;\n\tfor i:=1 to N do writeln(sum-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])+abs(A[i-1]-A[i+1]));\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03403", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 290, "cpu_time_ms": 33, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s459873982", "group_id": "codeNet:p03403", "input_text": "const MAXN = 100000;\nvar n: longint;\n a, f, g: array[0..MAXN] of longint;\n\nprocedure Nhap;\nvar i: longint;\nbegin\n readln(n);\n for i:= 1 to n do read(a[i]);\nend;\n\nprocedure QT;\nvar i: longint;\nbegin\n f[0]:= 0;\n g[n+1]:= 0; ///Phan tu dung canh\n for i:= 1 to n do f[i]:= f[i-1] + abs(a[i] - a[i-1]);\n for i:= n downto 1 do\n g[i]:= g[i+1] + abs(a[i+1] - a[i]);\n for i:= 1 to n do\n writeln(f[i-1] + g[i+1] + abs(a[i+1]-a[i-1]));\nend;\n\nBEGIN\n Nhap;\n QT;\nEND.\n", "language": "Pascal", "metadata": {"date": 1545447827, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03403.html", "problem_id": "p03403", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03403/input.txt", "sample_output_relpath": "derived/input_output/data/p03403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03403/Pascal/s459873982.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s459873982", "user_id": "u089230684"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "const MAXN = 100000;\nvar n: longint;\n a, f, g: array[0..MAXN] of longint;\n\nprocedure Nhap;\nvar i: longint;\nbegin\n readln(n);\n for i:= 1 to n do read(a[i]);\nend;\n\nprocedure QT;\nvar i: longint;\nbegin\n f[0]:= 0;\n g[n+1]:= 0; ///Phan tu dung canh\n for i:= 1 to n do f[i]:= f[i-1] + abs(a[i] - a[i-1]);\n for i:= n downto 1 do\n g[i]:= g[i+1] + abs(a[i+1] - a[i]);\n for i:= 1 to n do\n writeln(f[i-1] + g[i+1] + abs(a[i+1]-a[i-1]));\nend;\n\nBEGIN\n Nhap;\n QT;\nEND.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03403", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 554, "cpu_time_ms": 34, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s264468164", "group_id": "codeNet:p03403", "input_text": "var\nn,i,s:longint;\na:array[0..100010] of longint;\nbegin\nreadln(n);\nfor i:=1 to n do read(a[i]);\na[0]:=0; a[n+1]:=0;\ns:=0;\nfor i:=1 to n+1 do s:=s+abs(a[i]-a[i-1]);\nfor i:=1 to n do writeln(s-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]));\nend.", "language": "Pascal", "metadata": {"date": 1531262057, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03403.html", "problem_id": "p03403", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03403/input.txt", "sample_output_relpath": "derived/input_output/data/p03403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03403/Pascal/s264468164.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s264468164", "user_id": "u957998623"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "var\nn,i,s:longint;\na:array[0..100010] of longint;\nbegin\nreadln(n);\nfor i:=1 to n do read(a[i]);\na[0]:=0; a[n+1]:=0;\ns:=0;\nfor i:=1 to n+1 do s:=s+abs(a[i]-a[i-1]);\nfor i:=1 to n do writeln(s-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03403", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 250, "cpu_time_ms": 33, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s509554945", "group_id": "codeNet:p03403", "input_text": "var now,ans,ansx:longint;\n x,a:array[0..150000]of longint;\n n:longint;\n i:longint;\nbegin\n read(n);\n now:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n x[i]:=now;\n ans:=ans+abs(now-a[i]);\n now:=a[i];\n end;\n a[n+1]:=0;\n x[n+1]:=now;\n ans:=ans+abs(now-a[i+1]);\n for i:=1 to n do\n begin\n ansx:=ans-abs(x[i]-a[i])-abs(x[i+1]-a[i+1])+abs(x[i]-a[i+1]);\n writeln(ansx);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1522026626, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03403.html", "problem_id": "p03403", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03403/input.txt", "sample_output_relpath": "derived/input_output/data/p03403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03403/Pascal/s509554945.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s509554945", "user_id": "u809476955"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "var now,ans,ansx:longint;\n x,a:array[0..150000]of longint;\n n:longint;\n i:longint;\nbegin\n read(n);\n now:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n x[i]:=now;\n ans:=ans+abs(now-a[i]);\n now:=a[i];\n end;\n a[n+1]:=0;\n x[n+1]:=now;\n ans:=ans+abs(now-a[i+1]);\n for i:=1 to n do\n begin\n ansx:=ans-abs(x[i]-a[i])-abs(x[i+1]-a[i+1])+abs(x[i]-a[i+1]);\n writeln(ansx);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03403", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 410, "cpu_time_ms": 33, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s884478586", "group_id": "codeNet:p03404", "input_text": "var a,b,t:longint;\n num,bool,y,where:longint;\n i,j:longint;\n map:Array[0..105,0..105]of longint;\n c1,c2:char;\nbegin\n read(a,b);\n c1:='.';\n c2:='#';\n if a>b then\n begin\n t:=a;a:=b;b:=t;\n c1:='#';\n c2:='.';\n end;\n b:=b-a;\n if a=1 then dec(b);\n num:=1;\n bool:=0;\n while a>0 do\n begin\n inc(num);\n bool:=1-bool;\n for i:=1 to num-1 do\n begin\n map[i,num-i]:=bool;\n if bool=1 then dec(a);\n if a=0 then\n begin\n dec(b);\n break;\n end;\n end;\n if bool=1 then inc(b);\n end;\n for j:=1 to num-1 do\n begin\n map[num,j]:=0;\n map[num+1,j]:=1;\n end;\n inc(num);\n y:=num;\n for i:=1 to num do\n map[i,num-1]:=1;\n if b<>0 then\n begin\n while num<100 do\n begin\n inc(num);\n if num mod 2=1 then\n begin\n for j:=1 to y-1 do\n map[num,j]:=1;\n end else\n begin\n for j:=1 to y-1 do\n begin\n if (j mod 2=0) then map[num,j]:=1 else dec(b);\n if b=0 then\n begin\n where:=j;\n break;\n end;\n end;\n end;\n if b=0 then\n begin\n for j:=where+1 to y-1 do\n map[num,j]:=1;\n break;\n end;\n end;\n end;\n dec(y);\n while b>0 do\n begin\n inc(y);\n for i:=1 to num do\n begin\n if i mod 2=0 then map[i,y]:=1 else dec(b);\n if b=0 then\n begin\n where:=i;\n break;\n end;\n end;\n inc(y);\n for i:=1 to num do\n map[i,y]:=1;\n if b=0 then\n begin\n for i:=where+1 to num do\n map[i,y-1]:=1;\n end;\n end;\n writeln(num,' ',y);\n for i:=1 to num do\n begin\n for j:=1 to y do\n if map[i,j]=1 then write(c1) else write(c2);\n writeln;\n end;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1522033118, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03404.html", "problem_id": "p03404", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03404/input.txt", "sample_output_relpath": "derived/input_output/data/p03404/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03404/Pascal/s884478586.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s884478586", "user_id": "u809476955"}, "prompt_components": {"gold_output": "3 3\n##.\n..#\n#.#\n", "input_to_evaluate": "var a,b,t:longint;\n num,bool,y,where:longint;\n i,j:longint;\n map:Array[0..105,0..105]of longint;\n c1,c2:char;\nbegin\n read(a,b);\n c1:='.';\n c2:='#';\n if a>b then\n begin\n t:=a;a:=b;b:=t;\n c1:='#';\n c2:='.';\n end;\n b:=b-a;\n if a=1 then dec(b);\n num:=1;\n bool:=0;\n while a>0 do\n begin\n inc(num);\n bool:=1-bool;\n for i:=1 to num-1 do\n begin\n map[i,num-i]:=bool;\n if bool=1 then dec(a);\n if a=0 then\n begin\n dec(b);\n break;\n end;\n end;\n if bool=1 then inc(b);\n end;\n for j:=1 to num-1 do\n begin\n map[num,j]:=0;\n map[num+1,j]:=1;\n end;\n inc(num);\n y:=num;\n for i:=1 to num do\n map[i,num-1]:=1;\n if b<>0 then\n begin\n while num<100 do\n begin\n inc(num);\n if num mod 2=1 then\n begin\n for j:=1 to y-1 do\n map[num,j]:=1;\n end else\n begin\n for j:=1 to y-1 do\n begin\n if (j mod 2=0) then map[num,j]:=1 else dec(b);\n if b=0 then\n begin\n where:=j;\n break;\n end;\n end;\n end;\n if b=0 then\n begin\n for j:=where+1 to y-1 do\n map[num,j]:=1;\n break;\n end;\n end;\n end;\n dec(y);\n while b>0 do\n begin\n inc(y);\n for i:=1 to num do\n begin\n if i mod 2=0 then map[i,y]:=1 else dec(b);\n if b=0 then\n begin\n where:=i;\n break;\n end;\n end;\n inc(y);\n for i:=1 to num do\n map[i,y]:=1;\n if b=0 then\n begin\n for i:=where+1 to num do\n map[i,y-1]:=1;\n end;\n end;\n writeln(num,' ',y);\n for i:=1 to num do\n begin\n for j:=1 to y do\n if map[i,j]=1 then write(c1) else write(c2);\n writeln;\n end;\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "sample_input": "2 3\n"}, "reference_outputs": ["3 3\n##.\n..#\n#.#\n"], "source_document_id": "p03404", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1723, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s657498326", "group_id": "codeNet:p03408", "input_text": "var n,m,s,t,i,j:Longint;a,b:array of string;\nbegin\n\treadln(n);\n\tsetlength(a,n+1);\n\tfor i:=1 to n do begin\n\t\treadln(a[i]);\n\tend;\n\treadln(m);\n\tSetLength(b,m+1);\n\tfor i:=1 to m do begin\n\t\treadln(b[i]);\n\tend;\n\ts:=0;\n\tfor i:=1 to n do begin\n\t\tt:=0;\n\t\tfor j:=1 to n do begin\n\t\t\tif a[i]=a[j] then t:=t+1;\n\t\tend;\n\t\tfor j:=1 to m do begin\n\t\t\tif a[i]=b[j] then t:=t-1;\n\t\tend;\n\t\tif s>1];\n repeat\n while c[i]m do dec(j);\n if i<=j then\n begin\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l>1;\n if c[m]0 do begin\n\t\t\tT:=A div K+1;\n\t\t\tdec(A,(A mod K+T-1)div T*T);\n\t\tend;\n\t\tS:=S xor A;\n\tend;\n\tif S<>0 then writeln('Takahashi')else writeln('Aoki');\nend.", "problem_context": "Score : 900 points\n\nProblem Statement\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.\n\nStarting from Takahashi, Takahashi and Aoki take alternate turns to perform the following operation:\n\nChoose a pile. If the i-th pile is selected and there are X stones left in the pile, remove some number of stones between 1 and floor(X/K_i) (inclusive) from the pile.\n\nThe player who first becomes unable to perform the operation loses the game. Assuming that both players play optimally, determine the winner of the game.\nHere, floor(x) represents the largest integer not greater than x.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i,K_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 K_1\n:\nA_N K_N\n\nOutput\n\nIf Takahashi will win, print Takahashi; if Aoki will win, print Aoki.\n\nSample Input 1\n\n2\n5 2\n3 3\n\nSample Output 1\n\nAoki\n\nInitially, from the first pile at most floor(5/2)=2 stones can be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nIf Takahashi first takes two stones from the first pile, from the first pile at most floor(3/2)=1 stone can now be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nThen, if Aoki takes one stone from the second pile, from the first pile at most floor(3/2)=1 stone can be removed at a time, and from the second pile no more stones can be removed (since floor(2/3)=0).\n\nThen, if Takahashi takes one stone from the first pile, from the first pile at most floor(2/2)=1 stone can now be removed at a time, and from the second pile no more stones can be removed.\n\nThen, if Aoki takes one stone from the first pile, from the first pile at most floor(1/2)=0 stones can now be removed at a time, and from the second pile no more stones can be removed.\n\nNo more operation can be performed, thus Aoki wins. If Takahashi plays differently, Aoki can also win by play accordingly.\n\nSample Input 2\n\n3\n3 2\n4 3\n5 1\n\nSample Output 2\n\nTakahashi\n\nSample Input 3\n\n3\n28 3\n16 4\n19 2\n\nSample Output 3\n\nAoki\n\nSample Input 4\n\n4\n3141 59\n26535 897\n93 23\n8462 64\n\nSample Output 4\n\nTakahashi", "sample_input": "2\n5 2\n3 3\n"}, "reference_outputs": ["Aoki\n"], "source_document_id": "p03422", "source_text": "Score : 900 points\n\nProblem Statement\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.\n\nStarting from Takahashi, Takahashi and Aoki take alternate turns to perform the following operation:\n\nChoose a pile. If the i-th pile is selected and there are X stones left in the pile, remove some number of stones between 1 and floor(X/K_i) (inclusive) from the pile.\n\nThe player who first becomes unable to perform the operation loses the game. Assuming that both players play optimally, determine the winner of the game.\nHere, floor(x) represents the largest integer not greater than x.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i,K_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 K_1\n:\nA_N K_N\n\nOutput\n\nIf Takahashi will win, print Takahashi; if Aoki will win, print Aoki.\n\nSample Input 1\n\n2\n5 2\n3 3\n\nSample Output 1\n\nAoki\n\nInitially, from the first pile at most floor(5/2)=2 stones can be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nIf Takahashi first takes two stones from the first pile, from the first pile at most floor(3/2)=1 stone can now be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nThen, if Aoki takes one stone from the second pile, from the first pile at most floor(3/2)=1 stone can be removed at a time, and from the second pile no more stones can be removed (since floor(2/3)=0).\n\nThen, if Takahashi takes one stone from the first pile, from the first pile at most floor(2/2)=1 stone can now be removed at a time, and from the second pile no more stones can be removed.\n\nThen, if Aoki takes one stone from the first pile, from the first pile at most floor(1/2)=0 stones can now be removed at a time, and from the second pile no more stones can be removed.\n\nNo more operation can be performed, thus Aoki wins. If Takahashi plays differently, Aoki can also win by play accordingly.\n\nSample Input 2\n\n3\n3 2\n4 3\n5 1\n\nSample Output 2\n\nTakahashi\n\nSample Input 3\n\n3\n28 3\n16 4\n19 2\n\nSample Output 3\n\nAoki\n\nSample Input 4\n\n4\n3141 59\n26535 897\n93 23\n8462 64\n\nSample Output 4\n\nTakahashi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 91, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s715311646", "group_id": "codeNet:p03425", "input_text": "var\n\ts:String;\n\tcnt:Array[1..5]of int64;\n\tans:int64;\n\ti,n:Longint;\nbegin\n\treadln(n);\n\tfor i:=1 to n do begin\n\t\treadln(s);\n\t\tif s[1]='M' then inc(cnt[1])\n\t\telse if s[1]='A' then inc(cnt[2])\n\t\telse if s[1]='R' then inc(cnt[3])\n\t\telse if s[1]='C' then inc(cnt[4])\n\t\telse if s[1]='H' then inc(cnt[5]);\n\tend;\n\twriteln(cnt[1]*cnt[2]*(cnt[3]+cnt[4]+cnt[5])+cnt[1]*cnt[3]*(cnt[4]+cnt[5])+\n\t\tcnt[1]*cnt[4]*cnt[5]+cnt[2]*cnt[3]*(cnt[4]+cnt[5])+cnt[2]*cnt[4]*cnt[5]+\n\t\tcnt[3]*cnt[4]*cnt[5]);\nend.\n", "language": "Pascal", "metadata": {"date": 1581753169, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03425.html", "problem_id": "p03425", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03425/input.txt", "sample_output_relpath": "derived/input_output/data/p03425/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03425/Pascal/s715311646.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s715311646", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ts:String;\n\tcnt:Array[1..5]of int64;\n\tans:int64;\n\ti,n:Longint;\nbegin\n\treadln(n);\n\tfor i:=1 to n do begin\n\t\treadln(s);\n\t\tif s[1]='M' then inc(cnt[1])\n\t\telse if s[1]='A' then inc(cnt[2])\n\t\telse if s[1]='R' then inc(cnt[3])\n\t\telse if s[1]='C' then inc(cnt[4])\n\t\telse if s[1]='H' then inc(cnt[5]);\n\tend;\n\twriteln(cnt[1]*cnt[2]*(cnt[3]+cnt[4]+cnt[5])+cnt[1]*cnt[3]*(cnt[4]+cnt[5])+\n\t\tcnt[1]*cnt[4]*cnt[5]+cnt[2]*cnt[3]*(cnt[4]+cnt[5])+cnt[2]*cnt[4]*cnt[5]+\n\t\tcnt[3]*cnt[4]*cnt[5]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\nThe name of every chosen person begins with M, A, R, C or H.\n\nThere are no multiple people whose names begin with the same letter.\n\nHow many such ways are there to choose three people, disregarding order?\n\nNote that the answer may not fit into a 32-bit integer type.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i consists of uppercase English letters.\n\n1 \\leq |S_i| \\leq 10\n\nS_i \\neq S_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf there are x ways to choose three people so that the given conditions are met, print x.\n\nSample Input 1\n\n5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n\nSample Output 1\n\n2\n\nWe can choose three people with the following names:\n\nMASHIKE, RUMOI, HABORO\n\nMASHIKE, RUMOI, HOROKANAI\n\nThus, we have two ways.\n\nSample Input 2\n\n4\nZZ\nZZZ\nZ\nZZZZZZZZZZ\n\nSample Output 2\n\n0\n\nNote that there may be no ways to choose three people so that the given conditions are met.\n\nSample Input 3\n\n5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO\n\nSample Output 3\n\n7", "sample_input": "5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03425", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\nThe name of every chosen person begins with M, A, R, C or H.\n\nThere are no multiple people whose names begin with the same letter.\n\nHow many such ways are there to choose three people, disregarding order?\n\nNote that the answer may not fit into a 32-bit integer type.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i consists of uppercase English letters.\n\n1 \\leq |S_i| \\leq 10\n\nS_i \\neq S_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf there are x ways to choose three people so that the given conditions are met, print x.\n\nSample Input 1\n\n5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n\nSample Output 1\n\n2\n\nWe can choose three people with the following names:\n\nMASHIKE, RUMOI, HABORO\n\nMASHIKE, RUMOI, HOROKANAI\n\nThus, we have two ways.\n\nSample Input 2\n\n4\nZZ\nZZZ\nZ\nZZZZZZZZZZ\n\nSample Output 2\n\n0\n\nNote that there may be no ways to choose three people so that the given conditions are met.\n\nSample Input 3\n\n5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO\n\nSample Output 3\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 486, "cpu_time_ms": 14, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s074745180", "group_id": "codeNet:p03425", "input_text": "var\n n,cnt_m,cnt_a,cnt_r,cnt_c,cnt_h,ans,i: Longint;\n s: String;\nbegin\n readln(n);\n for i := 1 to n do\n begin\n readln(s);\n if s[1]='M' then \n begin\n inc(cnt_m);\n end\n else if s[1]='A' then \n begin\n inc(cnt_a);\n end\n else if s[1]='R' then \n begin\n inc(cnt_r);\n end\n else if s[1]='C' then \n begin\n inc(cnt_c);\n end\n else if s[1]='H' then \n begin\n inc(cnt_h);\n end;\n end;\n ans:=cnt_m*cnt_a*(cnt_r+cnt_c+cnt_h)+cnt_m*cnt_r*(cnt_c+cnt_h)+\n cnt_m*cnt_c*cnt_h+cnt_a*cnt_r*(cnt_c+cnt_h)+cnt_a*cnt_c*cnt_h+\n cnt_r*cnt_c*cnt_h;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1520216673, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03425.html", "problem_id": "p03425", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03425/input.txt", "sample_output_relpath": "derived/input_output/data/p03425/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03425/Pascal/s074745180.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s074745180", "user_id": "u403323882"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,cnt_m,cnt_a,cnt_r,cnt_c,cnt_h,ans,i: Longint;\n s: String;\nbegin\n readln(n);\n for i := 1 to n do\n begin\n readln(s);\n if s[1]='M' then \n begin\n inc(cnt_m);\n end\n else if s[1]='A' then \n begin\n inc(cnt_a);\n end\n else if s[1]='R' then \n begin\n inc(cnt_r);\n end\n else if s[1]='C' then \n begin\n inc(cnt_c);\n end\n else if s[1]='H' then \n begin\n inc(cnt_h);\n end;\n end;\n ans:=cnt_m*cnt_a*(cnt_r+cnt_c+cnt_h)+cnt_m*cnt_r*(cnt_c+cnt_h)+\n cnt_m*cnt_c*cnt_h+cnt_a*cnt_r*(cnt_c+cnt_h)+cnt_a*cnt_c*cnt_h+\n cnt_r*cnt_c*cnt_h;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\nThe name of every chosen person begins with M, A, R, C or H.\n\nThere are no multiple people whose names begin with the same letter.\n\nHow many such ways are there to choose three people, disregarding order?\n\nNote that the answer may not fit into a 32-bit integer type.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i consists of uppercase English letters.\n\n1 \\leq |S_i| \\leq 10\n\nS_i \\neq S_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf there are x ways to choose three people so that the given conditions are met, print x.\n\nSample Input 1\n\n5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n\nSample Output 1\n\n2\n\nWe can choose three people with the following names:\n\nMASHIKE, RUMOI, HABORO\n\nMASHIKE, RUMOI, HOROKANAI\n\nThus, we have two ways.\n\nSample Input 2\n\n4\nZZ\nZZZ\nZ\nZZZZZZZZZZ\n\nSample Output 2\n\n0\n\nNote that there may be no ways to choose three people so that the given conditions are met.\n\nSample Input 3\n\n5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO\n\nSample Output 3\n\n7", "sample_input": "5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03425", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\nThe name of every chosen person begins with M, A, R, C or H.\n\nThere are no multiple people whose names begin with the same letter.\n\nHow many such ways are there to choose three people, disregarding order?\n\nNote that the answer may not fit into a 32-bit integer type.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i consists of uppercase English letters.\n\n1 \\leq |S_i| \\leq 10\n\nS_i \\neq S_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf there are x ways to choose three people so that the given conditions are met, print x.\n\nSample Input 1\n\n5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n\nSample Output 1\n\n2\n\nWe can choose three people with the following names:\n\nMASHIKE, RUMOI, HABORO\n\nMASHIKE, RUMOI, HOROKANAI\n\nThus, we have two ways.\n\nSample Input 2\n\n4\nZZ\nZZZ\nZ\nZZZZZZZZZZ\n\nSample Output 2\n\n0\n\nNote that there may be no ways to choose three people so that the given conditions are met.\n\nSample Input 3\n\n5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO\n\nSample Output 3\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 734, "cpu_time_ms": 14, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s725200600", "group_id": "codeNet:p03426", "input_text": "var\n h,w,d,q,i,j,k,tmp,ans_cnt: Longint;\n a:array[1..300,1..300] of Longint;\n index:array[1..90000,1..2] of Longint;\n l,r: Longint;\n ans:array[1..100000,1..3] of Longint;\n flag:Boolean;\nbegin\n readln(h,w,d);\n for i := 1 to h do\n begin\n for j := 1 to w do\n begin\n read(a[i][j]);\n index[a[i][j]][1]:=i;\n index[a[i][j]][2]:=j;\n end;\n end;\n read(q);\n for i := 1 to q do\n begin\n readln(l,r);\n flag:=false;\n for j := 1 to ans_cnt do\n begin\n if (ans[j][1]=l) and (ans[j][2]=r) then\n begin\n writeln(ans[j][3]);\n flag:=true;\n break;\n end;\n end;\n if flag then\n begin\n continue;\n end;\n tmp:=0;\n k:=l;\n while k<>r do\n begin\n j:=k;\n inc(k,d);\n inc(tmp,abs(index[k][1]-index[j][1])+abs(index[k][2]-index[j][2]));\n end;\n inc(ans_cnt);\n ans[ans_cnt][1]:=l;\n ans[ans_cnt][2]:=r;\n ans[ans_cnt][3]:=tmp;\n writeln(tmp);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1520219099, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03426.html", "problem_id": "p03426", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03426/input.txt", "sample_output_relpath": "derived/input_output/data/p03426/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03426/Pascal/s725200600.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s725200600", "user_id": "u403323882"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n h,w,d,q,i,j,k,tmp,ans_cnt: Longint;\n a:array[1..300,1..300] of Longint;\n index:array[1..90000,1..2] of Longint;\n l,r: Longint;\n ans:array[1..100000,1..3] of Longint;\n flag:Boolean;\nbegin\n readln(h,w,d);\n for i := 1 to h do\n begin\n for j := 1 to w do\n begin\n read(a[i][j]);\n index[a[i][j]][1]:=i;\n index[a[i][j]][2]:=j;\n end;\n end;\n read(q);\n for i := 1 to q do\n begin\n readln(l,r);\n flag:=false;\n for j := 1 to ans_cnt do\n begin\n if (ans[j][1]=l) and (ans[j][2]=r) then\n begin\n writeln(ans[j][3]);\n flag:=true;\n break;\n end;\n end;\n if flag then\n begin\n continue;\n end;\n tmp:=0;\n k:=l;\n while k<>r do\n begin\n j:=k;\n inc(k,d);\n inc(tmp,abs(index[k][1]-index[j][1])+abs(index[k][2]-index[j][2]));\n end;\n inc(ans_cnt);\n ans[ans_cnt][1]:=l;\n ans[ans_cnt][2]:=r;\n ans[ans_cnt][3]:=tmp;\n writeln(tmp);\n end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).\n\nThe integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}.\n\nYou, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by consuming |x-i|+|y-j| magic points.\n\nYou now have to take Q practical tests of your ability as a magical girl.\n\nThe i-th test will be conducted as follows:\n\nInitially, a piece is placed on the square where the integer L_i is written.\n\nLet x be the integer written in the square occupied by the piece. Repeatedly move the piece to the square where the integer x+D is written, as long as x is not R_i. The test ends when x=R_i.\n\nHere, it is guaranteed that R_i-L_i is a multiple of D.\n\nFor each test, find the sum of magic points consumed during that test.\n\nConstraints\n\n1 \\leq H,W \\leq 300\n\n1 \\leq D \\leq H×W\n\n1 \\leq A_{i,j} \\leq H×W\n\nA_{i,j} \\neq A_{x,y} ((i,j) \\neq (x,y))\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq H×W\n\n(R_i-L_i) is a multiple of D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W D\nA_{1,1} A_{1,2} ... A_{1,W}\n:\nA_{H,1} A_{H,2} ... A_{H,W}\nQ\nL_1 R_1\n:\nL_Q R_Q\n\nOutput\n\nFor each test, print the sum of magic points consumed during that test.\n\nOutput should be in the order the tests are conducted.\n\nSample Input 1\n\n3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8\n\nSample Output 1\n\n5\n\n4 is written in Square (1,2).\n\n6 is written in Square (3,3).\n\n8 is written in Square (3,1).\n\nThus, the sum of magic points consumed during the first test is (|3-1|+|3-2|)+(|3-3|+|1-3|)=5.\n\nSample Input 2\n\n4 2 3\n3 7\n1 4\n5 2\n6 8\n2\n2 2\n2 2\n\nSample Output 2\n\n0\n0\n\nNote that there may be a test where the piece is not moved at all, and there may be multiple identical tests.\n\nSample Input 3\n\n5 5 4\n13 25 7 15 17\n16 22 20 2 9\n14 11 12 1 19\n10 6 23 8 18\n3 21 5 24 4\n3\n13 13\n2 10\n13 13\n\nSample Output 3\n\n0\n5\n0", "sample_input": "3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03426", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).\n\nThe integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}.\n\nYou, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by consuming |x-i|+|y-j| magic points.\n\nYou now have to take Q practical tests of your ability as a magical girl.\n\nThe i-th test will be conducted as follows:\n\nInitially, a piece is placed on the square where the integer L_i is written.\n\nLet x be the integer written in the square occupied by the piece. Repeatedly move the piece to the square where the integer x+D is written, as long as x is not R_i. The test ends when x=R_i.\n\nHere, it is guaranteed that R_i-L_i is a multiple of D.\n\nFor each test, find the sum of magic points consumed during that test.\n\nConstraints\n\n1 \\leq H,W \\leq 300\n\n1 \\leq D \\leq H×W\n\n1 \\leq A_{i,j} \\leq H×W\n\nA_{i,j} \\neq A_{x,y} ((i,j) \\neq (x,y))\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq H×W\n\n(R_i-L_i) is a multiple of D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W D\nA_{1,1} A_{1,2} ... A_{1,W}\n:\nA_{H,1} A_{H,2} ... A_{H,W}\nQ\nL_1 R_1\n:\nL_Q R_Q\n\nOutput\n\nFor each test, print the sum of magic points consumed during that test.\n\nOutput should be in the order the tests are conducted.\n\nSample Input 1\n\n3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8\n\nSample Output 1\n\n5\n\n4 is written in Square (1,2).\n\n6 is written in Square (3,3).\n\n8 is written in Square (3,1).\n\nThus, the sum of magic points consumed during the first test is (|3-1|+|3-2|)+(|3-3|+|1-3|)=5.\n\nSample Input 2\n\n4 2 3\n3 7\n1 4\n5 2\n6 8\n2\n2 2\n2 2\n\nSample Output 2\n\n0\n0\n\nNote that there may be a test where the piece is not moved at all, and there may be multiple identical tests.\n\nSample Input 3\n\n5 5 4\n13 25 7 15 17\n16 22 20 2 9\n14 11 12 1 19\n10 6 23 8 18\n3 21 5 24 4\n3\n13 13\n2 10\n13 13\n\nSample Output 3\n\n0\n5\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1154, "cpu_time_ms": 2103, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s328138893", "group_id": "codeNet:p03431", "input_text": "var\nn,k,z,c,p:int64; i:longint;\nfunction pw(x,y:int64):int64;\nvar re:int64;\nbegin\n re:=1;\n\twhile y>0 do\n\tbegin\n\t\tif (y and 1=1) then begin re:=(re*x) mod p; end;\n\t\tx:=x*x mod p;\n\t\ty:=y div 2;\n\tend;\n\tpw:=re;\nend;\nbegin\n\tn:=1; k:=1; z:=1; c:=1;\n\tp:=998244353;\n\treadln(k,n);\n\tz:=pw(2,n-1);\n\tfor i:= 0 to k-1 do\n\tbegin\n\t\tif ((k-i) mod 2=0) then\n\t\tbegin\n\t\t\tz:= (z+p-c) mod p;\n\t\tend;\n\t\tc:=((c*(n-i))mod p)*(pw(i+1,p-2) mod p);\n\tend;\t\n\twriteln(z);\nend.", "language": "Pascal", "metadata": {"date": 1530839124, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03431.html", "problem_id": "p03431", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03431/input.txt", "sample_output_relpath": "derived/input_output/data/p03431/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03431/Pascal/s328138893.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s328138893", "user_id": "u565485475"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var\nn,k,z,c,p:int64; i:longint;\nfunction pw(x,y:int64):int64;\nvar re:int64;\nbegin\n re:=1;\n\twhile y>0 do\n\tbegin\n\t\tif (y and 1=1) then begin re:=(re*x) mod p; end;\n\t\tx:=x*x mod p;\n\t\ty:=y div 2;\n\tend;\n\tpw:=re;\nend;\nbegin\n\tn:=1; k:=1; z:=1; c:=1;\n\tp:=998244353;\n\treadln(k,n);\n\tz:=pw(2,n-1);\n\tfor i:= 0 to k-1 do\n\tbegin\n\t\tif ((k-i) mod 2=0) then\n\t\tbegin\n\t\t\tz:= (z+p-c) mod p;\n\t\tend;\n\t\tc:=((c*(n-i))mod p)*(pw(i+1,p-2) mod p);\n\tend;\t\n\twriteln(z);\nend.", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nIn Republic of AtCoder, Snuke Chameleons (Family: Chamaeleonidae, Genus: Bartaberia) are very popular pets.\nRingo keeps N Snuke Chameleons in a cage.\n\nA Snuke Chameleon that has not eaten anything is blue. It changes its color according to the following rules:\n\nA Snuke Chameleon that is blue will change its color to red when the number of red balls it has eaten becomes strictly larger than the number of blue balls it has eaten.\n\nA Snuke Chameleon that is red will change its color to blue when the number of blue balls it has eaten becomes strictly larger than the number of red balls it has eaten.\n\nInitially, every Snuke Chameleon had not eaten anything. Ringo fed them by repeating the following process K times:\n\nGrab either a red ball or a blue ball.\n\nThrow that ball into the cage. Then, one of the chameleons eats it.\n\nAfter Ringo threw in K balls, all the chameleons were red. We are interested in the possible ways Ringo could have thrown in K balls. How many such ways are there? Find the count modulo 998244353. Here, two ways to throw in balls are considered different when there exists i such that the color of the ball that are thrown in the i-th throw is different.\n\nConstraints\n\n1 \\leq N,K \\leq 5 \\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the possible ways Ringo could have thrown in K balls, modulo 998244353.\n\nSample Input 1\n\n2 4\n\nSample Output 1\n\n7\n\nWe will use R to represent a red ball, and B to represent a blue ball. There are seven ways to throw in balls that satisfy the condition: BRRR, RBRB, RBRR, RRBB, RRBR, RRRB and RRRR.\n\nSample Input 2\n\n3 7\n\nSample Output 2\n\n57\n\nSample Input 3\n\n8 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n8 10\n\nSample Output 4\n\n46\n\nSample Input 5\n\n123456 234567\n\nSample Output 5\n\n857617983", "sample_input": "2 4\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03431", "source_text": "Score : 1200 points\n\nProblem Statement\n\nIn Republic of AtCoder, Snuke Chameleons (Family: Chamaeleonidae, Genus: Bartaberia) are very popular pets.\nRingo keeps N Snuke Chameleons in a cage.\n\nA Snuke Chameleon that has not eaten anything is blue. It changes its color according to the following rules:\n\nA Snuke Chameleon that is blue will change its color to red when the number of red balls it has eaten becomes strictly larger than the number of blue balls it has eaten.\n\nA Snuke Chameleon that is red will change its color to blue when the number of blue balls it has eaten becomes strictly larger than the number of red balls it has eaten.\n\nInitially, every Snuke Chameleon had not eaten anything. Ringo fed them by repeating the following process K times:\n\nGrab either a red ball or a blue ball.\n\nThrow that ball into the cage. Then, one of the chameleons eats it.\n\nAfter Ringo threw in K balls, all the chameleons were red. We are interested in the possible ways Ringo could have thrown in K balls. How many such ways are there? Find the count modulo 998244353. Here, two ways to throw in balls are considered different when there exists i such that the color of the ball that are thrown in the i-th throw is different.\n\nConstraints\n\n1 \\leq N,K \\leq 5 \\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the possible ways Ringo could have thrown in K balls, modulo 998244353.\n\nSample Input 1\n\n2 4\n\nSample Output 1\n\n7\n\nWe will use R to represent a red ball, and B to represent a blue ball. There are seven ways to throw in balls that satisfy the condition: BRRR, RBRB, RBRR, RRBB, RRBR, RRRB and RRRR.\n\nSample Input 2\n\n3 7\n\nSample Output 2\n\n57\n\nSample Input 3\n\n8 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n8 10\n\nSample Output 4\n\n46\n\nSample Input 5\n\n123456 234567\n\nSample Output 5\n\n857617983", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 449, "cpu_time_ms": 325, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s735110502", "group_id": "codeNet:p03434", "input_text": "var\n n,i,x,y: Integer;\n a: array[0..100] of Integer;\n \nprocedure qsort(l,r:Longint;data:PInteger);\n//array index start at 0\nvar\n i,j,mid: Integer;\nbegin\n if l>=r then\n begin\n exit;\n end;\n i:=l;\n j:=r;\n mid:=data[(l+r) div 2];\n repeat\n while data[i]mid do\n begin\n dec(j);\n end;\n if i<=j then\n begin\n data[0]:=data[i];\n data[i]:=data[j];\n data[j]:=data[0];\n inc(i);\n dec(j);\n end;\n until i>j;\n qsort(l,j,data);\n qsort(i,r,data);\nend;\nbegin\n readln(n);\n for i := 0 to n-1 do\n begin\n read(a[i+8]);\n end;\n qsort(8,n+7,@a);\n x:=0;\n y:=0;\n i:=n+7;\n while i>=8 do\n begin\n inc(x,a[i]);\n dec(i,2);\n end;\n i:=n+6;\n while i>=8 do\n begin\n inc(y,a[i]);\n dec(i,2);\n end;\n writeln(x-y);\nend.", "language": "Pascal", "metadata": {"date": 1522811945, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Pascal/s735110502.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s735110502", "user_id": "u403323882"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,x,y: Integer;\n a: array[0..100] of Integer;\n \nprocedure qsort(l,r:Longint;data:PInteger);\n//array index start at 0\nvar\n i,j,mid: Integer;\nbegin\n if l>=r then\n begin\n exit;\n end;\n i:=l;\n j:=r;\n mid:=data[(l+r) div 2];\n repeat\n while data[i]mid do\n begin\n dec(j);\n end;\n if i<=j then\n begin\n data[0]:=data[i];\n data[i]:=data[j];\n data[j]:=data[0];\n inc(i);\n dec(j);\n end;\n until i>j;\n qsort(l,j,data);\n qsort(i,r,data);\nend;\nbegin\n readln(n);\n for i := 0 to n-1 do\n begin\n read(a[i+8]);\n end;\n qsort(8,n+7,@a);\n x:=0;\n y:=0;\n i:=n+7;\n while i>=8 do\n begin\n inc(x,a[i]);\n dec(i,2);\n end;\n i:=n+6;\n while i>=8 do\n begin\n inc(y,a[i]);\n dec(i,2);\n end;\n writeln(x-y);\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 992, "cpu_time_ms": 97, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s770138622", "group_id": "codeNet:p03434", "input_text": "type\n datatype=Integer;\n obj=array[1..100] of datatype;\n\nvar\n n,i,x,y: Integer;\n a: obj;\n\nprocedure qsort(l,r:Longint;var data:obj);\nvar\n i,j,mid,t: datatype;\nbegin\n if l>=r then\n begin\n exit;\n end;\n i:=l;\n j:=r;\n mid:=data[(l+r) div 2];\n // mid:=(data + (l+r) div 2)^;\n repeat\n while data[i]mid do\n begin\n dec(j);\n end;\n if i<=j then\n begin\n t:=data[i];\n data[i]:=data[j];\n data[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n qsort(l,j,data);\n qsort(i,r,data);\nend;\nbegin\n readln(n);\n for i := 1 to n do\n begin\n read(a[i]);\n end;\n qsort(1,n,a);\n x:=0;\n y:=0;\n i:=n;\n while i>0 do\n begin\n inc(x,a[i]);\n dec(i,2);\n end;\n i:=n-1;\n while i>0 do\n begin\n inc(y,a[i]);\n dec(i,2);\n end;\n writeln(x-y);\n readln;\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1520404287, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Pascal/s770138622.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s770138622", "user_id": "u403323882"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "type\n datatype=Integer;\n obj=array[1..100] of datatype;\n\nvar\n n,i,x,y: Integer;\n a: obj;\n\nprocedure qsort(l,r:Longint;var data:obj);\nvar\n i,j,mid,t: datatype;\nbegin\n if l>=r then\n begin\n exit;\n end;\n i:=l;\n j:=r;\n mid:=data[(l+r) div 2];\n // mid:=(data + (l+r) div 2)^;\n repeat\n while data[i]mid do\n begin\n dec(j);\n end;\n if i<=j then\n begin\n t:=data[i];\n data[i]:=data[j];\n data[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n qsort(l,j,data);\n qsort(i,r,data);\nend;\nbegin\n readln(n);\n for i := 1 to n do\n begin\n read(a[i]);\n end;\n qsort(1,n,a);\n x:=0;\n y:=0;\n i:=n;\n while i>0 do\n begin\n inc(x,a[i]);\n dec(i,2);\n end;\n i:=n-1;\n while i>0 do\n begin\n inc(y,a[i]);\n dec(i,2);\n end;\n writeln(x-y);\n readln;\n readln;\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1043, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s629013821", "group_id": "codeNet:p03437", "input_text": "var\n x,y:longint;\n \nbegin\n readln(x,y);\n if x mod y<>0 then writeln(x)\n else\n writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1534463672, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03437.html", "problem_id": "p03437", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03437/input.txt", "sample_output_relpath": "derived/input_output/data/p03437/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03437/Pascal/s629013821.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s629013821", "user_id": "u426964396"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "var\n x,y:longint;\n \nbegin\n readln(x,y);\n if x mod y<>0 then writeln(x)\n else\n writeln(-1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers X and Y.\nIf there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.\nIf it does not exist, print -1.\n\nConstraints\n\n1 ≤ X,Y ≤ 10^9\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\n16\n\nFor example, 16 is a multiple of 8 but not a multiple of 6.\n\nSample Input 2\n\n3 3\n\nSample Output 2\n\n-1\n\nA multiple of 3 is a multiple of 3.", "sample_input": "8 6\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03437", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers X and Y.\nIf there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.\nIf it does not exist, print -1.\n\nConstraints\n\n1 ≤ X,Y ≤ 10^9\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\n16\n\nFor example, 16 is a multiple of 8 but not a multiple of 6.\n\nSample Input 2\n\n3 3\n\nSample Output 2\n\n-1\n\nA multiple of 3 is a multiple of 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s325030102", "group_id": "codeNet:p03438", "input_text": "var\n n,i,s1,s2:longint;\n a,b:array[1..10000] of longint;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do read(b[i]);\n for i:=1 to n do\n begin\n if a[i]>b[i] then s1:=s1+a[i]-b[i];\n if a[i]b[i] then s1:=s1+a[i]-b[i];\n if a[i]fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n inc(h);\n end else\n begin\n now[p[i].id]:=0;\n inc(z);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n have:=have-(h-1)*2;\n if have0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end;\n if (qwq>2)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1517729736, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03440.html", "problem_id": "p03440", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03440/input.txt", "sample_output_relpath": "derived/input_output/data/p03440/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03440/Pascal/s304707020.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s304707020", "user_id": "u809476955"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have,h,z:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n inc(h);\n end else\n begin\n now[p[i].id]:=0;\n inc(z);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n have:=have-(h-1)*2;\n if have0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end;\n if (qwq>2)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "sample_input": "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03440", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3091, "cpu_time_ms": 57, "memory_kb": 3584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s687879654", "group_id": "codeNet:p03440", "input_text": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n if (n=2) then\n begin\n writeln(ans);\n exit;\n end; \n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end;\n if (qwq>2)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1517728912, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03440.html", "problem_id": "p03440", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03440/input.txt", "sample_output_relpath": "derived/input_output/data/p03440/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03440/Pascal/s687879654.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s687879654", "user_id": "u809476955"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n if (n=2) then\n begin\n writeln(ans);\n exit;\n end; \n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end;\n if (qwq>2)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "sample_input": "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03440", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3144, "cpu_time_ms": 57, "memory_kb": 3584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s892628685", "group_id": "codeNet:p03440", "input_text": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end;\n if (qwq>2)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1517728725, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03440.html", "problem_id": "p03440", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03440/input.txt", "sample_output_relpath": "derived/input_output/data/p03440/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03440/Pascal/s892628685.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s892628685", "user_id": "u809476955"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end;\n if (qwq>2)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "sample_input": "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03440", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3084, "cpu_time_ms": 64, "memory_kb": 3584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s987311741", "group_id": "codeNet:p03440", "input_text": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end else\n if (totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n end;\n if (qwq>1)and(totin>0) then\n begin\n x:=heap[1,1];\n if qwq>2 then inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1517728468, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03440.html", "problem_id": "p03440", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03440/input.txt", "sample_output_relpath": "derived/input_output/data/p03440/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03440/Pascal/s987311741.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s987311741", "user_id": "u809476955"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..105000]of longint;\n p:array[0..105000]of node;\n heap:array[0..105000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end else\n if (totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n end;\n if (qwq>1)and(totin>0) then\n begin\n x:=heap[1,1];\n if qwq>2 then inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "sample_input": "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03440", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3193, "cpu_time_ms": 58, "memory_kb": 3584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s337941462", "group_id": "codeNet:p03447", "input_text": "var \n\ti,j,k,sum: longint;\n loop,loop_2,loop_3,ans: integer;\nbegin\n\treadln(loop);\n readln(loop_2);\n readln(loop_3);\n readln(ans);\n\tfor i := 0 to loop do begin\n for j:= 0 to loop_2 do begin\n for k:= 0 to loop_3 do begin\n \t//writeln(i * 500);\n //writeln(j * 100);\n //writeln(k * 50);\n \tif (i * 500 + j * 100 + k * 50 = ans) then inc(sum); //インクリメント \n end;\n end; \n end;\n \n writeln(sum);\n \n //writeln(loop);\n //writeln(loop_2);\n //writeln(loop_3);\n \n \n end.", "language": "Pascal", "metadata": {"date": 1579358340, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03447.html", "problem_id": "p03447", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03447/input.txt", "sample_output_relpath": "derived/input_output/data/p03447/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03447/Pascal/s337941462.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s337941462", "user_id": "u663819790"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "var \n\ti,j,k,sum: longint;\n loop,loop_2,loop_3,ans: integer;\nbegin\n\treadln(loop);\n readln(loop_2);\n readln(loop_3);\n readln(ans);\n\tfor i := 0 to loop do begin\n for j:= 0 to loop_2 do begin\n for k:= 0 to loop_3 do begin\n \t//writeln(i * 500);\n //writeln(j * 100);\n //writeln(k * 50);\n \tif (i * 500 + j * 100 + k * 50 = ans) then inc(sum); //インクリメント \n end;\n end; \n end;\n \n writeln(sum);\n \n //writeln(loop);\n //writeln(loop_2);\n //writeln(loop_3);\n \n \n end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "sample_input": "1234\n150\n100\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03447", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 597, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s832980271", "group_id": "codeNet:p03447", "input_text": "var\n x,a,b:longint;\nbegin\n readln(x);\n readln(a);\n readln(b);\n x:=x-a;\n writeln(x mod b);\nend. ", "language": "Pascal", "metadata": {"date": 1534886224, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03447.html", "problem_id": "p03447", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03447/input.txt", "sample_output_relpath": "derived/input_output/data/p03447/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03447/Pascal/s832980271.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s832980271", "user_id": "u426964396"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "var\n x,a,b:longint;\nbegin\n readln(x);\n readln(a);\n readln(b);\n x:=x-a;\n writeln(x mod b);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "sample_input": "1234\n150\n100\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03447", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s744763158", "group_id": "codeNet:p03449", "input_text": "\n\nuses math;\nvar f,a:array[-1..10,0..1020] of longint;\nvar n,i,j:longint;\nbegin\n read(n);for i:=1 to 2 do for j:=1 to n do\n begin read(a[i,j]);f[i,j]:=max(f[i-1,j],f[i,j-1])+a[i,j];end;\n writeln(f[2,n]);\nend.\n", "language": "Pascal", "metadata": {"date": 1517192577, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03449.html", "problem_id": "p03449", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03449/input.txt", "sample_output_relpath": "derived/input_output/data/p03449/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03449/Pascal/s744763158.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s744763158", "user_id": "u168783191"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "\n\nuses math;\nvar f,a:array[-1..10,0..1020] of longint;\nvar n,i,j:longint;\nbegin\n read(n);for i:=1 to 2 do for j:=1 to n do\n begin read(a[i,j]);f[i,j]:=max(f[i-1,j],f[i,j-1])+a[i,j];end;\n writeln(f[2,n]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "sample_input": "5\n3 2 2 4 1\n1 2 2 2 1\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03449", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s495609357", "group_id": "codeNet:p03449", "input_text": "uses math;\nvar f,a:array[-1..10,0..1020] of longint;\nvar n,i,j:longint;\nbegin\n read(n);for i:=1 to 2 do for j:=1 to n do\n begin read(a[i,j]);f[i,j]:=max(f[i-1,j],f[i,j-1])+a[i,j];end;\n writeln(f[2,n]);\nend.", "language": "Pascal", "metadata": {"date": 1517191783, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03449.html", "problem_id": "p03449", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03449/input.txt", "sample_output_relpath": "derived/input_output/data/p03449/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03449/Pascal/s495609357.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s495609357", "user_id": "u379604713"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "uses math;\nvar f,a:array[-1..10,0..1020] of longint;\nvar n,i,j:longint;\nbegin\n read(n);for i:=1 to 2 do for j:=1 to n do\n begin read(a[i,j]);f[i,j]:=max(f[i-1,j],f[i,j-1])+a[i,j];end;\n writeln(f[2,n]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "sample_input": "5\n3 2 2 4 1\n1 2 2 2 1\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03449", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 209, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s820887315", "group_id": "codeNet:p03450", "input_text": "var\n n,m,i: Longint;\n L,R,D: Longint;\n position:array[1..100000] of Longint;\n flag:Boolean;\nbegin\n flag:=true;\n readln(n,m);\n for i := 1 to n do\n begin\n position[i]:=-2147483648;\n end;\n for i := 1 to m do\n begin\n readln(L,R,D);\n if (position[L]=-2147483648)and(position[R]=-2147483648) then \n begin\n position[L]:=0;\n position[R]:=D;\n end\n else \n begin\n if (position[L]<>-2147483648) and (position[R]<>-2147483648) then \n begin\n if position[L]+D<>position[R] then\n begin\n flag:=false;\n break;\n end;\n end\n else\n begin\n if position[L]<>-2147483648 then\n begin\n position[R]:=position[L]+D;\n end\n else\n begin\n position[L]:=position[R]-D;\n end;\n end;\n end;\n end;\n if flag then \n begin\n writeln('Yes');\n end\n else \n begin\n writeln('No');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1517196093, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03450.html", "problem_id": "p03450", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03450/input.txt", "sample_output_relpath": "derived/input_output/data/p03450/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03450/Pascal/s820887315.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s820887315", "user_id": "u403323882"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,m,i: Longint;\n L,R,D: Longint;\n position:array[1..100000] of Longint;\n flag:Boolean;\nbegin\n flag:=true;\n readln(n,m);\n for i := 1 to n do\n begin\n position[i]:=-2147483648;\n end;\n for i := 1 to m do\n begin\n readln(L,R,D);\n if (position[L]=-2147483648)and(position[R]=-2147483648) then \n begin\n position[L]:=0;\n position[R]:=D;\n end\n else \n begin\n if (position[L]<>-2147483648) and (position[R]<>-2147483648) then \n begin\n if position[L]+D<>position[R] then\n begin\n flag:=false;\n break;\n end;\n end\n else\n begin\n if position[L]<>-2147483648 then\n begin\n position[R]:=position[L]+D;\n end\n else\n begin\n position[L]:=position[R]-D;\n end;\n end;\n end;\n end;\n if flag then \n begin\n writeln('Yes');\n end\n else \n begin\n writeln('No');\n end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "sample_input": "3 3\n1 2 1\n2 3 1\n1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03450", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1164, "cpu_time_ms": 2, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s641545652", "group_id": "codeNet:p03450", "input_text": "var x,y,z,n,m:longint;\n i,t,w:longint;\n father,cost:array[0..1000000]of longint;\n flag:boolean;\nfunction getfather(x:longint):longint;\nvar t:longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n t:=getfather(father[x]);\n cost[x]:=cost[x]+cost[father[x]];\n father[x]:=t;\n getfather:=father[x];\n end;\nend;\nprocedure join(x,y,z:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n cost[fx]:=cost[y]-z-cost[x];\n end else\n if cost[y]-cost[x]<>z then flag:=false;\nend;\nbegin\n flag:=true;\n read(n,m);\n for i:=0 to n do\n begin\n father[i]:=i;\n cost[i]:=0;\n end;\n for i:=1 to m do\n begin\n read(x,y,z);\n join(x,y,z);\n end;\n if flag then writeln('Yes') else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1517192588, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03450.html", "problem_id": "p03450", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03450/input.txt", "sample_output_relpath": "derived/input_output/data/p03450/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03450/Pascal/s641545652.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s641545652", "user_id": "u168783191"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var x,y,z,n,m:longint;\n i,t,w:longint;\n father,cost:array[0..1000000]of longint;\n flag:boolean;\nfunction getfather(x:longint):longint;\nvar t:longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n t:=getfather(father[x]);\n cost[x]:=cost[x]+cost[father[x]];\n father[x]:=t;\n getfather:=father[x];\n end;\nend;\nprocedure join(x,y,z:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n cost[fx]:=cost[y]-z-cost[x];\n end else\n if cost[y]-cost[x]<>z then flag:=false;\nend;\nbegin\n flag:=true;\n read(n,m);\n for i:=0 to n do\n begin\n father[i]:=i;\n cost[i]:=0;\n end;\n for i:=1 to m do\n begin\n read(x,y,z);\n join(x,y,z);\n end;\n if flag then writeln('Yes') else writeln('No');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "sample_input": "3 3\n1 2 1\n2 3 1\n1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03450", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 813, "cpu_time_ms": 78, "memory_kb": 4608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s726979899", "group_id": "codeNet:p03450", "input_text": "var x,y,z,n,m:longint;\n i,t,w:longint;\n father,cost:array[0..1000000]of longint;\n flag:boolean;\nfunction getfather(x:longint):longint;\nvar t:longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n t:=getfather(father[x]);\n cost[x]:=cost[x]+cost[father[x]];\n father[x]:=t;\n getfather:=father[x];\n end;\nend;\nprocedure join(x,y,z:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n cost[fx]:=cost[y]-z-cost[x];\n end else\n if cost[y]-cost[x]<>z then flag:=false;\nend;\nbegin\n flag:=true;\n read(n,m);\n for i:=0 to n do\n begin\n father[i]:=i;\n cost[i]:=0;\n end;\n for i:=1 to m do\n begin\n read(x,y,z);\n join(x,y,z);\n end;\n if flag then writeln('Yes') else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1517192384, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03450.html", "problem_id": "p03450", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03450/input.txt", "sample_output_relpath": "derived/input_output/data/p03450/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03450/Pascal/s726979899.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s726979899", "user_id": "u379604713"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var x,y,z,n,m:longint;\n i,t,w:longint;\n father,cost:array[0..1000000]of longint;\n flag:boolean;\nfunction getfather(x:longint):longint;\nvar t:longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n t:=getfather(father[x]);\n cost[x]:=cost[x]+cost[father[x]];\n father[x]:=t;\n getfather:=father[x];\n end;\nend;\nprocedure join(x,y,z:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n cost[fx]:=cost[y]-z-cost[x];\n end else\n if cost[y]-cost[x]<>z then flag:=false;\nend;\nbegin\n flag:=true;\n read(n,m);\n for i:=0 to n do\n begin\n father[i]:=i;\n cost[i]:=0;\n end;\n for i:=1 to m do\n begin\n read(x,y,z);\n join(x,y,z);\n end;\n if flag then writeln('Yes') else writeln('No');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "sample_input": "3 3\n1 2 1\n2 3 1\n1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03450", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 813, "cpu_time_ms": 78, "memory_kb": 4608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s247948405", "group_id": "codeNet:p03452", "input_text": "var x,y,z,n,m:longint;\n i,t,w:longint;\n father,cost:array[0..1000000]of longint;\n flag:boolean;\nfunction getfather(x:longint):longint;\nvar t:longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n t:=getfather(father[x]);\n cost[x]:=cost[x]+cost[father[x]];\n father[x]:=t;\n getfather:=father[x];\n end;\nend;\nprocedure join(x,y,z:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n cost[fx]:=cost[y]-z-cost[x];\n end else\n if cost[y]-cost[x]<>z then flag:=false;\nend;\nbegin\n flag:=true;\n read(n,m);\n for i:=0 to n do\n begin\n father[i]:=i;\n cost[i]:=0;\n end;\n for i:=1 to m do\n begin\n read(x,y,z);\n join(x,y,z);\n end;\n if flag then writeln('Yes') else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1517192039, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03452.html", "problem_id": "p03452", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03452/input.txt", "sample_output_relpath": "derived/input_output/data/p03452/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03452/Pascal/s247948405.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s247948405", "user_id": "u809476955"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var x,y,z,n,m:longint;\n i,t,w:longint;\n father,cost:array[0..1000000]of longint;\n flag:boolean;\nfunction getfather(x:longint):longint;\nvar t:longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n t:=getfather(father[x]);\n cost[x]:=cost[x]+cost[father[x]];\n father[x]:=t;\n getfather:=father[x];\n end;\nend;\nprocedure join(x,y,z:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n cost[fx]:=cost[y]-z-cost[x];\n end else\n if cost[y]-cost[x]<>z then flag:=false;\nend;\nbegin\n flag:=true;\n read(n,m);\n for i:=0 to n do\n begin\n father[i]:=i;\n cost[i]:=0;\n end;\n for i:=1 to m do\n begin\n read(x,y,z);\n join(x,y,z);\n end;\n if flag then writeln('Yes') else writeln('No');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "sample_input": "3 3\n1 2 1\n2 3 1\n1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03452", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 813, "cpu_time_ms": 78, "memory_kb": 4608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s875788404", "group_id": "codeNet:p03457", "input_text": "var x,y,t:array[0..100000]of longint;\n n,i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(t[i],x[i],y[i]);\n for i:=1 to n do\n if (x[i]+y[i]>t[i])or((t[i]-x[i]-y[i])mod 2<>0) then\n begin\n writeln('No');\n halt;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1580582392, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s875788404.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s875788404", "user_id": "u743614777"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var x,y,t:array[0..100000]of longint;\n n,i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(t[i],x[i],y[i]);\n for i:=1 to n do\n if (x[i]+y[i]>t[i])or((t[i]-x[i]-y[i])mod 2<>0) then\n begin\n writeln('No');\n halt;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 271, "cpu_time_ms": 28, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s852690375", "group_id": "codeNet:p03457", "input_text": "var n,i,t,c,o:longint;\na,b:array[0..100000]of longint;\nbegin\nreadln(n);\nfor i:=1 to n do\n begin\n read(t,c,o);\n if tt) or (abs(abs(x-a)+abs(y-b)-t) mod 2=1) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1543787987, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s280768739.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s280768739", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,a,b,t,x,y:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:=1 to n do\n begin\n read(t,a,b);\n if (abs(x-a)+abs(y-b)>t) or (abs(abs(x-a)+abs(y-b)-t) mod 2=1) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 301, "cpu_time_ms": 27, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s236046553", "group_id": "codeNet:p03457", "input_text": "var\n n,i,a,b,t,x,y:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:=1 to n do\n begin\n read(t,a,b);\n if (abs(x-a)+abs(y-b)>t) or ((abs(x-a)+abs(y-b)-t) mod 2=1) then\n begin\n writeln('No');\n halt;\n end;\n x:=a; y:=b;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1543787577, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s236046553.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s236046553", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,a,b,t,x,y:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:=1 to n do\n begin\n read(t,a,b);\n if (abs(x-a)+abs(y-b)>t) or ((abs(x-a)+abs(y-b)-t) mod 2=1) then\n begin\n writeln('No');\n halt;\n end;\n x:=a; y:=b;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 27, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s430052987", "group_id": "codeNet:p03457", "input_text": "var\n n,i,x,y,z:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(z,x,y);\n if x+y>z then\n begin\n writeln('No');\n halt;\n end\n else\n if ((x+y) mod 2=0) and (odd(z)) then\n begin\n writeln('No');\n halt;\n end\n else\n if ((x+y) mod 2=1) and (z mod 2=0) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1543027288, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s430052987.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s430052987", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,x,y,z:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(z,x,y);\n if x+y>z then\n begin\n writeln('No');\n halt;\n end\n else\n if ((x+y) mod 2=0) and (odd(z)) then\n begin\n writeln('No');\n halt;\n end\n else\n if ((x+y) mod 2=1) and (z mod 2=0) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 380, "cpu_time_ms": 30, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s685186520", "group_id": "codeNet:p03457", "input_text": "var\n n,x,y,t,x1,y1,t1,i,s:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:= 1 to n do\n begin\n readln(t1,x1,y1);\n if (x=x1)and(y=y1)then begin writeln('No'); exit; end;\n if abs(x-x1)+abs(y-y1)=t1-t then begin x:=x1;y:=y1;t:=t1;end\n else\n begin\n if abs(x-x1)+abs(y-y1)=0) and (ans mod 2=0) then begin lx:=x;ly:=y;lt:=t;end\n else begin writeln('No');halt;end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1516587117, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s131553374.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s131553374", "user_id": "u379604713"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var n,i,j,x,y,t,ans,lx,ly,lt:longint;\nbegin\n read(n);lx:=0;ly:=0;lt:=0;\n for i:=1 to n do\n begin\n read(t,x,y);\n ans:=t-(lt+abs(x-lx)+abs(y-ly));\n if (ans>=0) and (ans mod 2=0) then begin lx:=x;ly:=y;lt:=t;end\n else begin writeln('No');halt;end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 289, "cpu_time_ms": 27, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s366150917", "group_id": "codeNet:p03458", "input_text": "var\n\tN, K, i, j, x, y, b, nx, ny: integer;\n c: string;\n\tcnt: array[1..1001, 1..1001] of integer;\nbegin\n\tread(N, K);\n for i := 1 to N do begin\n \tread(x, y, c);\n if c = ' W' then y := y + k;\n if x div K mod 2 = y div K mod 2 then\n \tb := 1\n else\n \tb := -1;\n if b = 1 then cnt[1, 1] := cnt[1, 1] + 1;\n nx := x mod K + 2;\n ny := y mod K + 2;\n cnt[nx, 1] := cnt[nx, 1] - b;\n cnt[1, ny] := cnt[1, ny] - b;\n cnt[nx, ny] := cnt[nx, ny] + b * 2;\n end;\n for i := 1 to K + 1 do for j := 1 to K do\n \tcnt[i, j + 1] := cnt[i, j + 1] + cnt[i, j];\n for j := 1 to K + 1 do for i := 1 to K do\n \tcnt[i + 1, j] := cnt[i + 1, j] + cnt[i, j];\n for i := 1 to K do for j := 1 to K do begin\n \tif b < cnt[i, j] then b := cnt[i, j];\n \tif b < N - cnt[i, j] then b := N - cnt[i, j];\n end;\n writeln(b);\nend.", "language": "Pascal", "metadata": {"date": 1594117163, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s366150917.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s366150917", "user_id": "u048773461"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tN, K, i, j, x, y, b, nx, ny: integer;\n c: string;\n\tcnt: array[1..1001, 1..1001] of integer;\nbegin\n\tread(N, K);\n for i := 1 to N do begin\n \tread(x, y, c);\n if c = ' W' then y := y + k;\n if x div K mod 2 = y div K mod 2 then\n \tb := 1\n else\n \tb := -1;\n if b = 1 then cnt[1, 1] := cnt[1, 1] + 1;\n nx := x mod K + 2;\n ny := y mod K + 2;\n cnt[nx, 1] := cnt[nx, 1] - b;\n cnt[1, ny] := cnt[1, ny] - b;\n cnt[nx, ny] := cnt[nx, ny] + b * 2;\n end;\n for i := 1 to K + 1 do for j := 1 to K do\n \tcnt[i, j + 1] := cnt[i, j + 1] + cnt[i, j];\n for j := 1 to K + 1 do for i := 1 to K do\n \tcnt[i + 1, j] := cnt[i + 1, j] + cnt[i, j];\n for i := 1 to K do for j := 1 to K do begin\n \tif b < cnt[i, j] then b := cnt[i, j];\n \tif b < N - cnt[i, j] then b := N - cnt[i, j];\n end;\n writeln(b);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 892, "cpu_time_ms": 66, "memory_kb": 4172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s324341246", "group_id": "codeNet:p03458", "input_text": "{$R-,S-,Q-,I-,O+}\nconst KK=1000;\nvar cond:array[0..1,1..4*KK,1..4*KK] of longint;\n dp:array[0..1,0..4*KK,0..4*KK] of longint;\n n,k,i,x,y,dx,dy,col,row_sum,max,temp:longint;\n c,d:char;\n\nfunction sum(col,x1,y1,x2,y2:longint):longint;\nbegin\n sum:=dp[col,x2,y2]+dp[col,x1-1,y1-1]\n -dp[col,x2,y1-1]-dp[col,x1-1,y2];\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do begin\n readln(x,y,c,d);\n x:=x mod (2*k);\n y:=y mod (2*k);\n col:=ord(d='W');\n for dx:=0 to 1 do for dy:=0 to 1 do\n inc(cond[col,x+dx*2*k,y+dy*2*k]);\n end;\n\n for col:=0 to 1 do\n for x:=1 to 4*k do begin\n row_sum:=0;\n for y:=1 to 4*k do begin\n inc(row_sum,cond[col,x,y]);\n dp[col,x,y]:=dp[col,x-1,y]+row_sum;\n end;\n end;\n\n max:=0;\n for x:=1 to 2*k do for y:=1 to 2*k do begin\n temp:=0;\n inc(temp,sum(0,x+k,y+k,x+2*k-1,y+2*k-1));\n inc(temp,sum(0,x ,y ,x+ k-1,y+ k-1));\n inc(temp,sum(1,x+k,y ,x+2*k-1,y+ k-1));\n inc(temp,sum(1,x ,y+k,x+ k-1,y+2*k-1));\n if max=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n if ans<0 then writeln(0) else if ans>n then writeln(n) else\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516592403, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s145847909.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s145847909", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k);\n if tmp2='W' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n if ans<0 then writeln(0) else if ans>n then writeln(n) else\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1489, "cpu_time_ms": 108, "memory_kb": 130176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s232833493", "group_id": "codeNet:p03458", "input_text": "uses math;\nvar n,k,i,j,sumw,sumb,m,ans,x,y:longint;\nvar bs,ws,b1,w1:array[-3020..3020,-3020..3020] of longint;\nvar c,c1:char;\nfunction gsw(x1,y1,x2,y2:longint):longint;\nbegin\n exit(ws[x2,y2]-ws[x2,y1-1]-ws[x1-1,y2]+ws[x1-1,y1-1]);\nend;\nfunction gsb(x1,y1,x2,y2:longint):longint;\nbegin\n exit(bs[x2,y2]-bs[x2,y1-1]-bs[x1-1,y2]+bs[x1-1,y1-1]);\nend;\nbegin\n fillchar(bs,sizeof(bs),0);fillchar(ws,sizeof(ws),0);\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x,y,c,c1);x:=x mod 2*k;y:=y mod 2*k;\n if c1='B' then inc(b1[x,y]) else inc(w1[x,y]);\n end;\n for i:=1 to 2*k-1 do\n for j:=1 to 2*k-1 do\n begin\n bs[i,j]:=b1[i,j]+bs[i-1,j]+bs[i,j-1]-bs[i-1,j-1];\n ws[i,j]:=w1[i,j]+ws[i-1,j]+ws[i,j-1]-ws[i-1,j-1];\n end;\n ans:=0;\n for i:=1 to 2*k do\n for j:=1 to 2*k do\n begin\n {sumw:=ws[i-k+1,k-j]-ws[i-k+1-k,k+j]-ws[i-k+1,k-j-k]+ws[i-k+1-k,k-j-k]+\n //ws[i-k+1,2*k-j+1+k-1]-ws[i-k+1,2*k-j]-ws[i-k+1-k,3*k-j]+ws[i+1,2*k-j-1]+\n ws[i-k+1,3*k-i-1]-ws[i-k+1-k,3*k-i-1]-ws[i-k+1,2*k-i-1]+ws[i-2*k+1,2*k-i-1]+\n ws[i+1,2*k-j]-ws[i+1-k,2*k-j]-ws[i+1,2*k-j]+ws[i+1-k,2*k-j-j]+\n ws[k+i+1,2*k-i+1]-ws[i+1,2*k-i+1]-ws[k+i+1,k-i+1]+ws[i+1,k-i+1]+\n ws[k+i+1,k-i]-ws[i+1,k-i]-ws[k+i+1,-i]+ws[i+1,-i];\n sumb:=bs[ }\n ans:=max(ans,gsw(1,1,i-1,j-1));\n ans:=max(ans,gsw(1,j+k,i-1,2*k));\n ans:=max(ans,gsw(i+k,1,2*k,j-1));\n ans:=max(ans,gsw(i,j,i+k-1,j+k-1));\n ans:=max(ans,gsw(i+k,j+k,2*k,2*k));\n ans:=max(ans,gsb(1,j,i-1,j+k-1));\n ans:=max(ans,gsb(i,1,i+k-1,j-1));\n ans:=max(ans,gsb(i,j+k,i+k-1,2*k));\n ans:=max(ans,gsb(i+k,j,2*k,j+k-1));\n\n ans:=max(ans,gsb(1,1,i-1,j-1));\n ans:=max(ans,gsb(1,j+k,i-1,2*k));\n ans:=max(ans,gsb(i+k,1,2*k,j-1));\n ans:=max(ans,gsb(i,j,i+k-1,j+k-1));\n ans:=max(ans,gsb(i+k,j+k,2*k,2*k));\n ans:=max(ans,gsw(1,j,i-1,j+k-1));\n ans:=max(ans,gsw(i,1,i+k-1,j-1));\n ans:=max(ans,gsw(i,j+k,i+k-1,2*k));\n ans:=max(ans,gsw(i+k,j,2*k,j+k-1));\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516592396, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s232833493.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s232833493", "user_id": "u379604713"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "uses math;\nvar n,k,i,j,sumw,sumb,m,ans,x,y:longint;\nvar bs,ws,b1,w1:array[-3020..3020,-3020..3020] of longint;\nvar c,c1:char;\nfunction gsw(x1,y1,x2,y2:longint):longint;\nbegin\n exit(ws[x2,y2]-ws[x2,y1-1]-ws[x1-1,y2]+ws[x1-1,y1-1]);\nend;\nfunction gsb(x1,y1,x2,y2:longint):longint;\nbegin\n exit(bs[x2,y2]-bs[x2,y1-1]-bs[x1-1,y2]+bs[x1-1,y1-1]);\nend;\nbegin\n fillchar(bs,sizeof(bs),0);fillchar(ws,sizeof(ws),0);\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x,y,c,c1);x:=x mod 2*k;y:=y mod 2*k;\n if c1='B' then inc(b1[x,y]) else inc(w1[x,y]);\n end;\n for i:=1 to 2*k-1 do\n for j:=1 to 2*k-1 do\n begin\n bs[i,j]:=b1[i,j]+bs[i-1,j]+bs[i,j-1]-bs[i-1,j-1];\n ws[i,j]:=w1[i,j]+ws[i-1,j]+ws[i,j-1]-ws[i-1,j-1];\n end;\n ans:=0;\n for i:=1 to 2*k do\n for j:=1 to 2*k do\n begin\n {sumw:=ws[i-k+1,k-j]-ws[i-k+1-k,k+j]-ws[i-k+1,k-j-k]+ws[i-k+1-k,k-j-k]+\n //ws[i-k+1,2*k-j+1+k-1]-ws[i-k+1,2*k-j]-ws[i-k+1-k,3*k-j]+ws[i+1,2*k-j-1]+\n ws[i-k+1,3*k-i-1]-ws[i-k+1-k,3*k-i-1]-ws[i-k+1,2*k-i-1]+ws[i-2*k+1,2*k-i-1]+\n ws[i+1,2*k-j]-ws[i+1-k,2*k-j]-ws[i+1,2*k-j]+ws[i+1-k,2*k-j-j]+\n ws[k+i+1,2*k-i+1]-ws[i+1,2*k-i+1]-ws[k+i+1,k-i+1]+ws[i+1,k-i+1]+\n ws[k+i+1,k-i]-ws[i+1,k-i]-ws[k+i+1,-i]+ws[i+1,-i];\n sumb:=bs[ }\n ans:=max(ans,gsw(1,1,i-1,j-1));\n ans:=max(ans,gsw(1,j+k,i-1,2*k));\n ans:=max(ans,gsw(i+k,1,2*k,j-1));\n ans:=max(ans,gsw(i,j,i+k-1,j+k-1));\n ans:=max(ans,gsw(i+k,j+k,2*k,2*k));\n ans:=max(ans,gsb(1,j,i-1,j+k-1));\n ans:=max(ans,gsb(i,1,i+k-1,j-1));\n ans:=max(ans,gsb(i,j+k,i+k-1,2*k));\n ans:=max(ans,gsb(i+k,j,2*k,j+k-1));\n\n ans:=max(ans,gsb(1,1,i-1,j-1));\n ans:=max(ans,gsb(1,j+k,i-1,2*k));\n ans:=max(ans,gsb(i+k,1,2*k,j-1));\n ans:=max(ans,gsb(i,j,i+k-1,j+k-1));\n ans:=max(ans,gsb(i+k,j+k,2*k,2*k));\n ans:=max(ans,gsw(1,j,i-1,j+k-1));\n ans:=max(ans,gsw(i,1,i+k-1,j-1));\n ans:=max(ans,gsw(i,j+k,i+k-1,2*k));\n ans:=max(ans,gsw(i+k,j,2*k,j+k-1));\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2050, "cpu_time_ms": 489, "memory_kb": 294784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s297170047", "group_id": "codeNet:p03458", "input_text": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='W' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n if ans<0 then writeln(0) else if ans>n then writeln(n) else\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516592219, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s297170047.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s297170047", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='W' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n if ans<0 then writeln(0) else if ans>n then writeln(n) else\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1491, "cpu_time_ms": 108, "memory_kb": 130176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s727611145", "group_id": "codeNet:p03458", "input_text": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='W' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516592142, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s727611145.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s727611145", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='W' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1427, "cpu_time_ms": 108, "memory_kb": 130176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s276031037", "group_id": "codeNet:p03458", "input_text": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516591610, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s276031037.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s276031037", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,tmp3,x1,y1,x2,y2,k,ans,tmp5:int64;\ni,j:longint;\n x,y:array[1..200000]of int64;\n c,c2:array[-10..4000,-10..4000]of int64;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1427, "cpu_time_ms": 107, "memory_kb": 130176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s572170651", "group_id": "codeNet:p03458", "input_text": "var i,j,n,tmp3,x1,y1,x2,y2,k,ans,tmp5:longint;\n x,y:array[1..100000]of longint;\n c,c2:array[-1..2000,-1..2000]of longint;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516591433, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s572170651.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s572170651", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var i,j,n,tmp3,x1,y1,x2,y2,k,ans,tmp5:longint;\n x,y:array[1..100000]of longint;\n c,c2:array[-1..2000,-1..2000]of longint;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1422, "cpu_time_ms": 96, "memory_kb": 32128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s251945043", "group_id": "codeNet:p03458", "input_text": "var i,j,n,tmp3,x1,y1,x2,y2,k,ans,tmp5:longint;\n x,y:array[1..100000]of longint;\n c,c2:array[0..2000,0..2000]of longint;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n if y[i]>=k then y[i]:=y[i]-k\n else y[i]:=y[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n begin\n x1:=i;\n y1:=j;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516590461, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s251945043.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s251945043", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var i,j,n,tmp3,x1,y1,x2,y2,k,ans,tmp5:longint;\n x,y:array[1..100000]of longint;\n c,c2:array[0..2000,0..2000]of longint;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n if y[i]>=k then y[i]:=y[i]-k\n else y[i]:=y[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n begin\n x1:=i;\n y1:=j;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 804, "cpu_time_ms": 77, "memory_kb": 32128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s210113537", "group_id": "codeNet:p03464", "input_text": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n if x=0 then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=x*a[i] else min:=(x+1)*a[i];\n end;\n if min=0 then writeln(-1) else\n\n writeln(min,' ',max+a[1]-1);\nend.", "language": "Pascal", "metadata": {"date": 1515990251, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Pascal/s210113537.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s210113537", "user_id": "u809476955"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n if x=0 then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=x*a[i] else min:=(x+1)*a[i];\n end;\n if min=0 then writeln(-1) else\n\n writeln(min,' ',max+a[1]-1);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 527, "cpu_time_ms": 18, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s522403030", "group_id": "codeNet:p03465", "input_text": "program V8122A;\n var\n f:Array[0..125001] of longword;\n a,b:Array[0..2001] of longint;\n i,j,n,p,s:longint;\n t:longword;\n begin\n readln(n);\n s:=0;\n for i:=1 to n do\n begin\n read(A[i]);\n b[i]:=a[i] mod 30;\n inc(s,a[i]);\n end;\n readln;\n t:=2<<30-1;\n //writeln(t);\n filldword(f,sizeof(f)>>2,0);\n f[1]:=1;\n for i:=1 to n do\n for j:=s div 30+1 downto a[i] div 30+1 do\n f[j]:=(f[j-a[i] div 30]<<(b[i])) and t or f[j];\n p:=0;\n for i:=1 to s div 30+1 do\n for j:=1 to 30 do\n if ((1<<(j-1)) and f[i]=1<<(j-1)) and ((i-1)*30+j-1<=s>>1) then p:=(i-1)*30+j-1;\n writeln(s-p);\n end.\n", "language": "Pascal", "metadata": {"date": 1516642093, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03465.html", "problem_id": "p03465", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03465/input.txt", "sample_output_relpath": "derived/input_output/data/p03465/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03465/Pascal/s522403030.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s522403030", "user_id": "u018679195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program V8122A;\n var\n f:Array[0..125001] of longword;\n a,b:Array[0..2001] of longint;\n i,j,n,p,s:longint;\n t:longword;\n begin\n readln(n);\n s:=0;\n for i:=1 to n do\n begin\n read(A[i]);\n b[i]:=a[i] mod 30;\n inc(s,a[i]);\n end;\n readln;\n t:=2<<30-1;\n //writeln(t);\n filldword(f,sizeof(f)>>2,0);\n f[1]:=1;\n for i:=1 to n do\n for j:=s div 30+1 downto a[i] div 30+1 do\n f[j]:=(f[j-a[i] div 30]<<(b[i])) and t or f[j];\n p:=0;\n for i:=1 to s div 30+1 do\n for j:=1 to 30 do\n if ((1<<(j-1)) and f[i]=1<<(j-1)) and ((i-1)*30+j-1<=s>>1) then p:=(i-1)*30+j-1;\n writeln(s-p);\n end.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given N integers A_1, A_2, ..., A_N.\n\nConsider the sums of all non-empty subsequences of A. There are 2^N - 1 such sums, an odd number.\n\nLet the list of these sums in non-decreasing order be S_1, S_2, ..., S_{2^N - 1}.\n\nFind the median of this list, S_{2^{N-1}}.\n\nConstraints\n\n1 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 2000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the median of the sorted list of the sums of all non-empty subsequences of A.\n\nSample Input 1\n\n3\n1 2 1\n\nSample Output 1\n\n2\n\nIn this case, S = (1, 1, 2, 2, 3, 3, 4). Its median is S_4 = 2.\n\nSample Input 2\n\n1\n58\n\nSample Output 2\n\n58\n\nIn this case, S = (58).", "sample_input": "3\n1 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03465", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given N integers A_1, A_2, ..., A_N.\n\nConsider the sums of all non-empty subsequences of A. There are 2^N - 1 such sums, an odd number.\n\nLet the list of these sums in non-decreasing order be S_1, S_2, ..., S_{2^N - 1}.\n\nFind the median of this list, S_{2^{N-1}}.\n\nConstraints\n\n1 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 2000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the median of the sorted list of the sums of all non-empty subsequences of A.\n\nSample Input 1\n\n3\n1 2 1\n\nSample Output 1\n\n2\n\nIn this case, S = (1, 1, 2, 2, 3, 3, 4). Its median is S_4 = 2.\n\nSample Input 2\n\n1\n58\n\nSample Output 2\n\n58\n\nIn this case, S = (58).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 605, "cpu_time_ms": 2103, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s023266993", "group_id": "codeNet:p03474", "input_text": "var\nn,m,i:longint;\ns:string;\nbegin\nreadln(n,m);\nread(s);\nfor i:=1 to n do\n if not(s[i] in['0'..'9']) then begin writeln('No');halt;end;\nif s[n+1]<>'-' then begin writeln('No');halt;end;\nfor i:=n+2 to n+m+1 do\n if not(s[i] in['0'..'9']) then begin writeln('No');halt;end;\nwriteln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1582248047, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03474.html", "problem_id": "p03474", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03474/input.txt", "sample_output_relpath": "derived/input_output/data/p03474/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03474/Pascal/s023266993.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s023266993", "user_id": "u723721005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\nn,m,i:longint;\ns:string;\nbegin\nreadln(n,m);\nread(s);\nfor i:=1 to n do\n if not(s[i] in['0'..'9']) then begin writeln('No');halt;end;\nif s[n+1]<>'-' then begin writeln('No');halt;end;\nfor i:=n+2 to n+m+1 do\n if not(s[i] in['0'..'9']) then begin writeln('No');halt;end;\nwriteln('Yes');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "sample_input": "3 4\n269-6650\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03474", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 293, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s711492982", "group_id": "codeNet:p03474", "input_text": "var\n a,b,i:longint;\n s:string;\nbegin\n readln(a,b);\n readln(s);\n if s[a+1]<>'-' then begin writeln('No');halt; end;\n for i:=1 to a+b do\n if s[i]='-' then begin writeln('No');halt; end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1539047514, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03474.html", "problem_id": "p03474", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03474/input.txt", "sample_output_relpath": "derived/input_output/data/p03474/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03474/Pascal/s711492982.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s711492982", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n a,b,i:longint;\n s:string;\nbegin\n readln(a,b);\n readln(s);\n if s[a+1]<>'-' then begin writeln('No');halt; end;\n for i:=1 to a+b do\n if s[i]='-' then begin writeln('No');halt; end;\n writeln('Yes');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "sample_input": "3 4\n269-6650\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03474", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 214, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s142093805", "group_id": "codeNet:p03475", "input_text": "var\n\tn,i,j,p:Longint;\n\tc,s,f:array[1..500]of Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n-1 do read(c[i],s[i],f[i]);\n\tfor i:=1 to n do begin\n\t\tp:=0;\n\t\tfor j:=i to n-1 do begin\n\t\t\tif p100000 then break;\n prime[i*primes[j]]:=true;\n if i mod primes[j]=0 then break;\n end;\n end;\n fillchar(sum,sizeof(sum),0);\n for i:=1 to 100000 do if (not prime[i]) and (not prime[(i+1) div 2])\n then begin sum[i]:=sum[i-1]+1;//writeln(i);\n end\n else sum[i]:=sum[i-1];\n read(m);\n for i:=1 to m do begin read(x,y);writeln(sum[y]-sum[x-1]);end;\nend.", "language": "Pascal", "metadata": {"date": 1514686718, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03476.html", "problem_id": "p03476", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03476/input.txt", "sample_output_relpath": "derived/input_output/data/p03476/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03476/Pascal/s935789427.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s935789427", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var primes,sum:array[0..100020] of longint;\nvar prime:array[0..100020] of boolean;\nvar n,m,i,j,x,num,y:longint;\nbegin\n prime[0]:=true;prime[1]:=true;\n for i:=2 to 100000 do\n begin\n if not prime[i] then begin inc(num);primes[num]:=i;end;\n for j:=1 to num do\n begin\n if i*primes[j]>100000 then break;\n prime[i*primes[j]]:=true;\n if i mod primes[j]=0 then break;\n end;\n end;\n fillchar(sum,sizeof(sum),0);\n for i:=1 to 100000 do if (not prime[i]) and (not prime[(i+1) div 2])\n then begin sum[i]:=sum[i-1]+1;//writeln(i);\n end\n else sum[i]:=sum[i-1];\n read(m);\n for i:=1 to m do begin read(x,y);writeln(sum[y]-sum[x-1]);end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "sample_input": "1\n3 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03476", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 662, "cpu_time_ms": 36, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s623616855", "group_id": "codeNet:p03476", "input_text": "var i,j:longint;\n v:array[0..200000]of boolean;\n a,sum:array[0..200000]of longint;\n max,q,l,r:longint;\nbegin\n max:=100000;\n for i:=2 to max do\n if not v[i] then\n begin\n for j:=2 to (max div i) do\n v[i*j]:=true;\n end;\n for i:=2 to max do\n if i mod 2=1 then\n if (not v[i])and(not v[(i+1)div 2]) then\n a[i]:=1;\n for i:=1 to max do\n sum[i]:=sum[i-1]+a[i];\n read(q);\n for i:=1 to q do\n begin\n read(l,r);\n writeln(sum[r]-sum[l-1]);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1514686436, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03476.html", "problem_id": "p03476", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03476/input.txt", "sample_output_relpath": "derived/input_output/data/p03476/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03476/Pascal/s623616855.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s623616855", "user_id": "u165920140"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var i,j:longint;\n v:array[0..200000]of boolean;\n a,sum:array[0..200000]of longint;\n max,q,l,r:longint;\nbegin\n max:=100000;\n for i:=2 to max do\n if not v[i] then\n begin\n for j:=2 to (max div i) do\n v[i*j]:=true;\n end;\n for i:=2 to max do\n if i mod 2=1 then\n if (not v[i])and(not v[(i+1)div 2]) then\n a[i]:=1;\n for i:=1 to max do\n sum[i]:=sum[i-1]+a[i];\n read(q);\n for i:=1 to q do\n begin\n read(l,r);\n writeln(sum[r]-sum[l-1]);\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "sample_input": "1\n3 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03476", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 478, "cpu_time_ms": 34, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s179567659", "group_id": "codeNet:p03477", "input_text": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\nSysUtils;\nvar\nn,i,j,t,a,b,c,d:integer;\nbegin\ntry\n { TODO -oUser -cConsole Main : abc83}\n read(a);\n read(b);\n read(c);\n readln(d);\n\n if a+b>c+d then\n Writeln('Left')\n else if a+b=c+d then\n Writeln('Balanced')\n else\n Writeln('Right');\n\n readln;\nexcept\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\nend;\nend.", "language": "Pascal", "metadata": {"date": 1515796450, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03477.html", "problem_id": "p03477", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03477/input.txt", "sample_output_relpath": "derived/input_output/data/p03477/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03477/Pascal/s179567659.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s179567659", "user_id": "u755925739"}, "prompt_components": {"gold_output": "Left\n", "input_to_evaluate": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\nSysUtils;\nvar\nn,i,j,t,a,b,c,d:integer;\nbegin\ntry\n { TODO -oUser -cConsole Main : abc83}\n read(a);\n read(b);\n read(c);\n readln(d);\n\n if a+b>c+d then\n Writeln('Left')\n else if a+b=c+d then\n Writeln('Balanced')\n else\n Writeln('Right');\n\n readln;\nexcept\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\nend;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L8, we should print Left.\n\nSample Input 2\n\n3 4 5 2\n\nSample Output 2\n\nBalanced\n\nThe total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.\n\nSample Input 3\n\n1 7 6 4\n\nSample Output 3\n\nRight\n\nThe total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.", "sample_input": "3 8 7 1\n"}, "reference_outputs": ["Left\n"], "source_document_id": "p03477", "source_text": "Score : 100 points\n\nProblem Statement\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L8, we should print Left.\n\nSample Input 2\n\n3 4 5 2\n\nSample Output 2\n\nBalanced\n\nThe total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.\n\nSample Input 3\n\n1 7 6 4\n\nSample Output 3\n\nRight\n\nThe total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 395, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s581862164", "group_id": "codeNet:p03480", "input_text": "var\n ch:char;\n s:longint;\nbegin\n while not eoln do\n begin\n read(ch);\n if ch='0' then inc(s);\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1538830468, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03480.html", "problem_id": "p03480", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03480/input.txt", "sample_output_relpath": "derived/input_output/data/p03480/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03480/Pascal/s581862164.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s581862164", "user_id": "u723721005"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n ch:char;\n s:longint;\nbegin\n while not eoln do\n begin\n read(ch);\n if ch='0' then inc(s);\n end;\n writeln(s);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03480", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s763099312", "group_id": "codeNet:p03480", "input_text": "var\n s:ansistring;\n i,p:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if s[i]='0' then inc(p);\n writeln(p);\nend.", "language": "Pascal", "metadata": {"date": 1538672081, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03480.html", "problem_id": "p03480", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03480/input.txt", "sample_output_relpath": "derived/input_output/data/p03480/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03480/Pascal/s763099312.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s763099312", "user_id": "u426964396"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n s:ansistring;\n i,p:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if s[i]='0' then inc(p);\n writeln(p);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03480", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s919056151", "group_id": "codeNet:p03480", "input_text": "uses math ;\nvar mi,m,i,j,k,sum,now,c,d : longint ;\n cc,yo : array [0..1000001] of int64 ;\n a,b : int64 ;\n so,s1,s2 : ansistring ;\n gg : char ;\nbegin\n readln(so);\n gg:='2';\n j:=-1;\n for i:=1 to length(so) do\n begin\n if gg<>so[i] then\n begin\n inc(j);\n cc[j]:=now;\n now:=1;\n gg:=so[i];\n end\n else\n inc(now);\n end;\n inc(j);\n cc[j]:=now;\n mi:=1000000000;\n for i:=3 to j do\n begin\n if min(cc[i-2],cc[i])+cc[i-1]so[i] then\n begin\n inc(j);\n cc[j]:=now;\n now:=1;\n gg:=so[i];\n end\n else\n inc(now);\n end;\n inc(j);\n cc[j]:=now;\n mi:=1000000000;\n for i:=3 to j do\n begin\n if min(cc[i-2],cc[i])+cc[i-1]s[i+1]then begin\n\t\t\tt:=i;\n\t\t\tif tt then m:=t;\n\t\tend;\n\tend;\n\twriteln(m);\nend.", "language": "Pascal", "metadata": {"date": 1539846389, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03482.html", "problem_id": "p03482", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03482/input.txt", "sample_output_relpath": "derived/input_output/data/p03482/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03482/Pascal/s900544557.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900544557", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ts:String;\n\ti,m,t,n:Longint;\nbegin\n\treadln(s);\n\tn:=length(s);\n\tm:=n;\n\tfor i:=1 to n-1 do begin\n\t\tif s[i]<>s[i+1]then begin\n\t\t\tt:=i;\n\t\t\tif tt then m:=t;\n\t\tend;\n\tend;\n\twriteln(m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03482", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s936922117", "group_id": "codeNet:p03487", "input_text": "var a:array[0..100000]of longint;\n n,x,ans,i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n if x>n then\n inc(ans)\n else\n inc(a[x]);\n end;\n for i:=1 to n do\n if a[i]<>0 then\n if a[i]i) then\n inc(ans,a[i]-i);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1580604060, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Pascal/s936922117.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s936922117", "user_id": "u743614777"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a:array[0..100000]of longint;\n n,x,ans,i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n if x>n then\n inc(ans)\n else\n inc(a[x]);\n end;\n for i:=1 to n do\n if a[i]<>0 then\n if a[i]i) then\n inc(ans,a[i]-i);\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 16, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s574916843", "group_id": "codeNet:p03487", "input_text": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if a[i-1]>t then s:=s+a[i-1]-t\n else s:=s+a[i-1];\n t:=1;\n end;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535649576, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Pascal/s574916843.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s574916843", "user_id": "u247366051"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if a[i-1]>t then s:=s+a[i-1]-t\n else s:=s+a[i-1];\n t:=1;\n end;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 760, "cpu_time_ms": 23, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s309391484", "group_id": "codeNet:p03490", "input_text": "var\n\ts:String;\n\tx,y,f,cnt,i,j,off:Longint;\n\td:array[1..2,1..8000]of Longint;\n\tc:array[1..2]of Longint;\n\tdp:array[1..2,1..2,1..20000]of Boolean;\n\tans:Boolean;\nbegin\n\treadln(s);\n\tf:=1;\n\tfor i:=1 to length(s) do begin\n\t\tif s[i]='T'then begin\n\t\t\tinc(c[f]);\n\t\t\td[f,c[f]]:=cnt;\n\t\t\tcnt:=0;\n\t\t\tf:=3-f;\n\t\tend else inc(cnt);\n\tend;\n\tinc(c[f]);\n\td[f,c[f]]:=cnt;\n\tread(x,y);\n\toff:=10000;\n\tdp[1,1,off+d[1,1]]:=True;\n\tdp[2,1,off-d[2,1]]:=True;\n\tdp[2,1,off+d[2,1]]:=True;\n\tf:=1;\n\tfor i:=2 to c[1]do begin\n\t\tfor j:=1 to 20000-d[1,i]do begin\n\t\t\tif dp[1,f,j]then dp[1,3-f,j+d[1,i]]:=True;\n\t\tend;\n\t\tfor j:=d[1,i]+1 to 20000 do begin\n\t\t\tif dp[1,f,j]then dp[1,3-f,j-d[1,i]]:=True;\n\t\tend;\n\t\tfor j:=1 to 20000 do dp[1,f,j]:=False;\n\t\tf:=3-f;\n\tend;\n\tans:=dp[1,f,off+x];\n\tf:=1;\n\tfor i:=2 to c[2]do begin\n\t\tfor j:=1 to 20000-d[2,i]do begin\n\t\t\tif dp[2,f,j]then dp[2,3-f,j+d[1,i]]:=True;\n\t\tend;\n\t\tfor j:=d[2,i]+1 to 20000 do begin\n\t\t\tif dp[2,f,j]then dp[2,3-f,j-d[2,i]]:=True;\n\t\tend;\n\t\tfor j:=1 to 20000 do dp[2,f,j]:=False;\n\t\tf:=3-f;\n\tend;\n\tif ans and dp[2,f,off+y]then writeln('Yes')else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1539840406, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03490.html", "problem_id": "p03490", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03490/input.txt", "sample_output_relpath": "derived/input_output/data/p03490/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03490/Pascal/s309391484.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s309391484", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\ts:String;\n\tx,y,f,cnt,i,j,off:Longint;\n\td:array[1..2,1..8000]of Longint;\n\tc:array[1..2]of Longint;\n\tdp:array[1..2,1..2,1..20000]of Boolean;\n\tans:Boolean;\nbegin\n\treadln(s);\n\tf:=1;\n\tfor i:=1 to length(s) do begin\n\t\tif s[i]='T'then begin\n\t\t\tinc(c[f]);\n\t\t\td[f,c[f]]:=cnt;\n\t\t\tcnt:=0;\n\t\t\tf:=3-f;\n\t\tend else inc(cnt);\n\tend;\n\tinc(c[f]);\n\td[f,c[f]]:=cnt;\n\tread(x,y);\n\toff:=10000;\n\tdp[1,1,off+d[1,1]]:=True;\n\tdp[2,1,off-d[2,1]]:=True;\n\tdp[2,1,off+d[2,1]]:=True;\n\tf:=1;\n\tfor i:=2 to c[1]do begin\n\t\tfor j:=1 to 20000-d[1,i]do begin\n\t\t\tif dp[1,f,j]then dp[1,3-f,j+d[1,i]]:=True;\n\t\tend;\n\t\tfor j:=d[1,i]+1 to 20000 do begin\n\t\t\tif dp[1,f,j]then dp[1,3-f,j-d[1,i]]:=True;\n\t\tend;\n\t\tfor j:=1 to 20000 do dp[1,f,j]:=False;\n\t\tf:=3-f;\n\tend;\n\tans:=dp[1,f,off+x];\n\tf:=1;\n\tfor i:=2 to c[2]do begin\n\t\tfor j:=1 to 20000-d[2,i]do begin\n\t\t\tif dp[2,f,j]then dp[2,3-f,j+d[1,i]]:=True;\n\t\tend;\n\t\tfor j:=d[2,i]+1 to 20000 do begin\n\t\t\tif dp[2,f,j]then dp[2,3-f,j-d[2,i]]:=True;\n\t\tend;\n\t\tfor j:=1 to 20000 do dp[2,f,j]:=False;\n\t\tf:=3-f;\n\tend;\n\tif ans and dp[2,f,off+y]then writeln('Yes')else writeln('No');\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nA robot is put at the origin in a two-dimensional plane.\nInitially, the robot is facing in the positive x-axis direction.\n\nThis robot will be given an instruction sequence s.\ns consists of the following two kinds of letters, and will be executed in order from front to back.\n\nF : Move in the current direction by distance 1.\n\nT : Turn 90 degrees, either clockwise or counterclockwise.\n\nThe objective of the robot is to be at coordinates (x, y) after all the instructions are executed.\nDetermine whether this objective is achievable.\n\nConstraints\n\ns consists of F and T.\n\n1 \\leq |s| \\leq 8 000\n\nx and y are integers.\n\n|x|, |y| \\leq |s|\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nx y\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\nFTFFTFFF\n4 2\n\nSample Output 1\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning clockwise in the second T.\n\nSample Input 2\n\nFTFFTFFF\n-2 -2\n\nSample Output 2\n\nYes\n\nThe objective can be achieved by, for example, turning clockwise in the first T and turning clockwise in the second T.\n\nSample Input 3\n\nFF\n1 0\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nTF\n1 0\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nFFTTFF\n0 0\n\nSample Output 5\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning counterclockwise in the second T.\n\nSample Input 6\n\nTTTT\n1 0\n\nSample Output 6\n\nNo", "sample_input": "FTFFTFFF\n4 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03490", "source_text": "Score : 500 points\n\nProblem Statement\n\nA robot is put at the origin in a two-dimensional plane.\nInitially, the robot is facing in the positive x-axis direction.\n\nThis robot will be given an instruction sequence s.\ns consists of the following two kinds of letters, and will be executed in order from front to back.\n\nF : Move in the current direction by distance 1.\n\nT : Turn 90 degrees, either clockwise or counterclockwise.\n\nThe objective of the robot is to be at coordinates (x, y) after all the instructions are executed.\nDetermine whether this objective is achievable.\n\nConstraints\n\ns consists of F and T.\n\n1 \\leq |s| \\leq 8 000\n\nx and y are integers.\n\n|x|, |y| \\leq |s|\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nx y\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\nFTFFTFFF\n4 2\n\nSample Output 1\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning clockwise in the second T.\n\nSample Input 2\n\nFTFFTFFF\n-2 -2\n\nSample Output 2\n\nYes\n\nThe objective can be achieved by, for example, turning clockwise in the first T and turning clockwise in the second T.\n\nSample Input 3\n\nFF\n1 0\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nTF\n1 0\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nFFTTFF\n0 0\n\nSample Output 5\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning counterclockwise in the second T.\n\nSample Input 6\n\nTTTT\n1 0\n\nSample Output 6\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1080, "cpu_time_ms": 464, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s942346277", "group_id": "codeNet:p03494", "input_text": "var n,i,max:longint;\na:array[1..200]of longint;\nb:boolean;\nbegin\nreadln(n);\nfor i:=1 to n do read(a[i]);\nb:=true;\nmax:=0;\nwhile b do\nbegin\nb:=true;\nfor i:=1 to n do if a[i]mod 10 mod 2=1 then b:=false;\nif b then max:=max+1;\nend;\nwrite(max);\nend.", "language": "Pascal", "metadata": {"date": 1524413717, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Pascal/s942346277.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s942346277", "user_id": "u723721005"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,i,max:longint;\na:array[1..200]of longint;\nb:boolean;\nbegin\nreadln(n);\nfor i:=1 to n do read(a[i]);\nb:=true;\nmax:=0;\nwhile b do\nbegin\nb:=true;\nfor i:=1 to n do if a[i]mod 10 mod 2=1 then b:=false;\nif b then max:=max+1;\nend;\nwrite(max);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s254696423", "group_id": "codeNet:p03494", "input_text": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n fx,g,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;\n l:array of Integer;\n //l,l1,l2:int64;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\n c1,c2,c3:char;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n SetLength(l,n);\n for i := 0 to n - 1 do\n Read(l[i]);\n\n count:=0;\n while True do begin\n for i := 0 to n - 1 do begin\n if l[i] mod 2 <> 0 then begin\n Writeln(count);\n Readln;\n Readln;\n exit;\n end;\n l[i]:=l[i] div 2;\n end;\n Inc(count);\n end;\n\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1517424226, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Pascal/s254696423.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s254696423", "user_id": "u755925739"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n fx,g,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;\n l:array of Integer;\n //l,l1,l2:int64;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\n c1,c2,c3:char;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n SetLength(l,n);\n for i := 0 to n - 1 do\n Read(l[i]);\n\n count:=0;\n while True do begin\n for i := 0 to n - 1 do begin\n if l[i] mod 2 <> 0 then begin\n Writeln(count);\n Readln;\n Readln;\n exit;\n end;\n l[i]:=l[i] div 2;\n end;\n Inc(count);\n end;\n\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 819, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s501992696", "group_id": "codeNet:p03495", "input_text": "var\n x,max,min,i,n,k,s:longint;\n sum:int64;\n a,b:array[0..200001] of longint;\nprocedure kp(l,r:longint);\nvar\n i,j,t,m:longint;\nbegin\n i:=l; j:=r;\n m:=a[(l+r) div 2];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if lmax then max:=x;\n if x0 then \n begin\n inc(s); \n a[s]:=b[i];\n end;\n kp(1,s);\n for i:=1 to abs(s-k) do\n sum:=sum+a[i];\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1538182538, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03495.html", "problem_id": "p03495", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03495/input.txt", "sample_output_relpath": "derived/input_output/data/p03495/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03495/Pascal/s501992696.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s501992696", "user_id": "u263933075"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n x,max,min,i,n,k,s:longint;\n sum:int64;\n a,b:array[0..200001] of longint;\nprocedure kp(l,r:longint);\nvar\n i,j,t,m:longint;\nbegin\n i:=l; j:=r;\n m:=a[(l+r) div 2];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if lmax then max:=x;\n if x0 then \n begin\n inc(s); \n a[s]:=b[i];\n end;\n kp(1,s);\n for i:=1 to abs(s-k) do\n sum:=sum+a[i];\n writeln(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "sample_input": "5 2\n1 1 2 2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03495", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 680, "cpu_time_ms": 31, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s889426947", "group_id": "codeNet:p03497", "input_text": "var\n\tN,K,ans,i,A:Longint;\n\tcnt:Array[1..200000]of Longint;\n\tbck:Array[0..200000]of Longint;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do begin\n\t\tread(A);\n\t\tinc(cnt[A]);\n\tend;\n\tfor i:=1 to N do inc(bck[cnt[i]]);\n\tfor i:=N downto 1 do begin\n\t\twhile bck[i]>0 do begin\n\t\t\tdec(bck[i]);\n\t\t\tif K>0 then dec(K) else inc(ans,i);\n\t\tend;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1582185455, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03497.html", "problem_id": "p03497", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03497/input.txt", "sample_output_relpath": "derived/input_output/data/p03497/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03497/Pascal/s889426947.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s889426947", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tN,K,ans,i,A:Longint;\n\tcnt:Array[1..200000]of Longint;\n\tbck:Array[0..200000]of Longint;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do begin\n\t\tread(A);\n\t\tinc(cnt[A]);\n\tend;\n\tfor i:=1 to N do inc(bck[cnt[i]]);\n\tfor i:=N downto 1 do begin\n\t\twhile bck[i]>0 do begin\n\t\t\tdec(bck[i]);\n\t\t\tif K>0 then dec(K) else inc(ans,i);\n\t\tend;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "sample_input": "5 2\n1 1 2 2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03497", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s865131398", "group_id": "codeNet:p03497", "input_text": "var n,k:longint;\n i:longint;\n x:longint;\n c:array[0..205000]of longint;\n max,num:longint;\nprocedure qs(l,r:longint);\nvar i,j,m,t:longint;\nbegin\n i:=l;\n j:=r;\n m:=c[(l+r)>>1];\n repeat\n while c[i]m do dec(j);\n if i<=j then\n begin\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if lmax then max:=x;\n end;\n k:=-k;\n qs(1,max);\n num:=0;\n for i:=1 to max+1 do\n begin\n if k<=0 then\n begin\n writeln(num);\n exit;\n end;\n dec(k);\n inc(num,c[i]);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1512958709, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03497.html", "problem_id": "p03497", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03497/input.txt", "sample_output_relpath": "derived/input_output/data/p03497/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03497/Pascal/s865131398.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s865131398", "user_id": "u809476955"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,k:longint;\n i:longint;\n x:longint;\n c:array[0..205000]of longint;\n max,num:longint;\nprocedure qs(l,r:longint);\nvar i,j,m,t:longint;\nbegin\n i:=l;\n j:=r;\n m:=c[(l+r)>>1];\n repeat\n while c[i]m do dec(j);\n if i<=j then\n begin\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if lmax then max:=x;\n end;\n k:=-k;\n qs(1,max);\n num:=0;\n for i:=1 to max+1 do\n begin\n if k<=0 then\n begin\n writeln(num);\n exit;\n end;\n dec(k);\n inc(num,c[i]);\n end;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "sample_input": "5 2\n1 1 2 2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03497", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 725, "cpu_time_ms": 31, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s490066900", "group_id": "codeNet:p03502", "input_text": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n fx,g,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;\n //l:array of Integer;\n l,l1,l2:int64;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\n xc,yc,space:char;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(s);\n fx:=0;\n\n for i := 1 to Length(s) do\n fx:=fx+StrToInt(s[1]);\n\n if StrToInt(s) mod fx =0 then\n Writeln('Yes')\n else\n Writeln('No');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1517416975, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03502.html", "problem_id": "p03502", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03502/input.txt", "sample_output_relpath": "derived/input_output/data/p03502/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03502/Pascal/s490066900.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s490066900", "user_id": "u755925739"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n fx,g,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;\n //l:array of Integer;\n l,l1,l2:int64;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\n xc,yc,space:char;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(s);\n fx:=0;\n\n for i := 1 to Length(s) do\n fx:=fx+StrToInt(s[1]);\n\n if StrToInt(s) mod fx =0 then\n Writeln('Yes')\n else\n Writeln('No');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.\n\nGiven an integer N, determine whether it is a Harshad number.\n\nConstraints\n\n1?N?10^8\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint Yes if N is a Harshad number; print No otherwise.\n\nSample Input 1\n\n12\n\nSample Output 1\n\nYes\n\nf(12)=1+2=3. Since 12 is divisible by 3, 12 is a Harshad number.\n\nSample Input 2\n\n57\n\nSample Output 2\n\nNo\n\nf(57)=5+7=12. Since 57 is not divisible by 12, 12 is not a Harshad number.\n\nSample Input 3\n\n148\n\nSample Output 3\n\nNo", "sample_input": "12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03502", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.\n\nGiven an integer N, determine whether it is a Harshad number.\n\nConstraints\n\n1?N?10^8\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint Yes if N is a Harshad number; print No otherwise.\n\nSample Input 1\n\n12\n\nSample Output 1\n\nYes\n\nf(12)=1+2=3. Since 12 is divisible by 3, 12 is a Harshad number.\n\nSample Input 2\n\n57\n\nSample Output 2\n\nNo\n\nf(57)=5+7=12. Since 57 is not divisible by 12, 12 is not a Harshad number.\n\nSample Input 3\n\n148\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 646, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s805537857", "group_id": "codeNet:p03503", "input_text": "var n,x,ans,ma,m2,d,m3,da,nn:int64;\nvar i,j:longint;\nvar a,b:array[0..1000] of int64;\nfunction max(a,b:int64):int64;\nbegin\n if a>b then exit(a);exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a);exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a);exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a);exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n if (x>ma) or ((x=ma) and (ma-b[da]m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a) else exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do\n begin\n read(x);\n inc(num[i],x);\n end;\n for i:=1 to n do\n for j:=0 to 10 do\n read(c[i,j]);\n toinc:=-maxlongint;\n for i:=1 to n do\n begin\n x:=-maxlongint;\n for j:=0 to num[i] do\n begin\n if xtoinc then toinc:=-x+c[i,j];\n end;\n if where<>0 then use:=true;\n inc(ans,x);\n end;\n if not use then ans:=ans+toinc;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1512355322, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03503.html", "problem_id": "p03503", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03503/input.txt", "sample_output_relpath": "derived/input_output/data/p03503/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03503/Pascal/s249462030.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s249462030", "user_id": "u165920140"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var i,j:longint;\n num:array[0..250]of longint;\n c:array[0..250,0..20]of longint;\n x,cut,toinc,where:longint;\n use:boolean;\n n:longint;\n ans:int64;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do\n begin\n read(x);\n inc(num[i],x);\n end;\n for i:=1 to n do\n for j:=0 to 10 do\n read(c[i,j]);\n toinc:=-maxlongint;\n for i:=1 to n do\n begin\n x:=-maxlongint;\n for j:=0 to num[i] do\n begin\n if xtoinc then toinc:=-x+c[i,j];\n end;\n if where<>0 then use:=true;\n inc(ans,x);\n end;\n if not use then ans:=ans+toinc;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\n\nThere are already N stores in the street, numbered 1 through N.\n\nYou are given information of the business hours of those shops, F_{i,j,k}. If F_{i,j,k}=1, Shop i is open during Period k on Day j (this notation is explained below); if F_{i,j,k}=0, Shop i is closed during that period. Here, the days of the week are denoted as follows. Monday: Day 1, Tuesday: Day 2, Wednesday: Day 3, Thursday: Day 4, Friday: Day 5. Also, the morning is denoted as Period 1, and the afternoon is denoted as Period 2.\n\nLet c_i be the number of periods during which both Shop i and Joisino's shop are open. Then, the profit of Joisino's shop will be P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}.\n\nFind the maximum possible profit of Joisino's shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\n\nConstraints\n\n1≤N≤100\n\n0≤F_{i,j,k}≤1\n\nFor every integer i such that 1≤i≤N, there exists at least one pair (j,k) such that F_{i,j,k}=1.\n\n-10^7≤P_{i,j}≤10^7\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nF_{1,1,1} F_{1,1,2} ... F_{1,5,1} F_{1,5,2}\n:\nF_{N,1,1} F_{N,1,2} ... F_{N,5,1} F_{N,5,2}\nP_{1,0} ... P_{1,10}\n:\nP_{N,0} ... P_{N,10}\n\nOutput\n\nPrint the maximum possible profit of Joisino's shop.\n\nSample Input 1\n\n1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n\nSample Output 1\n\n8\n\nIf her shop is open only during the periods when Shop 1 is opened, the profit will be 8, which is the maximum possible profit.\n\nSample Input 2\n\n2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n\nSample Output 2\n\n-2\n\nNote that a shop must be open during at least one period, and the profit may be negative.\n\nSample Input 3\n\n3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\n\nSample Output 3\n\n23", "sample_input": "1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03503", "source_text": "Score : 300 points\n\nProblem Statement\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\n\nThere are already N stores in the street, numbered 1 through N.\n\nYou are given information of the business hours of those shops, F_{i,j,k}. If F_{i,j,k}=1, Shop i is open during Period k on Day j (this notation is explained below); if F_{i,j,k}=0, Shop i is closed during that period. Here, the days of the week are denoted as follows. Monday: Day 1, Tuesday: Day 2, Wednesday: Day 3, Thursday: Day 4, Friday: Day 5. Also, the morning is denoted as Period 1, and the afternoon is denoted as Period 2.\n\nLet c_i be the number of periods during which both Shop i and Joisino's shop are open. Then, the profit of Joisino's shop will be P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}.\n\nFind the maximum possible profit of Joisino's shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\n\nConstraints\n\n1≤N≤100\n\n0≤F_{i,j,k}≤1\n\nFor every integer i such that 1≤i≤N, there exists at least one pair (j,k) such that F_{i,j,k}=1.\n\n-10^7≤P_{i,j}≤10^7\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nF_{1,1,1} F_{1,1,2} ... F_{1,5,1} F_{1,5,2}\n:\nF_{N,1,1} F_{N,1,2} ... F_{N,5,1} F_{N,5,2}\nP_{1,0} ... P_{1,10}\n:\nP_{N,0} ... P_{N,10}\n\nOutput\n\nPrint the maximum possible profit of Joisino's shop.\n\nSample Input 1\n\n1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n\nSample Output 1\n\n8\n\nIf her shop is open only during the periods when Shop 1 is opened, the profit will be 8, which is the maximum possible profit.\n\nSample Input 2\n\n2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n\nSample Output 2\n\n-2\n\nNote that a shop must be open during at least one period, and the profit may be negative.\n\nSample Input 3\n\n3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 843, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s902202484", "group_id": "codeNet:p03503", "input_text": "uses math;\nvar n,i,j,x,y,ans,ma,m2,d:longint;\nvar a:array[0..1000] of longint;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-maxlongint;d:=-1;\n for i:=1 to n do\n begin\n m2:=-maxlongint;\n for j:=0 to 10 do begin read(x);if j<=a[i] then\n begin if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then ma:=max(ma,x);end;end;\n inc(ans,m2);\n end;\n if d=0 then inc(ans,ma);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1512354443, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03503.html", "problem_id": "p03503", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03503/input.txt", "sample_output_relpath": "derived/input_output/data/p03503/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03503/Pascal/s902202484.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s902202484", "user_id": "u379604713"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "uses math;\nvar n,i,j,x,y,ans,ma,m2,d:longint;\nvar a:array[0..1000] of longint;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-maxlongint;d:=-1;\n for i:=1 to n do\n begin\n m2:=-maxlongint;\n for j:=0 to 10 do begin read(x);if j<=a[i] then\n begin if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then ma:=max(ma,x);end;end;\n inc(ans,m2);\n end;\n if d=0 then inc(ans,ma);\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\n\nThere are already N stores in the street, numbered 1 through N.\n\nYou are given information of the business hours of those shops, F_{i,j,k}. If F_{i,j,k}=1, Shop i is open during Period k on Day j (this notation is explained below); if F_{i,j,k}=0, Shop i is closed during that period. Here, the days of the week are denoted as follows. Monday: Day 1, Tuesday: Day 2, Wednesday: Day 3, Thursday: Day 4, Friday: Day 5. Also, the morning is denoted as Period 1, and the afternoon is denoted as Period 2.\n\nLet c_i be the number of periods during which both Shop i and Joisino's shop are open. Then, the profit of Joisino's shop will be P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}.\n\nFind the maximum possible profit of Joisino's shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\n\nConstraints\n\n1≤N≤100\n\n0≤F_{i,j,k}≤1\n\nFor every integer i such that 1≤i≤N, there exists at least one pair (j,k) such that F_{i,j,k}=1.\n\n-10^7≤P_{i,j}≤10^7\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nF_{1,1,1} F_{1,1,2} ... F_{1,5,1} F_{1,5,2}\n:\nF_{N,1,1} F_{N,1,2} ... F_{N,5,1} F_{N,5,2}\nP_{1,0} ... P_{1,10}\n:\nP_{N,0} ... P_{N,10}\n\nOutput\n\nPrint the maximum possible profit of Joisino's shop.\n\nSample Input 1\n\n1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n\nSample Output 1\n\n8\n\nIf her shop is open only during the periods when Shop 1 is opened, the profit will be 8, which is the maximum possible profit.\n\nSample Input 2\n\n2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n\nSample Output 2\n\n-2\n\nNote that a shop must be open during at least one period, and the profit may be negative.\n\nSample Input 3\n\n3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\n\nSample Output 3\n\n23", "sample_input": "1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03503", "source_text": "Score : 300 points\n\nProblem Statement\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole period, or closed during the whole period. Naturally, a shop must be open during at least one of those periods.\n\nThere are already N stores in the street, numbered 1 through N.\n\nYou are given information of the business hours of those shops, F_{i,j,k}. If F_{i,j,k}=1, Shop i is open during Period k on Day j (this notation is explained below); if F_{i,j,k}=0, Shop i is closed during that period. Here, the days of the week are denoted as follows. Monday: Day 1, Tuesday: Day 2, Wednesday: Day 3, Thursday: Day 4, Friday: Day 5. Also, the morning is denoted as Period 1, and the afternoon is denoted as Period 2.\n\nLet c_i be the number of periods during which both Shop i and Joisino's shop are open. Then, the profit of Joisino's shop will be P_{1,c_1}+P_{2,c_2}+...+P_{N,c_N}.\n\nFind the maximum possible profit of Joisino's shop when she decides whether her shop is open during each period, making sure that it is open during at least one period.\n\nConstraints\n\n1≤N≤100\n\n0≤F_{i,j,k}≤1\n\nFor every integer i such that 1≤i≤N, there exists at least one pair (j,k) such that F_{i,j,k}=1.\n\n-10^7≤P_{i,j}≤10^7\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nF_{1,1,1} F_{1,1,2} ... F_{1,5,1} F_{1,5,2}\n:\nF_{N,1,1} F_{N,1,2} ... F_{N,5,1} F_{N,5,2}\nP_{1,0} ... P_{1,10}\n:\nP_{N,0} ... P_{N,10}\n\nOutput\n\nPrint the maximum possible profit of Joisino's shop.\n\nSample Input 1\n\n1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2\n\nSample Output 1\n\n8\n\nIf her shop is open only during the periods when Shop 1 is opened, the profit will be 8, which is the maximum possible profit.\n\nSample Input 2\n\n2\n1 1 1 1 1 0 0 0 0 0\n0 0 0 0 0 1 1 1 1 1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1\n\nSample Output 2\n\n-2\n\nNote that a shop must be open during at least one period, and the profit may be negative.\n\nSample Input 3\n\n3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7\n\nSample Output 3\n\n23", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s693560946", "group_id": "codeNet:p03512", "input_text": "var\n n,k,i,j,x,max,y:longint;\n a:array[0..50000000] of longint;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n k:=50000000 div n;\n for i:=1 to n do\n begin\n readln(x,y);\n for j:=1 to k do\n if j mod x=0 then a[j]:=a[j]+y;\n end;\n max:=0;\n for i:=1 to k do\n if a[i]>max then max:=a[i];\n writeln(max);\nend.", "language": "Pascal", "metadata": {"date": 1530846724, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03512.html", "problem_id": "p03512", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03512/input.txt", "sample_output_relpath": "derived/input_output/data/p03512/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03512/Pascal/s693560946.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s693560946", "user_id": "u603541616"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var\n n,k,i,j,x,max,y:longint;\n a:array[0..50000000] of longint;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n k:=50000000 div n;\n for i:=1 to n do\n begin\n readln(x,y);\n for j:=1 to k do\n if j mod x=0 then a[j]:=a[j]+y;\n end;\n max:=0;\n for i:=1 to k do\n if a[i]>max then max:=a[i];\n writeln(max);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nConsider an infinite sequence a_1, a_2, … Initially, the values of all the terms are 0, and from this state we will sequentially perform Q operations. The i-th operation (1 ≤ i ≤ Q) is as follows:\n\nFor every positive integer j, add x_i to the value of a_{j × m_i}.\n\nFind the value of the largest term after these Q operations.\n\nConstraints\n\n1 ≤ Q ≤ 299\n\n2 ≤ m_i ≤ 300\n\n-10^6 ≤ x_i ≤ 10^6\n\nAll m_i are distinct.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nm_1 x_1\n:\nm_Q x_Q\n\nOutput\n\nPrint the value of the largest term after the Q operations.\n\nSample Input 1\n\n3\n2 10\n3 -20\n6 15\n\nSample Output 1\n\n10\n\nThe values of each terms in the sequence a_1, a_2, … change as follows:\n\nBefore the operations: 0, 0, 0, 0, 0, 0, …\n\nAfter the 1-st operation: 0, 10, 0, 10, 0, 10, …\n\nAfter the 2-nd operation: 0, 10, -20, 10, 0, -10, …\n\nAfter the 3-rd operation: 0, 10, -20, 10, 0, 5, …\n\nThe value of the largest term after all the operations is 10.\n\nSample Input 2\n\n3\n10 -3\n50 4\n100 -5\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n56 114834\n72 -149861\n100 190757\n192 -132693\n240 133108\n\nSample Output 3\n\n438699", "sample_input": "3\n2 10\n3 -20\n6 15\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03512", "source_text": "Score : 100 points\n\nProblem Statement\n\nConsider an infinite sequence a_1, a_2, … Initially, the values of all the terms are 0, and from this state we will sequentially perform Q operations. The i-th operation (1 ≤ i ≤ Q) is as follows:\n\nFor every positive integer j, add x_i to the value of a_{j × m_i}.\n\nFind the value of the largest term after these Q operations.\n\nConstraints\n\n1 ≤ Q ≤ 299\n\n2 ≤ m_i ≤ 300\n\n-10^6 ≤ x_i ≤ 10^6\n\nAll m_i are distinct.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nm_1 x_1\n:\nm_Q x_Q\n\nOutput\n\nPrint the value of the largest term after the Q operations.\n\nSample Input 1\n\n3\n2 10\n3 -20\n6 15\n\nSample Output 1\n\n10\n\nThe values of each terms in the sequence a_1, a_2, … change as follows:\n\nBefore the operations: 0, 0, 0, 0, 0, 0, …\n\nAfter the 1-st operation: 0, 10, 0, 10, 0, 10, …\n\nAfter the 2-nd operation: 0, 10, -20, 10, 0, -10, …\n\nAfter the 3-rd operation: 0, 10, -20, 10, 0, 5, …\n\nThe value of the largest term after all the operations is 10.\n\nSample Input 2\n\n3\n10 -3\n50 4\n100 -5\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n56 114834\n72 -149861\n100 190757\n192 -132693\n240 133108\n\nSample Output 3\n\n438699", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 660, "memory_kb": 195456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s528452113", "group_id": "codeNet:p03512", "input_text": "var\n n,k,i,j,x,max,y:longint;\n a:array[0..20000000] of longint;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n k:=20000000 div n;\n for i:=1 to n do\n begin\n readln(x,y);\n for j:=1 to k do\n if j mod x=0 then a[j]:=a[j]+y;\n end;\n max:=0;\n for i:=1 to k do\n if a[i]>max then max:=a[i];\n writeln(max);\nend.", "language": "Pascal", "metadata": {"date": 1530846456, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03512.html", "problem_id": "p03512", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03512/input.txt", "sample_output_relpath": "derived/input_output/data/p03512/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03512/Pascal/s528452113.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s528452113", "user_id": "u603541616"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var\n n,k,i,j,x,max,y:longint;\n a:array[0..20000000] of longint;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n k:=20000000 div n;\n for i:=1 to n do\n begin\n readln(x,y);\n for j:=1 to k do\n if j mod x=0 then a[j]:=a[j]+y;\n end;\n max:=0;\n for i:=1 to k do\n if a[i]>max then max:=a[i];\n writeln(max);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nConsider an infinite sequence a_1, a_2, … Initially, the values of all the terms are 0, and from this state we will sequentially perform Q operations. The i-th operation (1 ≤ i ≤ Q) is as follows:\n\nFor every positive integer j, add x_i to the value of a_{j × m_i}.\n\nFind the value of the largest term after these Q operations.\n\nConstraints\n\n1 ≤ Q ≤ 299\n\n2 ≤ m_i ≤ 300\n\n-10^6 ≤ x_i ≤ 10^6\n\nAll m_i are distinct.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nm_1 x_1\n:\nm_Q x_Q\n\nOutput\n\nPrint the value of the largest term after the Q operations.\n\nSample Input 1\n\n3\n2 10\n3 -20\n6 15\n\nSample Output 1\n\n10\n\nThe values of each terms in the sequence a_1, a_2, … change as follows:\n\nBefore the operations: 0, 0, 0, 0, 0, 0, …\n\nAfter the 1-st operation: 0, 10, 0, 10, 0, 10, …\n\nAfter the 2-nd operation: 0, 10, -20, 10, 0, -10, …\n\nAfter the 3-rd operation: 0, 10, -20, 10, 0, 5, …\n\nThe value of the largest term after all the operations is 10.\n\nSample Input 2\n\n3\n10 -3\n50 4\n100 -5\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n56 114834\n72 -149861\n100 190757\n192 -132693\n240 133108\n\nSample Output 3\n\n438699", "sample_input": "3\n2 10\n3 -20\n6 15\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03512", "source_text": "Score : 100 points\n\nProblem Statement\n\nConsider an infinite sequence a_1, a_2, … Initially, the values of all the terms are 0, and from this state we will sequentially perform Q operations. The i-th operation (1 ≤ i ≤ Q) is as follows:\n\nFor every positive integer j, add x_i to the value of a_{j × m_i}.\n\nFind the value of the largest term after these Q operations.\n\nConstraints\n\n1 ≤ Q ≤ 299\n\n2 ≤ m_i ≤ 300\n\n-10^6 ≤ x_i ≤ 10^6\n\nAll m_i are distinct.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nm_1 x_1\n:\nm_Q x_Q\n\nOutput\n\nPrint the value of the largest term after the Q operations.\n\nSample Input 1\n\n3\n2 10\n3 -20\n6 15\n\nSample Output 1\n\n10\n\nThe values of each terms in the sequence a_1, a_2, … change as follows:\n\nBefore the operations: 0, 0, 0, 0, 0, 0, …\n\nAfter the 1-st operation: 0, 10, 0, 10, 0, 10, …\n\nAfter the 2-nd operation: 0, 10, -20, 10, 0, -10, …\n\nAfter the 3-rd operation: 0, 10, -20, 10, 0, 5, …\n\nThe value of the largest term after all the operations is 10.\n\nSample Input 2\n\n3\n10 -3\n50 4\n100 -5\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n56 114834\n72 -149861\n100 190757\n192 -132693\n240 133108\n\nSample Output 3\n\n438699", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 265, "memory_kb": 78336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s164263124", "group_id": "codeNet:p03526", "input_text": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst inf = 1061109567;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, ans: int32;\n h, p: array [0 .. 5005] of int32;\n dp: array [0 .. 5005] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (h[i] + p[i]) < (h[j] + p[j]);\nend;\nprocedure qsort_swap(i, j: int32);\n var _swap_tmp: int32;\nbegin\n _swap_tmp := h[i]; h[i] := h[j]; h[j] := _swap_tmp;\n _swap_tmp := p[i]; p[i] := p[j]; p[j] := _swap_tmp;\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'1.out'); rewrite(output);\n randseed := 6714;\n \n readln(n);\n for i := 1 to n do begin\n readln(h[i], p[i]);\n end;\n qsort(1, n);\n \n fillchar(dp, sizeof(dp), 63);\n dp[0] := 0;\n for i := 1 to n do begin\n for j := i - 1 downto 0 do begin\n if (dp[j] <= h[i]) and (dp[j + 1] > dp[j] + p[i]) then begin\n dp[j + 1] := dp[j] + p[i];\n end;\n end;\n end;\n \n ans := 0;\n for i := 0 to n do begin\n if (dp[i] < 1000000000000000000) then begin\n ans := i;\n end;\n end;\n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1583799825, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03526.html", "problem_id": "p03526", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03526/input.txt", "sample_output_relpath": "derived/input_output/data/p03526/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03526/Pascal/s164263124.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s164263124", "user_id": "u144695182"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst inf = 1061109567;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, ans: int32;\n h, p: array [0 .. 5005] of int32;\n dp: array [0 .. 5005] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (h[i] + p[i]) < (h[j] + p[j]);\nend;\nprocedure qsort_swap(i, j: int32);\n var _swap_tmp: int32;\nbegin\n _swap_tmp := h[i]; h[i] := h[j]; h[j] := _swap_tmp;\n _swap_tmp := p[i]; p[i] := p[j]; p[j] := _swap_tmp;\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'1.out'); rewrite(output);\n randseed := 6714;\n \n readln(n);\n for i := 1 to n do begin\n readln(h[i], p[i]);\n end;\n qsort(1, n);\n \n fillchar(dp, sizeof(dp), 63);\n dp[0] := 0;\n for i := 1 to n do begin\n for j := i - 1 downto 0 do begin\n if (dp[j] <= h[i]) and (dp[j + 1] > dp[j] + p[i]) then begin\n dp[j + 1] := dp[j] + p[i];\n end;\n end;\n end;\n \n ans := 0;\n for i := 0 to n do begin\n if (dp[i] < 1000000000000000000) then begin\n ans := i;\n end;\n end;\n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nIn the final of CODE FESTIVAL in some year, there are N participants.\nThe height and power of Participant i is H_i and P_i, respectively.\n\nRingo is hosting a game of stacking zabuton (cushions).\n\nThe participants will line up in a row in some order, and they will in turn try to add zabuton to the stack of zabuton.\nInitially, the stack is empty.\nWhen it is Participant i's turn, if there are H_i or less zabuton already stacked, he/she will add exactly P_i zabuton to the stack. Otherwise, he/she will give up and do nothing.\n\nRingo wants to maximize the number of participants who can add zabuton to the stack.\nHow many participants can add zabuton to the stack in the optimal order of participants?\n\nConstraints\n\n1 \\leq N \\leq 5000\n\n0 \\leq H_i \\leq 10^9\n\n1 \\leq P_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 P_1\nH_2 P_2\n:\nH_N P_N\n\nOutput\n\nPrint the maximum number of participants who can add zabuton to the stack.\n\nSample Input 1\n\n3\n0 2\n1 3\n3 4\n\nSample Output 1\n\n2\n\nWhen the participants line up in the same order as the input, Participants 1 and 3 will be able to add zabuton.\n\nOn the other hand, there is no order such that all three participants can add zabuton. Thus, the answer is 2.\n\nSample Input 2\n\n3\n2 4\n3 1\n4 1\n\nSample Output 2\n\n3\n\nWhen the participants line up in the order 2, 3, 1, all of them will be able to add zabuton.\n\nSample Input 3\n\n10\n1 3\n8 4\n8 3\n9 1\n6 4\n2 3\n4 2\n9 2\n8 3\n0 1\n\nSample Output 3\n\n5", "sample_input": "3\n0 2\n1 3\n3 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03526", "source_text": "Score : 700 points\n\nProblem Statement\n\nIn the final of CODE FESTIVAL in some year, there are N participants.\nThe height and power of Participant i is H_i and P_i, respectively.\n\nRingo is hosting a game of stacking zabuton (cushions).\n\nThe participants will line up in a row in some order, and they will in turn try to add zabuton to the stack of zabuton.\nInitially, the stack is empty.\nWhen it is Participant i's turn, if there are H_i or less zabuton already stacked, he/she will add exactly P_i zabuton to the stack. Otherwise, he/she will give up and do nothing.\n\nRingo wants to maximize the number of participants who can add zabuton to the stack.\nHow many participants can add zabuton to the stack in the optimal order of participants?\n\nConstraints\n\n1 \\leq N \\leq 5000\n\n0 \\leq H_i \\leq 10^9\n\n1 \\leq P_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 P_1\nH_2 P_2\n:\nH_N P_N\n\nOutput\n\nPrint the maximum number of participants who can add zabuton to the stack.\n\nSample Input 1\n\n3\n0 2\n1 3\n3 4\n\nSample Output 1\n\n2\n\nWhen the participants line up in the same order as the input, Participants 1 and 3 will be able to add zabuton.\n\nOn the other hand, there is no order such that all three participants can add zabuton. Thus, the answer is 2.\n\nSample Input 2\n\n3\n2 4\n3 1\n4 1\n\nSample Output 2\n\n3\n\nWhen the participants line up in the order 2, 3, 1, all of them will be able to add zabuton.\n\nSample Input 3\n\n10\n1 3\n8 4\n8 3\n9 1\n6 4\n2 3\n4 2\n9 2\n8 3\n0 1\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1552, "cpu_time_ms": 137, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s043500480", "group_id": "codeNet:p03526", "input_text": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst inf = 1061109567;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, ans: int32;\n h, p: array [0 .. 5005] of int32;\n dp: array [0 .. 5005] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (h[i] + p[i] < h[j] + p[j]);\nend;\nprocedure qsort_swap(i, j: int32);\n var _swap_tmp: int32;\nbegin\n _swap_tmp := h[i]; h[i] := h[j]; h[j] := _swap_tmp;\n _swap_tmp := p[i]; p[i] := p[j]; p[j] := _swap_tmp;\nend;\nprocedure qsort(l, h: int32);\n var i, j, p: int32;\nbegin\n i := l; j := h;\n p := l + random(h - l + 1);\n repeat\n while qsort_less(i, p) do inc(i);\n while qsort_less(p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < h) then qsort(i, h);\n if (j > l) then qsort(l, j);\nend;\n\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randseed := 6714;\n \n readln(n);\n for i := 1 to n do begin\n readln(h[i], p[i]);\n end;\n qsort(1, n);\n \n fillchar(dp, sizeof(dp), 63);\n dp[0] := 0;\n for i := 1 to n do begin\n for j := i - 1 downto 0 do begin\n if (dp[j] <= h[i]) and (dp[j + 1] > dp[j] + p[i]) then begin\n dp[j + 1] := dp[j] + p[i];\n end;\n end;\n end;\n \n ans := 0;\n for i := 0 to n do begin\n if (dp[i] < 1000000000000000000) then begin\n ans := i;\n end;\n end;\n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1583796848, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03526.html", "problem_id": "p03526", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03526/input.txt", "sample_output_relpath": "derived/input_output/data/p03526/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03526/Pascal/s043500480.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s043500480", "user_id": "u144695182"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "{$R+,S+,Q+,I+,O-}\n{R-,S-,Q-,I-,O+}\n// Code By H~$~C\n\nuses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst inf = 1061109567;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, ans: int32;\n h, p: array [0 .. 5005] of int32;\n dp: array [0 .. 5005] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (h[i] + p[i] < h[j] + p[j]);\nend;\nprocedure qsort_swap(i, j: int32);\n var _swap_tmp: int32;\nbegin\n _swap_tmp := h[i]; h[i] := h[j]; h[j] := _swap_tmp;\n _swap_tmp := p[i]; p[i] := p[j]; p[j] := _swap_tmp;\nend;\nprocedure qsort(l, h: int32);\n var i, j, p: int32;\nbegin\n i := l; j := h;\n p := l + random(h - l + 1);\n repeat\n while qsort_less(i, p) do inc(i);\n while qsort_less(p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < h) then qsort(i, h);\n if (j > l) then qsort(l, j);\nend;\n\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'out'); rewrite(output);\n randseed := 6714;\n \n readln(n);\n for i := 1 to n do begin\n readln(h[i], p[i]);\n end;\n qsort(1, n);\n \n fillchar(dp, sizeof(dp), 63);\n dp[0] := 0;\n for i := 1 to n do begin\n for j := i - 1 downto 0 do begin\n if (dp[j] <= h[i]) and (dp[j + 1] > dp[j] + p[i]) then begin\n dp[j + 1] := dp[j] + p[i];\n end;\n end;\n end;\n \n ans := 0;\n for i := 0 to n do begin\n if (dp[i] < 1000000000000000000) then begin\n ans := i;\n end;\n end;\n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nIn the final of CODE FESTIVAL in some year, there are N participants.\nThe height and power of Participant i is H_i and P_i, respectively.\n\nRingo is hosting a game of stacking zabuton (cushions).\n\nThe participants will line up in a row in some order, and they will in turn try to add zabuton to the stack of zabuton.\nInitially, the stack is empty.\nWhen it is Participant i's turn, if there are H_i or less zabuton already stacked, he/she will add exactly P_i zabuton to the stack. Otherwise, he/she will give up and do nothing.\n\nRingo wants to maximize the number of participants who can add zabuton to the stack.\nHow many participants can add zabuton to the stack in the optimal order of participants?\n\nConstraints\n\n1 \\leq N \\leq 5000\n\n0 \\leq H_i \\leq 10^9\n\n1 \\leq P_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 P_1\nH_2 P_2\n:\nH_N P_N\n\nOutput\n\nPrint the maximum number of participants who can add zabuton to the stack.\n\nSample Input 1\n\n3\n0 2\n1 3\n3 4\n\nSample Output 1\n\n2\n\nWhen the participants line up in the same order as the input, Participants 1 and 3 will be able to add zabuton.\n\nOn the other hand, there is no order such that all three participants can add zabuton. Thus, the answer is 2.\n\nSample Input 2\n\n3\n2 4\n3 1\n4 1\n\nSample Output 2\n\n3\n\nWhen the participants line up in the order 2, 3, 1, all of them will be able to add zabuton.\n\nSample Input 3\n\n10\n1 3\n8 4\n8 3\n9 1\n6 4\n2 3\n4 2\n9 2\n8 3\n0 1\n\nSample Output 3\n\n5", "sample_input": "3\n0 2\n1 3\n3 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03526", "source_text": "Score : 700 points\n\nProblem Statement\n\nIn the final of CODE FESTIVAL in some year, there are N participants.\nThe height and power of Participant i is H_i and P_i, respectively.\n\nRingo is hosting a game of stacking zabuton (cushions).\n\nThe participants will line up in a row in some order, and they will in turn try to add zabuton to the stack of zabuton.\nInitially, the stack is empty.\nWhen it is Participant i's turn, if there are H_i or less zabuton already stacked, he/she will add exactly P_i zabuton to the stack. Otherwise, he/she will give up and do nothing.\n\nRingo wants to maximize the number of participants who can add zabuton to the stack.\nHow many participants can add zabuton to the stack in the optimal order of participants?\n\nConstraints\n\n1 \\leq N \\leq 5000\n\n0 \\leq H_i \\leq 10^9\n\n1 \\leq P_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 P_1\nH_2 P_2\n:\nH_N P_N\n\nOutput\n\nPrint the maximum number of participants who can add zabuton to the stack.\n\nSample Input 1\n\n3\n0 2\n1 3\n3 4\n\nSample Output 1\n\n2\n\nWhen the participants line up in the same order as the input, Participants 1 and 3 will be able to add zabuton.\n\nOn the other hand, there is no order such that all three participants can add zabuton. Thus, the answer is 2.\n\nSample Input 2\n\n3\n2 4\n3 1\n4 1\n\nSample Output 2\n\n3\n\nWhen the participants line up in the order 2, 3, 1, all of them will be able to add zabuton.\n\nSample Input 3\n\n10\n1 3\n8 4\n8 3\n9 1\n6 4\n2 3\n4 2\n9 2\n8 3\n0 1\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1530, "cpu_time_ms": 137, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s745578988", "group_id": "codeNet:p03544", "input_text": "var x:array[0..100]of Qword;\n i,n:longint;\n begin\n x[0]:=2;\n x[1]:=1;\n readln(n);\n for i:=2 to n do \n x[i]:=x[i-1]+x[i-2];\n writeln(x[n]);\n end.", "language": "Pascal", "metadata": {"date": 1524015668, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03544.html", "problem_id": "p03544", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03544/input.txt", "sample_output_relpath": "derived/input_output/data/p03544/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03544/Pascal/s745578988.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s745578988", "user_id": "u426964396"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "var x:array[0..100]of Qword;\n i,n:longint;\n begin\n x[0]:=2;\n x[1]:=1;\n readln(n);\n for i:=2 to n do \n x[i]:=x[i-1]+x[i-2];\n writeln(x[n]);\n end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIt is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.\n\nYou are given an integer N. Find the N-th Lucas number.\n\nHere, the i-th Lucas number L_i is defined as follows:\n\nL_0=2\n\nL_1=1\n\nL_i=L_{i-1}+L_{i-2} (i≥2)\n\nConstraints\n\n1≤N≤86\n\nIt is guaranteed that the answer is less than 10^{18}.\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the N-th Lucas number.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n11\n\nL_0=2\n\nL_1=1\n\nL_2=L_0+L_1=3\n\nL_3=L_1+L_2=4\n\nL_4=L_2+L_3=7\n\nL_5=L_3+L_4=11\n\nThus, the 5-th Lucas number is 11.\n\nSample Input 2\n\n86\n\nSample Output 2\n\n939587134549734843", "sample_input": "5\n"}, "reference_outputs": ["11\n"], "source_document_id": "p03544", "source_text": "Score : 200 points\n\nProblem Statement\n\nIt is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.\n\nYou are given an integer N. Find the N-th Lucas number.\n\nHere, the i-th Lucas number L_i is defined as follows:\n\nL_0=2\n\nL_1=1\n\nL_i=L_{i-1}+L_{i-2} (i≥2)\n\nConstraints\n\n1≤N≤86\n\nIt is guaranteed that the answer is less than 10^{18}.\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the N-th Lucas number.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n11\n\nL_0=2\n\nL_1=1\n\nL_2=L_0+L_1=3\n\nL_3=L_1+L_2=4\n\nL_4=L_2+L_3=7\n\nL_5=L_3+L_4=11\n\nThus, the 5-th Lucas number is 11.\n\nSample Input 2\n\n86\n\nSample Output 2\n\n939587134549734843", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s350516452", "group_id": "codeNet:p03545", "input_text": "var\n s,a,b,c,d:longint;\nbegin\n readln(s);\n d:=s mod 10;\n c:=s div 10 mod 10;\n b:=s div 100 mod 10;\n a:=s div 1000;\n if a+b+c-d=7 then writeln(a,'+',b,'+',c,'-',d,'=7') else\n if a+b-c-d=7 then writeln(a,'+',b,'-',c,'-',d,'=7') else\n if a-b-c-d=7 then writeln(a,'-',b,'-',c,'-',d,'=7') else\n if a+b+c+d=7 then writeln(a,'+',b,'+',c,'+',d,'=7') else\n if a+b-c+d=7 then writeln(a,'+',b,'-',c,'+',d,'=7') else\n if a-b-c+d=7 then writeln(a,'-',b,'-',c,'+',d,'=7') else\n if a-b+c-d=7 then writeln(a,'-',b,'+',c,'-',d,'=7');\nend.", "language": "Pascal", "metadata": {"date": 1534615714, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03545.html", "problem_id": "p03545", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03545/input.txt", "sample_output_relpath": "derived/input_output/data/p03545/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03545/Pascal/s350516452.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s350516452", "user_id": "u426964396"}, "prompt_components": {"gold_output": "1+2+2+2=7\n", "input_to_evaluate": "var\n s,a,b,c,d:longint;\nbegin\n readln(s);\n d:=s mod 10;\n c:=s div 10 mod 10;\n b:=s div 100 mod 10;\n a:=s div 1000;\n if a+b+c-d=7 then writeln(a,'+',b,'+',c,'-',d,'=7') else\n if a+b-c-d=7 then writeln(a,'+',b,'-',c,'-',d,'=7') else\n if a-b-c-d=7 then writeln(a,'-',b,'-',c,'-',d,'=7') else\n if a+b+c+d=7 then writeln(a,'+',b,'+',c,'+',d,'=7') else\n if a+b-c+d=7 then writeln(a,'+',b,'-',c,'+',d,'=7') else\n if a-b-c+d=7 then writeln(a,'-',b,'-',c,'+',d,'=7') else\n if a-b+c-d=7 then writeln(a,'-',b,'+',c,'-',d,'=7');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.\n\nThe given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.\n\nConstraints\n\n0≤A,B,C,D≤9\n\nAll input values are integers.\n\nIt is guaranteed that there is a solution.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nABCD\n\nOutput\n\nPrint the formula you made, including the part =7.\n\nUse the signs + and -.\n\nDo not print a space between a digit and a sign.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n1+2+2+2=7\n\nThis is the only valid solution.\n\nSample Input 2\n\n0290\n\nSample Output 2\n\n0-2+9+0=7\n\n0 - 2 + 9 - 0 = 7 is also a valid solution.\n\nSample Input 3\n\n3242\n\nSample Output 3\n\n3+2+4-2=7", "sample_input": "1222\n"}, "reference_outputs": ["1+2+2+2=7\n"], "source_document_id": "p03545", "source_text": "Score : 300 points\n\nProblem Statement\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.\n\nThe given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.\n\nConstraints\n\n0≤A,B,C,D≤9\n\nAll input values are integers.\n\nIt is guaranteed that there is a solution.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nABCD\n\nOutput\n\nPrint the formula you made, including the part =7.\n\nUse the signs + and -.\n\nDo not print a space between a digit and a sign.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n1+2+2+2=7\n\nThis is the only valid solution.\n\nSample Input 2\n\n0290\n\nSample Output 2\n\n0-2+9+0=7\n\n0 - 2 + 9 - 0 = 7 is also a valid solution.\n\nSample Input 3\n\n3242\n\nSample Output 3\n\n3+2+4-2=7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 521, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620501359", "group_id": "codeNet:p03546", "input_text": "var\n\th,w,a,s,i,j,k:Longint;\n\tc:array[0..9,0..9]of Longint;\nbegin\n\tread(h,w);\n\tfor i:=0 to 9 do for j:=0 to 9 do read(c[i,j]);\n\tfor k:=0 to 9 do for i:=0 to 9 do for j:=0 to 9 do if c[i,j]>c[i,k]+c[k,j]then c[i,j]:=c[i,k]+c[k,j];\n\tfor i:=1 to h*w do begin\n\t\tread(a);\n\t\tif a>=0 then inc(s,c[a,1]);\n\tend;\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1543768384, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03546.html", "problem_id": "p03546", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03546/input.txt", "sample_output_relpath": "derived/input_output/data/p03546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03546/Pascal/s620501359.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620501359", "user_id": "u657913472"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var\n\th,w,a,s,i,j,k:Longint;\n\tc:array[0..9,0..9]of Longint;\nbegin\n\tread(h,w);\n\tfor i:=0 to 9 do for j:=0 to 9 do read(c[i,j]);\n\tfor k:=0 to 9 do for i:=0 to 9 do for j:=0 to 9 do if c[i,j]>c[i,k]+c[k,j]then c[i,j]:=c[i,k]+c[k,j];\n\tfor i:=1 to h*w do begin\n\t\tread(a);\n\t\tif a>=0 then inc(s,c[a,1]);\n\tend;\n\twriteln(s);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "sample_input": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03546", "source_text": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 319, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s280314201", "group_id": "codeNet:p03547", "input_text": "var x,c,y:char;\nbegin\nread(x,c,y);\nif ord(x)>ord(y)then writeln('>')else if ord(x)')else if ord(x)')else if ord(x)')else if ord(x)');\n if x=y then writeln('=');\n if xy then writeln('>');\n if x=y then writeln('=');\n if x; if they are equal, print =.\n\nSample Input 1\n\nA B\n\nSample Output 1\n\n<\n\n10 < 11.\n\nSample Input 2\n\nE C\n\nSample Output 2\n\n>\n\n14 > 12.\n\nSample Input 3\n\nF F\n\nSample Output 3\n\n=\n\n15 = 15.", "sample_input": "A B\n"}, "reference_outputs": ["<\n"], "source_document_id": "p03547", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn programming, hexadecimal notation is often used.\n\nIn hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters A, B, C, D, E and F are used to represent the values 10, 11, 12, 13, 14 and 15, respectively.\n\nIn this problem, you are given two letters X and Y. Each X and Y is A, B, C, D, E or F.\n\nWhen X and Y are seen as hexadecimal numbers, which is larger?\n\nConstraints\n\nEach X and Y is A, B, C, D, E or F.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf X is smaller, print <; if Y is smaller, print >; if they are equal, print =.\n\nSample Input 1\n\nA B\n\nSample Output 1\n\n<\n\n10 < 11.\n\nSample Input 2\n\nE C\n\nSample Output 2\n\n>\n\n14 > 12.\n\nSample Input 3\n\nF F\n\nSample Output 3\n\n=\n\n15 = 15.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s959394828", "group_id": "codeNet:p03548", "input_text": "program isu;\nvar x,y,z: integer;\nbegin\n\tread (x,y,z);\n\tx:= x-1;\n\tx:= x div(y+z);\n\twriteln (x);\nend.", "language": "Pascal", "metadata": {"date": 1577255148, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03548.html", "problem_id": "p03548", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03548/input.txt", "sample_output_relpath": "derived/input_output/data/p03548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03548/Pascal/s959394828.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s959394828", "user_id": "u353919145"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program isu;\nvar x,y,z: integer;\nbegin\n\tread (x,y,z);\n\tx:= x-1;\n\tx:= x div(y+z);\n\twriteln (x);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "sample_input": "13 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03548", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 99, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s295418894", "group_id": "codeNet:p03548", "input_text": "program kursi;\nvar\nx,y,z,orang : integer;\nbegin\nreadln(x,y,z);\norang := ((x - z) div (y + z));\nwriteln(orang);\nend.", "language": "Pascal", "metadata": {"date": 1577227309, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03548.html", "problem_id": "p03548", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03548/input.txt", "sample_output_relpath": "derived/input_output/data/p03548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03548/Pascal/s295418894.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s295418894", "user_id": "u353919145"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program kursi;\nvar\nx,y,z,orang : integer;\nbegin\nreadln(x,y,z);\norang := ((x - z) div (y + z));\nwriteln(orang);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "sample_input": "13 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03548", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s210408628", "group_id": "codeNet:p03548", "input_text": "program karosi;\nvar\n\tx, y, z : integer;\nbegin\n\treadln(x, y, z);\n\twrite((x-z) div (y+z) );\nend.", "language": "Pascal", "metadata": {"date": 1577225859, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03548.html", "problem_id": "p03548", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03548/input.txt", "sample_output_relpath": "derived/input_output/data/p03548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03548/Pascal/s210408628.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s210408628", "user_id": "u089230684"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program karosi;\nvar\n\tx, y, z : integer;\nbegin\n\treadln(x, y, z);\n\twrite((x-z) div (y+z) );\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "sample_input": "13 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03548", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 94, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s088687454", "group_id": "codeNet:p03548", "input_text": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n g,l,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;\n //l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\n xc,yc,space:char;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(x);\n Read(y);\n Readln(z);\n Writeln((x-z) div (y+z));\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1517411470, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03548.html", "problem_id": "p03548", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03548/input.txt", "sample_output_relpath": "derived/input_output/data/p03548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03548/Pascal/s088687454.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s088687454", "user_id": "u755925739"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n g,l,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t,z:Integer;\n //l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\n xc,yc,space:char;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(x);\n Read(y);\n Readln(z);\n Writeln((x-z) div (y+z));\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "sample_input": "13 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03548", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\n\nWe would like to seat as many people as possible, but they are all very shy, and there must be a gap of length at least Z centimeters between two people, and between the end of the seat and a person.\n\nAt most how many people can sit on the seat?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq X, Y, Z \\leq 10^5\n\nY+2Z \\leq X\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n13 3 1\n\nSample Output 1\n\n3\n\nThere is just enough room for three, as shown below:\n\nFigure\n\nSample Input 2\n\n12 3 1\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1 1\n\nSample Output 3\n\n49999\n\nSample Input 4\n\n64146 123 456\n\nSample Output 4\n\n110\n\nSample Input 5\n\n64145 123 456\n\nSample Output 5\n\n109", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 526, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s103337398", "group_id": "codeNet:p03549", "input_text": "var n,m,x,i:int64;\nbegin\nread(n,m);\nx:=1;\nfor i:=1 to m do begin x:=x*2;end;\nwriteln(x*100*(18*m+n));\nend.", "language": "Pascal", "metadata": {"date": 1597618274, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03549.html", "problem_id": "p03549", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03549/input.txt", "sample_output_relpath": "derived/input_output/data/p03549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03549/Pascal/s103337398.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s103337398", "user_id": "u984276646"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "var n,m,x,i:int64;\nbegin\nread(n,m);\nx:=1;\nfor i:=1 to m do begin x:=x*2;end;\nwriteln(x*100*(18*m+n));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03549", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 3, "memory_kb": 1360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s571116765", "group_id": "codeNet:p03552", "input_text": "uses Math;\nvar N,Z,W,i,S,T:Longint;\nbegin\nread(N,Z,W);\nfor i:=1 to N do begin\nS:=T;\nread(T);\nend;\nif N=1 then S:=abs(W-T)else S:=max(abs(S-T),abs(T-W));\nwriteln(S);\nend.", "language": "Pascal", "metadata": {"date": 1573538770, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s571116765.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s571116765", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "uses Math;\nvar N,Z,W,i,S,T:Longint;\nbegin\nread(N,Z,W);\nfor i:=1 to N do begin\nS:=T;\nread(T);\nend;\nif N=1 then S:=abs(W-T)else S:=max(abs(S-T),abs(T-W));\nwriteln(S);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s563322836", "group_id": "codeNet:p03552", "input_text": "uses Math;\nvar N,Z,W,i,S,T:Longint;\nbegin\nread(N,Z,W);\nfor i:=1 to N do begin\nS:=T;\nread(T);\nend;\nif N=1 then S:=abs(W-T)else S:=min(abs(S-T),abs(T-W));\nwriteln(S);\nend.", "language": "Pascal", "metadata": {"date": 1573538741, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s563322836.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s563322836", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "uses Math;\nvar N,Z,W,i,S,T:Longint;\nbegin\nread(N,Z,W);\nfor i:=1 to N do begin\nS:=T;\nread(T);\nend;\nif N=1 then S:=abs(W-T)else S:=min(abs(S-T),abs(T-W));\nwriteln(S);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s946636686", "group_id": "codeNet:p03552", "input_text": "Uses math;\nvar\n\tn,i,z,w,a,b,t:Longint;\n\ts:String;\nbegin\n\treadln(n,z,w);\n\tif n=1 then begin\n\t\tread(b);\n\t\twriteln(abs(b-w));\n\t\texit;\n\tend;\n\treadln(s);\n\ti:=length(s);\n\twhile s[i]>' ' do dec(i);\n\tfor z:=i+1 to length(s) do b:=b*10+ord(s[z])-48;\n\tdec(i);\n\tt:=i;\n\twhile(i>0)and(s[i]>' ')do dec(i);\n\tfor z:=i+1 to t do a:=a*10+ord(s[z])-48;\n\twriteln(Max(abs(b-w),abs(a-b)));\nend.\n", "language": "Pascal", "metadata": {"date": 1539816917, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s946636686.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s946636686", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "Uses math;\nvar\n\tn,i,z,w,a,b,t:Longint;\n\ts:String;\nbegin\n\treadln(n,z,w);\n\tif n=1 then begin\n\t\tread(b);\n\t\twriteln(abs(b-w));\n\t\texit;\n\tend;\n\treadln(s);\n\ti:=length(s);\n\twhile s[i]>' ' do dec(i);\n\tfor z:=i+1 to length(s) do b:=b*10+ord(s[z])-48;\n\tdec(i);\n\tt:=i;\n\twhile(i>0)and(s[i]>' ')do dec(i);\n\tfor z:=i+1 to t do a:=a*10+ord(s[z])-48;\n\twriteln(Max(abs(b-w),abs(a-b)));\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s680143314", "group_id": "codeNet:p03552", "input_text": "Uses math;\nvar\n\tn,i,z,w,a,b:Longint;\nbegin\n\tread(n,z,w,b);\n\tif n=1 then begin\n\t\twriteln(abs(b-w));\n\t\texit;\n\tend;\n\tfor i:=2 to n do begin\n\t\ta:=b;\n\t\tread(b);\n\tend;\n\twriteln(Max(abs(b-w),abs(a-b)));\nend.\n", "language": "Pascal", "metadata": {"date": 1539816389, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s680143314.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s680143314", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "Uses math;\nvar\n\tn,i,z,w,a,b:Longint;\nbegin\n\tread(n,z,w,b);\n\tif n=1 then begin\n\t\twriteln(abs(b-w));\n\t\texit;\n\tend;\n\tfor i:=2 to n do begin\n\t\ta:=b;\n\t\tread(b);\n\tend;\n\twriteln(Max(abs(b-w),abs(a-b)));\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s948301344", "group_id": "codeNet:p03552", "input_text": "program HelloWorld;\n var n,z,w:longint;\n var i,j:longint;\n var a:array [1..2000] of longint;\n var sx,sy:array[1..2000]of longint;\n var p,q:longint;\n var turn:boolean;\n var t:longint;\nbegin\n readln(n,z,w);\n for i:=1 to n do read(a[i]);\n for i:=n-1 downto 1 do\n begin\n sx[i]:=0;\n sy[i]:=1000000001;\n for j:=i+1 to n do\n begin\n if abs(a[i]-a[j])>=sx[i] then sx[i]:=abs(a[i]-a[j]);\n if abs(a[i]-a[j])<=sy[i] then sy[i]:=abs(a[i]-a[j]);\n end;\n end;\n p:=0;\n turn:=true;\n if n=1 then\n writeln(abs(w-a[n]))\n else\n begin\n while p<>n do\n begin\n if turn then\n begin\n sy[n]:=abs(a[n]-w);\n t:=abs(a[n]-w);\n for i:=p+1 to n do\n if sy[i]>=t then\n begin\n t:=sy[i];\n q:=i;\n end;\n z:=a[q];\n p:=q;\n turn:=false;\n end\n else\n begin\n sx[n]:=abs(a[n]-z);\n t:=abs(a[n]-z);\n for i:=p+1 to n do\n if sx[i]<=t then\n begin\n t:=sx[i];\n q:=i;\n end;\n w:=a[q];\n p:=q;\n turn:=true;\n end;\n end;\n writeln(abs(z-w));\n end;\nend.", "language": "Pascal", "metadata": {"date": 1510457982, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s948301344.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s948301344", "user_id": "u566971318"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "program HelloWorld;\n var n,z,w:longint;\n var i,j:longint;\n var a:array [1..2000] of longint;\n var sx,sy:array[1..2000]of longint;\n var p,q:longint;\n var turn:boolean;\n var t:longint;\nbegin\n readln(n,z,w);\n for i:=1 to n do read(a[i]);\n for i:=n-1 downto 1 do\n begin\n sx[i]:=0;\n sy[i]:=1000000001;\n for j:=i+1 to n do\n begin\n if abs(a[i]-a[j])>=sx[i] then sx[i]:=abs(a[i]-a[j]);\n if abs(a[i]-a[j])<=sy[i] then sy[i]:=abs(a[i]-a[j]);\n end;\n end;\n p:=0;\n turn:=true;\n if n=1 then\n writeln(abs(w-a[n]))\n else\n begin\n while p<>n do\n begin\n if turn then\n begin\n sy[n]:=abs(a[n]-w);\n t:=abs(a[n]-w);\n for i:=p+1 to n do\n if sy[i]>=t then\n begin\n t:=sy[i];\n q:=i;\n end;\n z:=a[q];\n p:=q;\n turn:=false;\n end\n else\n begin\n sx[n]:=abs(a[n]-z);\n t:=abs(a[n]-z);\n for i:=p+1 to n do\n if sx[i]<=t then\n begin\n t:=sx[i];\n q:=i;\n end;\n w:=a[q];\n p:=q;\n turn:=true;\n end;\n end;\n writeln(abs(z-w));\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1276, "cpu_time_ms": 15, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s860135571", "group_id": "codeNet:p03552", "input_text": "var n,z,w:longint;\n x:longint;\n ans,mx,mn:longint;\n i:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n read(n,z,w);\n mn:=maxlongint;\n for i:=1 to n do\n begin\n read(x);\n if x>mx then mx:=x;\n if xb then exit(a) else exit(b);\nend;\nbegin\n read(n,z,w);\n mn:=maxlongint;\n for i:=1 to n do\n begin\n read(x);\n if x>mx then mx:=x;\n if xb then exit(a) else exit(b);\nend;\nbegin\n read(n,z,w);\n for i:=1 to n do\n begin\n read(x);\n if x>mx then mx:=x;\n end;\n ans:=max(abs(z-x),abs(w-x));\n ans:=max(ans,abs(mx-x));\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1510454169, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s750455497.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s750455497", "user_id": "u139162134"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "var n,z,w:longint;\n x:longint;\n ans,mx:longint;\n i:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n read(n,z,w);\n for i:=1 to n do\n begin\n read(x);\n if x>mx then mx:=x;\n end;\n ans:=max(abs(z-x),abs(w-x));\n ans:=max(ans,abs(mx-x));\n writeln(ans);\nend.\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 323, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s362209858", "group_id": "codeNet:p03553", "input_text": "var\n n,i,j,k:longint;x:int64;\n a:array[1..100] of int64;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n for k:=1 to n*n do\n for i:=n downto 1 do\n begin\n j:=i;x:=0;\n while j<=n do\n begin\n x:=x+a[j];\n j:=j+i;\n end;\n if x<0 then\n begin\n j:=i;\n while j<=n do\n begin\n a[j]:=0;\n j:=j+i;\n end;\n break;\n end;\n end;\n x:=0;\n for i:=1 to n do\n x:=x+a[i];\n write(x);\nend.\n", "language": "Pascal", "metadata": {"date": 1537721149, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03553.html", "problem_id": "p03553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03553/input.txt", "sample_output_relpath": "derived/input_output/data/p03553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03553/Pascal/s362209858.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s362209858", "user_id": "u723721005"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var\n n,i,j,k:longint;x:int64;\n a:array[1..100] of int64;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n for k:=1 to n*n do\n for i:=n downto 1 do\n begin\n j:=i;x:=0;\n while j<=n do\n begin\n x:=x+a[j];\n j:=j+i;\n end;\n if x<0 then\n begin\n j:=i;\n while j<=n do\n begin\n a[j]:=0;\n j:=j+i;\n end;\n break;\n end;\n end;\n x:=0;\n for i:=1 to n do\n x:=x+a[i];\n write(x);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "sample_input": "6\n1 2 -6 4 5 3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03553", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 518, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s037874211", "group_id": "codeNet:p03556", "input_text": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n g,l,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t:Integer;\n //l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n for i := n downto 1 do\n if power(trunc(sqrt(i)),2)=i then begin\n Writeln(i);\n break;\n end;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1517346810, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03556.html", "problem_id": "p03556", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03556/input.txt", "sample_output_relpath": "derived/input_output/data/p03556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03556/Pascal/s037874211.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s037874211", "user_id": "u755925739"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils,math;\nvar\n g,l,r,a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,t:Integer;\n //l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n for i := n downto 1 do\n if power(trunc(sqrt(i)),2)=i then begin\n Writeln(i);\n break;\n end;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03556", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 560, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s581991512", "group_id": "codeNet:p03557", "input_text": "program V1501;\n type\n w=array[0..100001] of longint;\n var\n a,b,c,d,e,f:w;\n i,n,p:longint;\n procedure haha(var a:w;l,r:longint);\n var\n o,p,m,t:longint;\n begin\n o:=l;\n p:=r;\n m:=a[(l+r) div 2];\n repeat\n while a[o]m do dec(p);\n if o<=p then\n begin\n t:=a[o];\n a[o]:=a[p];\n a[p]:=t;\n inc(o);\n dec(p);\n end;\n until o>p;\n if om do dec(p);\n if o<=p then\n begin\n t:=a[o];\n a[o]:=a[p];\n a[p]:=t;\n inc(o);\n dec(p);\n end;\n until o>p;\n if oj) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if lj) then\n begin\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if lj) then\n begin\n y:=c[i];\n c[i]:=c[j];\n c[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if la[i]\n then k:=k+1;\n end;\n for i:=1 to n do \n begin\n if c[i]>b[1]\n then w:=w+1;\n end;\n for i:=1 to n do \n begin\n while (b[i]>a[k+1])and(k+1<=n) do k:=k+1;\n while (b[i]>=c[n-w+1])and(n-w+1<=n) do w:=w-1;\n ans:=ans+k*w;\n writeln(k,' ',w);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1509851144, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03557.html", "problem_id": "p03557", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03557/input.txt", "sample_output_relpath": "derived/input_output/data/p03557/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03557/Pascal/s503383276.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s503383276", "user_id": "u295324020"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,w,k,i,j:longint;\n ans:int64;\n a,b,c:array[0..100001]of longint; \n procedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if lj) then\n begin\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if lj) then\n begin\n y:=c[i];\n c[i]:=c[j];\n c[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if la[i]\n then k:=k+1;\n end;\n for i:=1 to n do \n begin\n if c[i]>b[1]\n then w:=w+1;\n end;\n for i:=1 to n do \n begin\n while (b[i]>a[k+1])and(k+1<=n) do k:=k+1;\n while (b[i]>=c[n-w+1])and(n-w+1<=n) do w:=w-1;\n ans:=ans+k*w;\n writeln(k,' ',w);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03557", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2286, "cpu_time_ms": 99, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s887510504", "group_id": "codeNet:p03558", "input_text": "var n:string;\n i,w,ans,min,k,j:longint;\n a,b:array[0..100000]of longint;\nprocedure gao;\nvar i:longint;\nbegin\n for i:=1 to k do \n a[i]:=a[i]+b[i];\n for i:=1 to w do \n if a[i]>9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 500000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 500000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 250000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 250000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 200000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 200000 do \n begin\n ans:=0;\n gao;\n if ansj) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if la[mid] then\n begin\n bao:=mid;\n t:=mid+1;\n end\n else w:=mid-1;\n end;\n\n t:=1;\n w:=n;\n x:=b[i];\n while t<=w do\n begin\n mid:=(t+w) div 2;\n if x0 then\n max:=max+bao*(n-bao1+1);\n end;\nwrite(max);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1528151687, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03559.html", "problem_id": "p03559", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03559/input.txt", "sample_output_relpath": "derived/input_output/data/p03559/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03559/Pascal/s509737383.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s509737383", "user_id": "u880149461"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,bao,bao1,t,w,x,mid:longint;\nmax:int64;\na,b,c,t1:array[1..500000] of longint;\n procedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if la[mid] then\n begin\n bao:=mid;\n t:=mid+1;\n end\n else w:=mid-1;\n end;\n\n t:=1;\n w:=n;\n x:=b[i];\n while t<=w do\n begin\n mid:=(t+w) div 2;\n if x0 then\n max:=max+bao*(n-bao1+1);\n end;\nwrite(max);\n\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03559", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1288, "cpu_time_ms": 98, "memory_kb": 7936}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s200078796", "group_id": "codeNet:p03559", "input_text": "type\n arr=array[0..200000]of int64;\nvar\n a,b,c,num,sum:arr;\n i:longint;\n n:longint;\n ans:int64;\n last:longint;\nprocedure qs(l,r:longint;var a:arr);\nvar i,j:longint;\n m,t:int64;\nbegin\n i:=l;\n j:=r;\n m:=a[(l+r)>>1];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l>1];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if ldist[now]+i then\n begin\n dist[y]:=dist[now]+i;\n if not v[y] then\n begin\n v[y]:=true;\n inc(tail);\n q[tail]:=y;\n end;\n end;\n end;\n inc(head);\n v[now]:=false;\n end;\nend;\nbegin\n read(n);\n spfa;\n writeln(dist[0]);\nend.", "language": "Pascal", "metadata": {"date": 1509850701, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03560.html", "problem_id": "p03560", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03560/input.txt", "sample_output_relpath": "derived/input_output/data/p03560/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03560/Pascal/s484231197.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s484231197", "user_id": "u809476955"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n:longint;\n dist:array[0..100050]of longint;\n q:array[0..5000050]of longint;\n v:array[0..100050]of boolean;\nprocedure spfa;\nvar head,tail:longint;\n i,now,y:longint;\nbegin\n head:=1;\n tail:=0;\n for i:=1 to n-1 do\n dist[i]:=i;\n dist[0]:=n;\n for i:=0 to n-1 do\n begin\n inc(tail);\n q[tail]:=i;\n v[i]:=true;\n end;\n while head<=tail do\n begin\n now:=q[head];\n for i:=0 to 9 do\n begin\n y:=(now*10+i) mod n;\n if dist[y]>dist[now]+i then\n begin\n dist[y]:=dist[now]+i;\n if not v[y] then\n begin\n v[y]:=true;\n inc(tail);\n q[tail]:=y;\n end;\n end;\n end;\n inc(head);\n v[now]:=false;\n end;\nend;\nbegin\n read(n);\n spfa;\n writeln(dist[0]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nConstraints\n\n2 \\leq K \\leq 10^5\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\n12=6×2 yields the smallest sum.\n\nSample Input 2\n\n41\n\nSample Output 2\n\n5\n\n11111=41×271 yields the smallest sum.\n\nSample Input 3\n\n79992\n\nSample Output 3\n\n36", "sample_input": "6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03560", "source_text": "Score : 700 points\n\nProblem Statement\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nConstraints\n\n2 \\leq K \\leq 10^5\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\n12=6×2 yields the smallest sum.\n\nSample Input 2\n\n41\n\nSample Output 2\n\n5\n\n11111=41×271 yields the smallest sum.\n\nSample Input 3\n\n79992\n\nSample Output 3\n\n36", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 757, "cpu_time_ms": 128, "memory_kb": 6144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s154045994", "group_id": "codeNet:p03564", "input_text": "uses math;\nvar n,i,p:longint;a,b,c,d,e,o:int64;\nbegin a:=1;\nread(n,p);\nfor i:=1 to n do\n begin\n a:=a+min(a,p);\n end; writeln(a);\nend.", "language": "Pascal", "metadata": {"date": 1544576147, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03564.html", "problem_id": "p03564", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03564/input.txt", "sample_output_relpath": "derived/input_output/data/p03564/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03564/Pascal/s154045994.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s154045994", "user_id": "u263933075"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "uses math;\nvar n,i,p:longint;a,b,c,d,e,o:int64;\nbegin a:=1;\nread(n,p);\nfor i:=1 to n do\n begin\n a:=a+min(a,p);\n end; writeln(a);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n\nOperation A: The displayed value is doubled.\n\nOperation B: The displayed value increases by K.\n\nSquare1001 needs to perform these operations N times in total.\nFind the minimum possible value displayed in the board after N operations.\n\nConstraints\n\n1 \\leq N, K \\leq 10\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the minimum possible value displayed in the board after N operations.\n\nSample Input 1\n\n4\n3\n\nSample Output 1\n\n10\n\nThe value will be minimized when the operations are performed in the following order: A, A, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.\n\nSample Input 2\n\n10\n10\n\nSample Output 2\n\n76\n\nThe value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.\n\nBy the way, this contest is AtCoder Beginner Contest 076.", "sample_input": "4\n3\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03564", "source_text": "Score : 200 points\n\nProblem Statement\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n\nOperation A: The displayed value is doubled.\n\nOperation B: The displayed value increases by K.\n\nSquare1001 needs to perform these operations N times in total.\nFind the minimum possible value displayed in the board after N operations.\n\nConstraints\n\n1 \\leq N, K \\leq 10\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the minimum possible value displayed in the board after N operations.\n\nSample Input 1\n\n4\n3\n\nSample Output 1\n\n10\n\nThe value will be minimized when the operations are performed in the following order: A, A, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.\n\nSample Input 2\n\n10\n10\n\nSample Output 2\n\n76\n\nThe value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.\n\nBy the way, this contest is AtCoder Beginner Contest 076.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s063130873", "group_id": "codeNet:p03568", "input_text": "var n,i,j,ans:longint;\nvar a,r,b:array[0..1000] of longint;\nvar f:array[0..1000,0..1000] of longint;\nprocedure dfs(d:longint);\nvar i,j:longint;\nvar a1:int64;\nbegin\n if d>n then begin\n a1:=1;\n for i:=1 to n do\n begin if abs(a[i]-b[i])>1 then exit;a1:=a1*a[i];end;\n if a1 mod 2=0 then inc(ans);\n exit;\n end;\n a[d]:=b[d];dfs(d+1);\n a[d]:=b[d]-1;dfs(d+1);\n a[d]:=b[d]+1;dfs(d+1);\nend;\nbegin\n read(n);\n for i:=1 to n do read(b[i]);dfs(1);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1508722347, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03568.html", "problem_id": "p03568", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03568/input.txt", "sample_output_relpath": "derived/input_output/data/p03568/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03568/Pascal/s063130873.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s063130873", "user_id": "u379604713"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var n,i,j,ans:longint;\nvar a,r,b:array[0..1000] of longint;\nvar f:array[0..1000,0..1000] of longint;\nprocedure dfs(d:longint);\nvar i,j:longint;\nvar a1:int64;\nbegin\n if d>n then begin\n a1:=1;\n for i:=1 to n do\n begin if abs(a[i]-b[i])>1 then exit;a1:=a1*a[i];end;\n if a1 mod 2=0 then inc(ans);\n exit;\n end;\n a[d]:=b[d];dfs(d+1);\n a[d]:=b[d]-1;dfs(d+1);\n a[d]:=b[d]+1;dfs(d+1);\nend;\nbegin\n read(n);\n for i:=1 to n do read(b[i]);dfs(1);\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are similar when |x_i - y_i| \\leq 1 holds for all i (1 \\leq i \\leq N).\n\nIn particular, any integer sequence is similar to itself.\n\nYou are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N.\n\nHow many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2, ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is even?\n\nConstraints\n\n1 \\leq N \\leq 10\n\n1 \\leq A_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of integer sequences that satisfy the condition.\n\nSample Input 1\n\n2\n2 3\n\nSample Output 1\n\n7\n\nThere are seven integer sequences that satisfy the condition:\n\n1, 2\n\n1, 4\n\n2, 2\n\n2, 3\n\n2, 4\n\n3, 2\n\n3, 4\n\nSample Input 2\n\n3\n3 3 3\n\nSample Output 2\n\n26\n\nSample Input 3\n\n1\n100\n\nSample Output 3\n\n1\n\nSample Input 4\n\n10\n90 52 56 71 44 8 13 30 57 84\n\nSample Output 4\n\n58921", "sample_input": "2\n2 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03568", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are similar when |x_i - y_i| \\leq 1 holds for all i (1 \\leq i \\leq N).\n\nIn particular, any integer sequence is similar to itself.\n\nYou are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N.\n\nHow many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2, ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is even?\n\nConstraints\n\n1 \\leq N \\leq 10\n\n1 \\leq A_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of integer sequences that satisfy the condition.\n\nSample Input 1\n\n2\n2 3\n\nSample Output 1\n\n7\n\nThere are seven integer sequences that satisfy the condition:\n\n1, 2\n\n1, 4\n\n2, 2\n\n2, 3\n\n2, 4\n\n3, 2\n\n3, 4\n\nSample Input 2\n\n3\n3 3 3\n\nSample Output 2\n\n26\n\nSample Input 3\n\n1\n100\n\nSample Output 3\n\n1\n\nSample Input 4\n\n10\n90 52 56 71 44 8 13 30 57 84\n\nSample Output 4\n\n58921", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 481, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s191665211", "group_id": "codeNet:p03569", "input_text": "var i,j,n,ans:longint;\nvar s:ansistring;\nbegin\n readln(s);n:=length(s);\n i:=1;j:=n;\n while (i<=j) do\n begin\n if s[i]=s[j] then begin inc(i);dec(j);continue;end;\n if (s[i]='x') then begin inc(ans);inc(i);continue;end;\n if s[j]='x' then begin inc(ans);dec(j);continue;end;\n writeln(-1);exit;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1508724080, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03569.html", "problem_id": "p03569", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03569/input.txt", "sample_output_relpath": "derived/input_output/data/p03569/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03569/Pascal/s191665211.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s191665211", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var i,j,n,ans:longint;\nvar s:ansistring;\nbegin\n readln(s);n:=length(s);\n i:=1;j:=n;\n while (i<=j) do\n begin\n if s[i]=s[j] then begin inc(i);dec(j);continue;end;\n if (s[i]='x') then begin inc(ans);inc(i);continue;end;\n if s[j]='x' then begin inc(ans);dec(j);continue;end;\n writeln(-1);exit;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke can perform the following operation repeatedly:\n\nInsert a letter x to any position in s of his choice, including the beginning and end of s.\n\nSnuke's objective is to turn s into a palindrome.\nDetermine whether the objective is achievable. If it is achievable, find the minimum number of operations required.\n\nNotes\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf the objective is achievable, print the number of operations required.\nIf it is not, print -1 instead.\n\nSample Input 1\n\nxabxa\n\nSample Output 1\n\n2\n\nOne solution is as follows (newly inserted x are shown in bold):\n\nxabxa → xaxbxa → xaxbxax\n\nSample Input 2\n\nab\n\nSample Output 2\n\n-1\n\nNo sequence of operations can turn s into a palindrome.\n\nSample Input 3\n\na\n\nSample Output 3\n\n0\n\ns is a palindrome already at the beginning.\n\nSample Input 4\n\noxxx\n\nSample Output 4\n\n3\n\nOne solution is as follows:\n\noxxx → xoxxx → xxoxxx → xxxoxxx", "sample_input": "xabxa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03569", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke can perform the following operation repeatedly:\n\nInsert a letter x to any position in s of his choice, including the beginning and end of s.\n\nSnuke's objective is to turn s into a palindrome.\nDetermine whether the objective is achievable. If it is achievable, find the minimum number of operations required.\n\nNotes\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf the objective is achievable, print the number of operations required.\nIf it is not, print -1 instead.\n\nSample Input 1\n\nxabxa\n\nSample Output 1\n\n2\n\nOne solution is as follows (newly inserted x are shown in bold):\n\nxabxa → xaxbxa → xaxbxax\n\nSample Input 2\n\nab\n\nSample Output 2\n\n-1\n\nNo sequence of operations can turn s into a palindrome.\n\nSample Input 3\n\na\n\nSample Output 3\n\n0\n\ns is a palindrome already at the beginning.\n\nSample Input 4\n\noxxx\n\nSample Output 4\n\n3\n\nOne solution is as follows:\n\noxxx → xoxxx → xxoxxx → xxxoxxx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 333, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s816867059", "group_id": "codeNet:p03570", "input_text": "var a:array['a'..'z'] of longint;\nvar s:ansistring;\nvar ans,i,j:longint;\nbegin\n readln(s);for i:=1 to length(s) do inc(a[s[i]]);\n for i:=1 to 26 do if a[chr(i+ord('a'))] mod 2=1 then inc(ans);\n if ans=0 then inc(ans);writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1508725232, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03570.html", "problem_id": "p03570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03570/input.txt", "sample_output_relpath": "derived/input_output/data/p03570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03570/Pascal/s816867059.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s816867059", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array['a'..'z'] of longint;\nvar s:ansistring;\nvar ans,i,j:longint;\nbegin\n readln(s);for i:=1 to length(s) do inc(a[s[i]]);\n for i:=1 to 26 do if a[chr(i+ord('a'))] mod 2=1 then inc(ans);\n if ans=0 then inc(ans);writeln(ans);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "sample_input": "aabxyyzz\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03570", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s741469643", "group_id": "codeNet:p03570", "input_text": "var a:array['a'..'z'] of longint;\nvar s:ansistring;\nvar ans,i,j:longint;\nbegin\n readln(s);for i:=1 to length(s) do inc(a[s[i]]);\n for i:=1 to 26 do if a[chr(i+ord('a'))] mod 2=1 then inc(ans);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1508724915, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03570.html", "problem_id": "p03570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03570/input.txt", "sample_output_relpath": "derived/input_output/data/p03570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03570/Pascal/s741469643.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s741469643", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array['a'..'z'] of longint;\nvar s:ansistring;\nvar ans,i,j:longint;\nbegin\n readln(s);for i:=1 to length(s) do inc(a[s[i]]);\n for i:=1 to 26 do if a[chr(i+ord('a'))] mod 2=1 then inc(ans);\n writeln(ans);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "sample_input": "aabxyyzz\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03570", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s369679617", "group_id": "codeNet:p03577", "input_text": "var s:string;i,n:integer;\nbegin\nreadln(s);\nn:=length(s);\nfor i:=1 to n-8 do begin\nwrite(s[i]);\nend;\nwriteln();\nend.", "language": "Pascal", "metadata": {"date": 1600266825, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03577.html", "problem_id": "p03577", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03577/input.txt", "sample_output_relpath": "derived/input_output/data/p03577/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03577/Pascal/s369679617.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s369679617", "user_id": "u984276646"}, "prompt_components": {"gold_output": "CODE\n", "input_to_evaluate": "var s:string;i,n:integer;\nbegin\nreadln(s);\nn:=length(s);\nfor i:=1 to n-8 do begin\nwrite(s[i]);\nend;\nwriteln();\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nRng is going to a festival.\n\nThe name of the festival is given to you as a string S, which ends with FESTIVAL, from input. Answer the question: \"Rng is going to a festival of what?\" Output the answer.\n\nHere, assume that the name of \"a festival of s\" is a string obtained by appending FESTIVAL to the end of s.\nFor example, CODEFESTIVAL is a festival of CODE.\n\nConstraints\n\n9 \\leq |S| \\leq 50\n\nS consists of uppercase English letters.\n\nS ends with FESTIVAL.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the answer to the question: \"Rng is going to a festival of what?\"\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nCODE\n\nThis is the same as the example in the statement.\n\nSample Input 2\n\nCODEFESTIVALFESTIVAL\n\nSample Output 2\n\nCODEFESTIVAL\n\nThis string is obtained by appending FESTIVAL to the end of CODEFESTIVAL, so it is a festival of CODEFESTIVAL.\n\nSample Input 3\n\nYAKINIKUFESTIVAL\n\nSample Output 3\n\nYAKINIKU", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["CODE\n"], "source_document_id": "p03577", "source_text": "Score : 100 points\n\nProblem Statement\n\nRng is going to a festival.\n\nThe name of the festival is given to you as a string S, which ends with FESTIVAL, from input. Answer the question: \"Rng is going to a festival of what?\" Output the answer.\n\nHere, assume that the name of \"a festival of s\" is a string obtained by appending FESTIVAL to the end of s.\nFor example, CODEFESTIVAL is a festival of CODE.\n\nConstraints\n\n9 \\leq |S| \\leq 50\n\nS consists of uppercase English letters.\n\nS ends with FESTIVAL.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the answer to the question: \"Rng is going to a festival of what?\"\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nCODE\n\nThis is the same as the example in the statement.\n\nSample Input 2\n\nCODEFESTIVALFESTIVAL\n\nSample Output 2\n\nCODEFESTIVAL\n\nThis string is obtained by appending FESTIVAL to the end of CODEFESTIVAL, so it is a festival of CODEFESTIVAL.\n\nSample Input 3\n\nYAKINIKUFESTIVAL\n\nSample Output 3\n\nYAKINIKU", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s281154698", "group_id": "codeNet:p03578", "input_text": "var\n n,m,i:longint;\n d,t:array[-1..200000]of longint;\n td,tt:longint;\n\nprocedure sort( l,r:longint);\nvar\n x,e,j,i:longint;\nbegin\n i:=l;j:=r;x:=(l+r)div 2;\n repeat\n while (d[i]d[x]) do dec(j);\n if(i<=j)then\n begin\n e:=d[i];d[i]:=d[j];d[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if it[x]) do dec(j);\n if(i<=j)then\n begin\n e:=t[i];t[i]:=t[j];t[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if id[x]) do dec(j);\n if(i<=j)then\n begin\n e:=d[i];d[i]:=d[j];d[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if it[x]) do dec(j);\n if(i<=j)then\n begin\n e:=t[i];t[i]:=t[j];t[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if i0 do\n begin\n if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;\n i:=nx[i];\n end;\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "language": "Pascal", "metadata": {"date": 1569851576, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s086307029.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s086307029", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;\n i:=nx[i];\n end;\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1077, "cpu_time_ms": 30, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s445736041", "group_id": "codeNet:p03579", "input_text": "var\n n:int64;\n hs:array[1..2] of int64;\n x,y,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n procedure ss(q,sc:longint);\n var\n i:longint;\n begin\n ys[q]:=sc;\n hs[sc]:=hs[sc]+1;\n i:=hd[q];\n while i<>0 do\n begin\n if ys[t[i]]=sc then\n begin\n writeln(n*(n-1) div 2-m);\n halt;\n end;\n if ys[t[i]]=0 then ss(t[i],3-sc);\n i:=nx[i];\n end;\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n ss(i,1);\n writeln(hs[1]*hs[2]-m);\nend.\n5 5\n1 2\n2 3\n3 4\n4 5\n5 1", "language": "Pascal", "metadata": {"date": 1569850215, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s445736041.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s445736041", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n n:int64;\n hs:array[1..2] of int64;\n x,y,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n procedure ss(q,sc:longint);\n var\n i:longint;\n begin\n ys[q]:=sc;\n hs[sc]:=hs[sc]+1;\n i:=hd[q];\n while i<>0 do\n begin\n if ys[t[i]]=sc then\n begin\n writeln(n*(n-1) div 2-m);\n halt;\n end;\n if ys[t[i]]=0 then ss(t[i],3-sc);\n i:=nx[i];\n end;\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n ss(i,1);\n writeln(hs[1]*hs[2]-m);\nend.\n5 5\n1 2\n2 3\n3 4\n4 5\n5 1", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 758, "cpu_time_ms": 29, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s832686287", "group_id": "codeNet:p03579", "input_text": "var\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n procedure ss(q,sc:longint);\n var\n i:longint;\n begin\n ys[q]:=sc;\n hs[sc]:=hs[sc]+1;\n i:=hd[q];\n while i<>0 do\n begin\n if ys[t[i]]=sc then\n begin\n writeln(n*(n-1) div 2-m);\n halt;\n end;\n if ys[t[i]]=0 then ss(t[i],3-sc);\n i:=nx[i];\n end;\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n ss(i,1);\n writeln(hs[1]*hs[2]-m);\nend.", "language": "Pascal", "metadata": {"date": 1569849944, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s832686287.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s832686287", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n procedure ss(q,sc:longint);\n var\n i:longint;\n begin\n ys[q]:=sc;\n hs[sc]:=hs[sc]+1;\n i:=hd[q];\n while i<>0 do\n begin\n if ys[t[i]]=sc then\n begin\n writeln(n*(n-1) div 2-m);\n halt;\n end;\n if ys[t[i]]=0 then ss(t[i],3-sc);\n i:=nx[i];\n end;\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n ss(i,1);\n writeln(hs[1]*hs[2]-m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 725, "cpu_time_ms": 29, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s635665953", "group_id": "codeNet:p03580", "input_text": " Uses Math;\n\n\n const MAX_N = 500000 + 120;\n \n var S : AnsiString;\n N : LongInt;\n ans : Int64;\n \n \n var dp : array [ 0 .. MAX_N , 1 .. 2 ] of LongInt;\n size : array [ 1 .. MAX_N + 12 ] of LongInt;\n \n procedure Solve ( l , R : LongInt ) ;\n var i : LongInt;\n x , cnt : LongInt;\n begin\n if ( L + 2 > R ) then exit();\n \n for i := 1 to R - L + 10 do\n begin\n dp[i][1] := 0;\n dp[i][2] := 0;\n size[i] := 0;\n end;\n \n cnt := 0;\n x := 0;\n \n \n if ( S[R] = '0' ) then halt(1);\n \n for i := L to R do\n begin\n if ( s[i] = '1' ) then\n begin\n cnt += 1;\n end\n else\n begin\n inc ( x ) ;\n size[x] := cnt - 1;\n cnt := 0;\n end;\n end;\n size[x+1] := cnt - 1;\n \n \n \n \n dp[0][1] := 0;\n dp[0][2] := 0;\n \n dp[1][1] := size[1] + 1;\n if ( X <> 1 ) then\n dp[1][2] := 1 + (size[2] - 1)\n else\n dp[1][2] := 1 + (size[2]);\n \n for i := 2 to X do\n begin\n \n if ( size[i] <> 0 ) then // not 10101\n begin\n dp[i][1] := max ( dp[i-1][1] + (size[i] - 1) + 1 , dp[i-1][2] + 1 ); \n if ( i = X ) then\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] + 1\n else\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] - 1 + 1;\n end\n else\n begin\n dp[i][1] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + 1 );\n if ( I = X ) then\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] + 1 )\n else\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] - 1 + 1 );\n end;\n dp[i][1] := max ( dp[i][1] , dp[i][2] );\n end;\n \n \n \n ans += max ( dp[x][1] , dp[x][2] );\n \n end;\n \n var last : LongINt;\n \n var i : LongInt;\n \nbegin\n ans := 0;\n \n readLn ( N ) ; \n readLn ( S ) ;\n \n last := 0;\n \n for i := 1 to N do\n begin\n if ( S[i] = '0' ) and ( S[i+1] = '0' ) then\n begin\n Solve ( last + 1 , i - 1 );\n last := i + 1;\n end;\n end;\n \n if ( S[n] = '0' ) then\n Solve ( last + 1 , n-1 )\n else\n Solve ( last + 1 , n );\n \n writeLn ( ans );\n \n \nend.\n", "language": "Pascal", "metadata": {"date": 1507517681, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03580.html", "problem_id": "p03580", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03580/input.txt", "sample_output_relpath": "derived/input_output/data/p03580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03580/Pascal/s635665953.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s635665953", "user_id": "u941440321"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " Uses Math;\n\n\n const MAX_N = 500000 + 120;\n \n var S : AnsiString;\n N : LongInt;\n ans : Int64;\n \n \n var dp : array [ 0 .. MAX_N , 1 .. 2 ] of LongInt;\n size : array [ 1 .. MAX_N + 12 ] of LongInt;\n \n procedure Solve ( l , R : LongInt ) ;\n var i : LongInt;\n x , cnt : LongInt;\n begin\n if ( L + 2 > R ) then exit();\n \n for i := 1 to R - L + 10 do\n begin\n dp[i][1] := 0;\n dp[i][2] := 0;\n size[i] := 0;\n end;\n \n cnt := 0;\n x := 0;\n \n \n if ( S[R] = '0' ) then halt(1);\n \n for i := L to R do\n begin\n if ( s[i] = '1' ) then\n begin\n cnt += 1;\n end\n else\n begin\n inc ( x ) ;\n size[x] := cnt - 1;\n cnt := 0;\n end;\n end;\n size[x+1] := cnt - 1;\n \n \n \n \n dp[0][1] := 0;\n dp[0][2] := 0;\n \n dp[1][1] := size[1] + 1;\n if ( X <> 1 ) then\n dp[1][2] := 1 + (size[2] - 1)\n else\n dp[1][2] := 1 + (size[2]);\n \n for i := 2 to X do\n begin\n \n if ( size[i] <> 0 ) then // not 10101\n begin\n dp[i][1] := max ( dp[i-1][1] + (size[i] - 1) + 1 , dp[i-1][2] + 1 ); \n if ( i = X ) then\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] + 1\n else\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] - 1 + 1;\n end\n else\n begin\n dp[i][1] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + 1 );\n if ( I = X ) then\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] + 1 )\n else\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] - 1 + 1 );\n end;\n dp[i][1] := max ( dp[i][1] , dp[i][2] );\n end;\n \n \n \n ans += max ( dp[x][1] , dp[x][2] );\n \n end;\n \n var last : LongINt;\n \n var i : LongInt;\n \nbegin\n ans := 0;\n \n readLn ( N ) ; \n readLn ( S ) ;\n \n last := 0;\n \n for i := 1 to N do\n begin\n if ( S[i] = '0' ) and ( S[i+1] = '0' ) then\n begin\n Solve ( last + 1 , i - 1 );\n last := i + 1;\n end;\n end;\n \n if ( S[n] = '0' ) then\n Solve ( last + 1 , n-1 )\n else\n Solve ( last + 1 , n );\n \n writeLn ( ans );\n \n \nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nN cells are arranged in a row.\nSome of them may contain tokens.\nYou are given a string s that consists of 0s and 1s.\nIf the i-th character of s is 1, the i-th cell (from left) contains a token.\nOtherwise, it doesn't contain a token.\n\nSnuke wants to perform the following operation as many times as possible.\nIn each operation, he chooses three consecutive cells.\nLet's call the cells X, Y, Z from left to right.\nIn order for the operation to be valid, both X and Z must contain tokens and Y must not contain a token.\nThen, he removes these two tokens and puts a new token on Y.\n\nHow many operations can he perform if he performs operations in the optimal way?\n\nConstraints\n\n1 \\leq N \\leq 500,000\n\n|s| = N\n\nEach character in s is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n1010101\n\nSample Output 1\n\n2\n\nFor example, he can perform two operations in the following way:\n\nPerform an operation on the last three cells. Now the string that represents tokens becomes 1010010.\n\nPerform an operation on the first three cells. Now the string that represents tokens becomes 0100010.\n\nNote that the choice of operations matters.\nFor example, if he chooses three cells in the middle first, he can perform no more operations.\n\nSample Input 2\n\n50\n10101000010011011110001001111110000101010111100110\n\nSample Output 2\n\n10", "sample_input": "7\n1010101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03580", "source_text": "Score : 700 points\n\nProblem Statement\n\nN cells are arranged in a row.\nSome of them may contain tokens.\nYou are given a string s that consists of 0s and 1s.\nIf the i-th character of s is 1, the i-th cell (from left) contains a token.\nOtherwise, it doesn't contain a token.\n\nSnuke wants to perform the following operation as many times as possible.\nIn each operation, he chooses three consecutive cells.\nLet's call the cells X, Y, Z from left to right.\nIn order for the operation to be valid, both X and Z must contain tokens and Y must not contain a token.\nThen, he removes these two tokens and puts a new token on Y.\n\nHow many operations can he perform if he performs operations in the optimal way?\n\nConstraints\n\n1 \\leq N \\leq 500,000\n\n|s| = N\n\nEach character in s is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n1010101\n\nSample Output 1\n\n2\n\nFor example, he can perform two operations in the following way:\n\nPerform an operation on the last three cells. Now the string that represents tokens becomes 1010010.\n\nPerform an operation on the first three cells. Now the string that represents tokens becomes 0100010.\n\nNote that the choice of operations matters.\nFor example, if he chooses three cells in the middle first, he can perform no more operations.\n\nSample Input 2\n\n50\n10101000010011011110001001111110000101010111100110\n\nSample Output 2\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2128, "cpu_time_ms": 9, "memory_kb": 6784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s617650436", "group_id": "codeNet:p03580", "input_text": " Uses Math;\n\n\n const MAX_N = 500000 + 120;\n \n var S : AnsiString;\n N : LongInt;\n ans : Int64;\n \n \n var dp : array [ 0 .. MAX_N , 1 .. 2 ] of LongInt;\n size : array [ 1 .. MAX_N + 12 ] of LongInt;\n \n procedure Solve ( l , R : LongInt ) ;\n var i : LongInt;\n x , cnt : LongInt;\n begin\n if ( L + 2 > R ) then exit();\n \n for i := 1 to R - L + 10 do\n begin\n dp[i][1] := 0;\n dp[i][2] := 0;\n size[i] := 0;\n end;\n \n cnt := 0;\n x := 0;\n \n \n if ( S[R] = '0' ) then halt(1);\n \n for i := L to R do\n begin\n if ( s[i] = '1' ) then\n begin\n cnt += 1;\n end\n else\n begin\n inc ( x ) ;\n size[x] := cnt - 1;\n cnt := 0;\n end;\n end;\n size[x+1] := cnt - 1;\n \n \n dp[0][1] := 0;\n dp[0][2] := 0;\n \n dp[1][1] := size[1] + 1;\n dp[1][2] := 1 + size[2];\n \n for i := 2 to X do\n begin\n \n if ( size[i] <> 0 ) then // not 10101\n begin\n dp[i][1] := max ( dp[i-1][1] + size[i] + 1 , dp[i-1][2] + 1 ); \n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] + 1;\n end\n else\n begin\n dp[i][1] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + 1 );\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] + 1 );\n end;\n dp[i][1] := max ( dp[i][1] , dp[i][2] );\n end;\n \n \n ans += max ( dp[x][1] , dp[x][2] );\n \n end;\n \n var last : LongINt;\n \n var i : LongInt;\n \nbegin\n ans := 0;\n \n readLn ( N ) ; \n readLn ( S ) ;\n \n last := 0;\n \n for i := 1 to N do\n begin\n if ( S[i] = '0' ) and ( S[i+1] = '0' ) then\n begin\n Solve ( last + 1 , i - 1 );\n last := i + 1;\n end;\n end;\n \n if ( S[n] = '0' ) then\n Solve ( last + 1 , n-1 )\n else\n Solve ( last + 1 , n );\n \n writeLn ( ans );\n \n \nend.\n", "language": "Pascal", "metadata": {"date": 1507517128, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03580.html", "problem_id": "p03580", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03580/input.txt", "sample_output_relpath": "derived/input_output/data/p03580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03580/Pascal/s617650436.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s617650436", "user_id": "u941440321"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " Uses Math;\n\n\n const MAX_N = 500000 + 120;\n \n var S : AnsiString;\n N : LongInt;\n ans : Int64;\n \n \n var dp : array [ 0 .. MAX_N , 1 .. 2 ] of LongInt;\n size : array [ 1 .. MAX_N + 12 ] of LongInt;\n \n procedure Solve ( l , R : LongInt ) ;\n var i : LongInt;\n x , cnt : LongInt;\n begin\n if ( L + 2 > R ) then exit();\n \n for i := 1 to R - L + 10 do\n begin\n dp[i][1] := 0;\n dp[i][2] := 0;\n size[i] := 0;\n end;\n \n cnt := 0;\n x := 0;\n \n \n if ( S[R] = '0' ) then halt(1);\n \n for i := L to R do\n begin\n if ( s[i] = '1' ) then\n begin\n cnt += 1;\n end\n else\n begin\n inc ( x ) ;\n size[x] := cnt - 1;\n cnt := 0;\n end;\n end;\n size[x+1] := cnt - 1;\n \n \n dp[0][1] := 0;\n dp[0][2] := 0;\n \n dp[1][1] := size[1] + 1;\n dp[1][2] := 1 + size[2];\n \n for i := 2 to X do\n begin\n \n if ( size[i] <> 0 ) then // not 10101\n begin\n dp[i][1] := max ( dp[i-1][1] + size[i] + 1 , dp[i-1][2] + 1 ); \n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] + 1;\n end\n else\n begin\n dp[i][1] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + 1 );\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] + 1 );\n end;\n dp[i][1] := max ( dp[i][1] , dp[i][2] );\n end;\n \n \n ans += max ( dp[x][1] , dp[x][2] );\n \n end;\n \n var last : LongINt;\n \n var i : LongInt;\n \nbegin\n ans := 0;\n \n readLn ( N ) ; \n readLn ( S ) ;\n \n last := 0;\n \n for i := 1 to N do\n begin\n if ( S[i] = '0' ) and ( S[i+1] = '0' ) then\n begin\n Solve ( last + 1 , i - 1 );\n last := i + 1;\n end;\n end;\n \n if ( S[n] = '0' ) then\n Solve ( last + 1 , n-1 )\n else\n Solve ( last + 1 , n );\n \n writeLn ( ans );\n \n \nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nN cells are arranged in a row.\nSome of them may contain tokens.\nYou are given a string s that consists of 0s and 1s.\nIf the i-th character of s is 1, the i-th cell (from left) contains a token.\nOtherwise, it doesn't contain a token.\n\nSnuke wants to perform the following operation as many times as possible.\nIn each operation, he chooses three consecutive cells.\nLet's call the cells X, Y, Z from left to right.\nIn order for the operation to be valid, both X and Z must contain tokens and Y must not contain a token.\nThen, he removes these two tokens and puts a new token on Y.\n\nHow many operations can he perform if he performs operations in the optimal way?\n\nConstraints\n\n1 \\leq N \\leq 500,000\n\n|s| = N\n\nEach character in s is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n1010101\n\nSample Output 1\n\n2\n\nFor example, he can perform two operations in the following way:\n\nPerform an operation on the last three cells. Now the string that represents tokens becomes 1010010.\n\nPerform an operation on the first three cells. Now the string that represents tokens becomes 0100010.\n\nNote that the choice of operations matters.\nFor example, if he chooses three cells in the middle first, he can perform no more operations.\n\nSample Input 2\n\n50\n10101000010011011110001001111110000101010111100110\n\nSample Output 2\n\n10", "sample_input": "7\n1010101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03580", "source_text": "Score : 700 points\n\nProblem Statement\n\nN cells are arranged in a row.\nSome of them may contain tokens.\nYou are given a string s that consists of 0s and 1s.\nIf the i-th character of s is 1, the i-th cell (from left) contains a token.\nOtherwise, it doesn't contain a token.\n\nSnuke wants to perform the following operation as many times as possible.\nIn each operation, he chooses three consecutive cells.\nLet's call the cells X, Y, Z from left to right.\nIn order for the operation to be valid, both X and Z must contain tokens and Y must not contain a token.\nThen, he removes these two tokens and puts a new token on Y.\n\nHow many operations can he perform if he performs operations in the optimal way?\n\nConstraints\n\n1 \\leq N \\leq 500,000\n\n|s| = N\n\nEach character in s is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n1010101\n\nSample Output 1\n\n2\n\nFor example, he can perform two operations in the following way:\n\nPerform an operation on the last three cells. Now the string that represents tokens becomes 1010010.\n\nPerform an operation on the first three cells. Now the string that represents tokens becomes 0100010.\n\nNote that the choice of operations matters.\nFor example, if he chooses three cells in the middle first, he can perform no more operations.\n\nSample Input 2\n\n50\n10101000010011011110001001111110000101010111100110\n\nSample Output 2\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1789, "cpu_time_ms": 9, "memory_kb": 6784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s073468187", "group_id": "codeNet:p03588", "input_text": "var n,i,a,b,x,y:Longint;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(a,b);\nif xmax then max:=a;\n if xmax then max:=a;\n if xmax then\n begin\n max:=a;\n maxx:=x;\n end;\n if xmaxx then\n begin\n writeln(1 div z);\n exit;\n end;\n writeln(max+maxx);\nend.\n", "language": "Pascal", "metadata": {"date": 1506826861, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03588.html", "problem_id": "p03588", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03588/input.txt", "sample_output_relpath": "derived/input_output/data/p03588/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03588/Pascal/s569498108.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s569498108", "user_id": "u809476955"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var n,i:longint;\n a,x:longint;\n max,maxx,min:longint;\n z:longint;\nbegin\n read(n);\n min:=maxlongint;\n for i:=1 to n do\n begin\n read(a,x);\n if a>max then\n begin\n max:=a;\n maxx:=x;\n end;\n if xmaxx then\n begin\n writeln(1 div z);\n exit;\n end;\n writeln(max+maxx);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA group of people played a game. All players had distinct scores, which are positive integers.\n\nTakahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.\n\nFind the maximum possible number of players in the game.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n0 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\nIf i ≠ j, A_i ≠ A_j.\n\nThere exists a possible outcome of the game that are consistent with the facts.\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutputs\n\nPrint the maximum possible number of players in the game.\n\nSample Input 1\n\n3\n4 7\n2 9\n6 2\n\nSample Output 1\n\n8\n\nThe maximum possible number of players is achieved when, for example, the players have the following scores: 12,9,8,7,5,2,1,0.\n\nSample Input 2\n\n5\n1 10\n3 6\n5 2\n4 4\n2 8\n\nSample Output 2\n\n7\n\nSample Input 3\n\n2\n1 1000000000\n1000000000 1\n\nSample Output 3\n\n1000000001", "sample_input": "3\n4 7\n2 9\n6 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03588", "source_text": "Score : 200 points\n\nProblem Statement\n\nA group of people played a game. All players had distinct scores, which are positive integers.\n\nTakahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.\n\nFind the maximum possible number of players in the game.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n0 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\nIf i ≠ j, A_i ≠ A_j.\n\nThere exists a possible outcome of the game that are consistent with the facts.\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutputs\n\nPrint the maximum possible number of players in the game.\n\nSample Input 1\n\n3\n4 7\n2 9\n6 2\n\nSample Output 1\n\n8\n\nThe maximum possible number of players is achieved when, for example, the players have the following scores: 12,9,8,7,5,2,1,0.\n\nSample Input 2\n\n5\n1 10\n3 6\n5 2\n4 4\n2 8\n\nSample Output 2\n\n7\n\nSample Input 3\n\n2\n1 1000000000\n1000000000 1\n\nSample Output 3\n\n1000000001", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 353, "cpu_time_ms": 29, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s870423033", "group_id": "codeNet:p03588", "input_text": "var\n a,t,i,j,y:longint;\n b,c,d:array[0..100009]of longint;\nbegin\nreadln(a);\ny:=maxlongint;\nfor i:=1 to a do\nbegin\nreadln(b[i],c[i]);\nd[i]:=b[i]+c[i];\nif d[i]>1];m2:=a[(l+r)>>1];\n repeat\n while (b[i]>mid) or ((b[i]=mid) and (a[i]m2)) do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n t:=b[i];b[i]:=b[j];b[j]:=t;\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l>1];m2:=a[(l+r)>>1];m3:=c[(l+r)>>1];\n repeat\n while (c[i]>m3) or ((c[i]=m3) and (b[i]>mid))\n or ((c[i]=m3) and (b[i]=mid) and (a[i]m2)) do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n t:=b[i];b[i]:=b[j];b[j]:=t;\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l=0 then begin inc(ans,b[i]);dec(k,a[i]);end;\n qsort1(1,n);a1:=0; k:=kk;\n //for i:=1 to n do writeln(c[i],' ',a[i], ' ',b[i]);\n for i:=1 to n do\n if k-a[i]>=0 then begin inc(a1,b[i]);dec(k,a[i]);end;\n //writeln(a1);\n if ans>a1 then writeln(ans)else writeln(a1);\nend.", "language": "Pascal", "metadata": {"date": 1506825555, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03590.html", "problem_id": "p03590", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03590/input.txt", "sample_output_relpath": "derived/input_output/data/p03590/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03590/Pascal/s451779014.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s451779014", "user_id": "u379604713"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var n,k,ans,a1,kk:int64;\nvar i,j:longint;\nvar a,b,c:array[0..100020] of int64;\nprocedure qsort(l,r:int64);\nvar i,j,mid,m2,t:int64;\nbegin\n i:=l;j:=r;mid:=b[(l+r) >>1];m2:=a[(l+r)>>1];\n repeat\n while (b[i]>mid) or ((b[i]=mid) and (a[i]m2)) do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n t:=b[i];b[i]:=b[j];b[j]:=t;\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l>1];m2:=a[(l+r)>>1];m3:=c[(l+r)>>1];\n repeat\n while (c[i]>m3) or ((c[i]=m3) and (b[i]>mid))\n or ((c[i]=m3) and (b[i]=mid) and (a[i]m2)) do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n t:=b[i];b[i]:=b[j];b[j]:=t;\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l=0 then begin inc(ans,b[i]);dec(k,a[i]);end;\n qsort1(1,n);a1:=0; k:=kk;\n //for i:=1 to n do writeln(c[i],' ',a[i], ' ',b[i]);\n for i:=1 to n do\n if k-a[i]>=0 then begin inc(a1,b[i]);dec(k,a[i]);end;\n //writeln(a1);\n if ans>a1 then writeln(ans)else writeln(a1);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSeisu-ya, a store specializing in non-negative integers, sells N non-negative integers. The i-th integer is A_i and has a utility of B_i.\nThere may be multiple equal integers with different utilities.\n\nTakahashi will buy some integers in this store. He can buy a combination of integers whose bitwise OR is less than or equal to K. He wants the sum of utilities of purchased integers to be as large as possible.\n\nFind the maximum possible sum of utilities of purchased integers.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K < 2^{30}\n\n0 \\leq A_i < 2^{30}(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 B_1\n:\nA_N B_N\n\nOutputs\n\nPrint the maximum possible sum of utilities of purchased integers.\n\nSample Input 1\n\n3 5\n3 3\n4 4\n2 5\n\nSample Output 1\n\n8\n\nBuy 2 and 3 to achieve the maximum possible total utility, 8.\n\nSample Input 2\n\n3 6\n3 3\n4 4\n2 5\n\nSample Output 2\n\n9\n\nBuy 2 and 4 to achieve the maximum possible total utility, 9.\n\nSample Input 3\n\n7 14\n10 5\n7 4\n11 4\n9 8\n3 6\n6 2\n8 9\n\nSample Output 3\n\n32", "sample_input": "3 5\n3 3\n4 4\n2 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03590", "source_text": "Score : 500 points\n\nProblem Statement\n\nSeisu-ya, a store specializing in non-negative integers, sells N non-negative integers. The i-th integer is A_i and has a utility of B_i.\nThere may be multiple equal integers with different utilities.\n\nTakahashi will buy some integers in this store. He can buy a combination of integers whose bitwise OR is less than or equal to K. He wants the sum of utilities of purchased integers to be as large as possible.\n\nFind the maximum possible sum of utilities of purchased integers.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K < 2^{30}\n\n0 \\leq A_i < 2^{30}(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 B_1\n:\nA_N B_N\n\nOutputs\n\nPrint the maximum possible sum of utilities of purchased integers.\n\nSample Input 1\n\n3 5\n3 3\n4 4\n2 5\n\nSample Output 1\n\n8\n\nBuy 2 and 3 to achieve the maximum possible total utility, 8.\n\nSample Input 2\n\n3 6\n3 3\n4 4\n2 5\n\nSample Output 2\n\n9\n\nBuy 2 and 4 to achieve the maximum possible total utility, 9.\n\nSample Input 3\n\n7 14\n10 5\n7 4\n11 4\n9 8\n3 6\n6 2\n8 9\n\nSample Output 3\n\n32", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1534, "cpu_time_ms": 52, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s653378641", "group_id": "codeNet:p03592", "input_text": "var i,j,k,t,s,n,m:longint;\nbegin\n\treadln(n,m,k);\n\tfor i:=0 to n do for j:=0 to m do if i*n+j*m=k+i*j*2 then \n\t\tbegin write('Yes');exit;end;\n\twrite('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1506217216, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03592.html", "problem_id": "p03592", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03592/input.txt", "sample_output_relpath": "derived/input_output/data/p03592/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03592/Pascal/s653378641.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s653378641", "user_id": "u768548097"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,j,k,t,s,n,m:longint;\nbegin\n\treadln(n,m,k);\n\tfor i:=0 to n do for j:=0 to m do if i*n+j*m=k+i*j*2 then \n\t\tbegin write('Yes');exit;end;\n\twrite('No');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03592", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s084000606", "group_id": "codeNet:p03593", "input_text": "var i,j:longint;\n n,m,num2,num4:longint;\n ch:char;\n num:array['a'..'z']of longint;\n have:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(ch);\n inc(num[ch]);\n end;\n readln;\n end;\n if (n mod 2=1)and(m mod 2=1) then num4:=((n-1)div 2) * ((m-1) div 2) else\n if (n mod 2=0)and(m mod 2=1) then num4:=( n div 2) * ((m-1) div 2) else\n if (n mod 2=1)and(m mod 2=0) then num4:=((n-1)div 2) * ( m div 2) else\n if (n mod 2=0)and(m mod 2=0) then num4:=( n div 2) * ( m div 2);\n for i:=97 to 122 do\n if (num[char(i)]>=4)and(num4>0) then\n begin\n have:=num[char(i)]div 4;\n if have>num4 then\n begin\n num4:=0;\n dec(num[char(i)],num4*4);\n end else\n begin\n dec(num4,have);\n dec(num[char(i)],have*4);\n end;\n end;\n if num4>0 then\n begin\n writeln('No');\n exit;\n end;\n if (n mod 2=1)and(m mod 2=1) then num2:=(n-1) div 2+(m-1) div 2 else\n if (n mod 2=0)and(m mod 2=1) then num2:=n div 2 else\n if (n mod 2=1)and(m mod 2=0) then num2:=m div 2 else\n if (n mod 2=0)and(m mod 2=0) then num2:=0;\n for i:=97 to 122 do\n if (num[char(i)]>=2)and(num2>0) then\n begin\n have:=num[char(i)] div 2;\n if have>num2 then num2:=0 else dec(num2,have);\n end;\n if num2>0 then\n begin\n writeln('No');\n exit;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1506230353, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03593.html", "problem_id": "p03593", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03593/input.txt", "sample_output_relpath": "derived/input_output/data/p03593/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03593/Pascal/s084000606.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s084000606", "user_id": "u809476955"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,j:longint;\n n,m,num2,num4:longint;\n ch:char;\n num:array['a'..'z']of longint;\n have:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(ch);\n inc(num[ch]);\n end;\n readln;\n end;\n if (n mod 2=1)and(m mod 2=1) then num4:=((n-1)div 2) * ((m-1) div 2) else\n if (n mod 2=0)and(m mod 2=1) then num4:=( n div 2) * ((m-1) div 2) else\n if (n mod 2=1)and(m mod 2=0) then num4:=((n-1)div 2) * ( m div 2) else\n if (n mod 2=0)and(m mod 2=0) then num4:=( n div 2) * ( m div 2);\n for i:=97 to 122 do\n if (num[char(i)]>=4)and(num4>0) then\n begin\n have:=num[char(i)]div 4;\n if have>num4 then\n begin\n num4:=0;\n dec(num[char(i)],num4*4);\n end else\n begin\n dec(num4,have);\n dec(num[char(i)],have*4);\n end;\n end;\n if num4>0 then\n begin\n writeln('No');\n exit;\n end;\n if (n mod 2=1)and(m mod 2=1) then num2:=(n-1) div 2+(m-1) div 2 else\n if (n mod 2=0)and(m mod 2=1) then num2:=n div 2 else\n if (n mod 2=1)and(m mod 2=0) then num2:=m div 2 else\n if (n mod 2=0)and(m mod 2=0) then num2:=0;\n for i:=97 to 122 do\n if (num[char(i)]>=2)and(num2>0) then\n begin\n have:=num[char(i)] div 2;\n if have>num2 then num2:=0 else dec(num2,have);\n end;\n if num2>0 then\n begin\n writeln('No');\n exit;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11}a_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "sample_input": "3 4\naabb\naabb\naacc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03593", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11}a_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1350, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s235816413", "group_id": "codeNet:p03594", "input_text": "var\n s:string;\n i,j,n,m,d,x,y:longint;\nbegin\n s:='RGBY';\n readln(n,m,d);\n for i:=0 to n-1 do\n begin\n for j:=0 to m-1 do\n begin\n x:=(m+i+j)div d mod 2;\n y:=(m+i-j)div d mod 2;\n write(s[2*x+y+1]);\n end;\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1561659579, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03594.html", "problem_id": "p03594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03594/input.txt", "sample_output_relpath": "derived/input_output/data/p03594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03594/Pascal/s235816413.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s235816413", "user_id": "u247366051"}, "prompt_components": {"gold_output": "RY\nGR\n", "input_to_evaluate": "var\n s:string;\n i,j,n,m,d,x,y:longint;\nbegin\n s:='RGBY';\n readln(n,m,d);\n for i:=0 to n-1 do\n begin\n for j:=0 to m-1 do\n begin\n x:=(m+i+j)div d mod 2;\n y:=(m+i-j)div d mod 2;\n write(s[2*x+y+1]);\n end;\n writeln;\n end;\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "sample_input": "2 2 1\n"}, "reference_outputs": ["RY\nGR\n"], "source_document_id": "p03594", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 15, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s306371412", "group_id": "codeNet:p03594", "input_text": "var\n n,m,j,i,d,x,y:longint;\nbegin\n readln(n,m,d);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n x:=(i+j+m-2) div d mod 2;\n y:=(i-j+m) div d mod 2;\n case 2*x+y of\n 0:write('R');\n 1:write('G');\n 2:write('B');\n 3:write('Y');\n end;\n end;\n writeln;\n end; \nend.", "language": "Pascal", "metadata": {"date": 1530838561, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03594.html", "problem_id": "p03594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03594/input.txt", "sample_output_relpath": "derived/input_output/data/p03594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03594/Pascal/s306371412.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s306371412", "user_id": "u699596082"}, "prompt_components": {"gold_output": "RY\nGR\n", "input_to_evaluate": "var\n n,m,j,i,d,x,y:longint;\nbegin\n readln(n,m,d);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n x:=(i+j+m-2) div d mod 2;\n y:=(i-j+m) div d mod 2;\n case 2*x+y of\n 0:write('R');\n 1:write('G');\n 2:write('B');\n 3:write('Y');\n end;\n end;\n writeln;\n end; \nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "sample_input": "2 2 1\n"}, "reference_outputs": ["RY\nGR\n"], "source_document_id": "p03594", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 16, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s161522886", "group_id": "codeNet:p03594", "input_text": "var\n s:string;\n i,j,n,m,d,x,y:longint;\nbegin\n s:='RGBY';\n readln(n,m,d);\n for i:=0 to n-1 do\n begin\n for j:=0 to m-1 do\n begin\n x:=(m+i+j)div d mod 2;\n\ty:=(m+i-j)div d mod 2;\n\twrite(s[2*x+y+1]);\n end;\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1530835905, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03594.html", "problem_id": "p03594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03594/input.txt", "sample_output_relpath": "derived/input_output/data/p03594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03594/Pascal/s161522886.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s161522886", "user_id": "u603541616"}, "prompt_components": {"gold_output": "RY\nGR\n", "input_to_evaluate": "var\n s:string;\n i,j,n,m,d,x,y:longint;\nbegin\n s:='RGBY';\n readln(n,m,d);\n for i:=0 to n-1 do\n begin\n for j:=0 to m-1 do\n begin\n x:=(m+i+j)div d mod 2;\n\ty:=(m+i-j)div d mod 2;\n\twrite(s[2*x+y+1]);\n end;\n writeln;\n end;\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "sample_input": "2 2 1\n"}, "reference_outputs": ["RY\nGR\n"], "source_document_id": "p03594", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 15, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s517481415", "group_id": "codeNet:p03594", "input_text": "var a:array[-1..501,-1..501,1..4]of boolean;\n\tb:array[-1..501,-1..501]of integer;\n\th,w,d,i,j,k,t,s,be,en:longint;\nbegin\n\treadln(h,w,d);\n\tfillchar(a,sizeof(a),true);\n\tfor i:=1 to h do for j:=1 to w do begin\n\t\tk:=1;\n\t\twhile not a[i,j,k] do inc(k);\n\t\tb[i,j]:=k;\n\t\t//if j+d<=w then a[i,j+d,k]:=false;\n\t\t//if i+d<=h then a[i+d,j,k]:=false;\n\t\tbe:=i;en:=h;\n\t\tif j-d<1 then be:=i+(d-j);\n\t\tif i+d0)and(a*i+b*j=k*c+q*d) then\n begin\n sugar:=k*c+q*d;\n if (sugar)/(x+sugar)>max then\n begin\n max:=(sugar)/(x+sugar);\n ansx:=x;\n ansy:=sugar;\n end;\n end;\n end;\n if ansx+ansy=0 then writeln(a,' ',0) else writeln(ansx+ansy,' ',ansy);\nend.", "language": "Pascal", "metadata": {"date": 1505615267, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03599.html", "problem_id": "p03599", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03599/input.txt", "sample_output_relpath": "derived/input_output/data/p03599/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03599/Pascal/s689159953.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s689159953", "user_id": "u809476955"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var a,b,c,d,e,f:longint;\n max:double;\n ansx,ansy,x:longint;\n i,j,k,q:longint;\n sugar:longint;\nbegin\n read(a,b,c,d,e,f);\n a:=a*100;\n b:=b*100;\n for i:=0 to f div a do\n for j:=0 to (f-a*i) div b do\n if (i+j>0)and(a*i+b*j=k*c+q*d) then\n begin\n sugar:=k*c+q*d;\n if (sugar)/(x+sugar)>max then\n begin\n max:=(sugar)/(x+sugar);\n ansx:=x;\n ansy:=sugar;\n end;\n end;\n end;\n if ansx+ansy=0 then writeln(a,' ',0) else writeln(ansx+ansy,' ',ansy);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03599", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 751, "cpu_time_ms": 33, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s763435944", "group_id": "codeNet:p03599", "input_text": "var a,b,c,d,e,f:longint;\n max:double;\n ansx,ansy,x:longint;\n i,j,k,q:longint;\n sugar:longint;\nbegin\n read(a,b,c,d,e,f);\n a:=a*100;\n b:=b*100;\n for i:=0 to f div a do\n for j:=0 to (f-a*i) div b do\n if (i+j>0)and(a*i+b*j=k*c+q*d) then\n begin\n sugar:=k*c+q*d;\n if (sugar)/(x+sugar)>max then\n begin\n max:=(sugar)/(x+sugar);\n ansx:=x;\n ansy:=sugar;\n writeln(k,' ',q);\n end;\n end;\n end;\n if ansx+ansy=0 then writeln(a,' ',0) else writeln(ansx+ansy,' ',ansy);\nend.", "language": "Pascal", "metadata": {"date": 1505615248, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03599.html", "problem_id": "p03599", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03599/input.txt", "sample_output_relpath": "derived/input_output/data/p03599/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03599/Pascal/s763435944.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s763435944", "user_id": "u809476955"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var a,b,c,d,e,f:longint;\n max:double;\n ansx,ansy,x:longint;\n i,j,k,q:longint;\n sugar:longint;\nbegin\n read(a,b,c,d,e,f);\n a:=a*100;\n b:=b*100;\n for i:=0 to f div a do\n for j:=0 to (f-a*i) div b do\n if (i+j>0)and(a*i+b*j=k*c+q*d) then\n begin\n sugar:=k*c+q*d;\n if (sugar)/(x+sugar)>max then\n begin\n max:=(sugar)/(x+sugar);\n ansx:=x;\n ansy:=sugar;\n writeln(k,' ',q);\n end;\n end;\n end;\n if ansx+ansy=0 then writeln(a,' ',0) else writeln(ansx+ansy,' ',ansy);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03599", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 781, "cpu_time_ms": 32, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s607260294", "group_id": "codeNet:p03601", "input_text": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tif(a=1)and(b=2)and(c=1)and(d=2)and(e=100)and(f=1000)then begin\n\t\twriteln('200 100');\n\t\texit;\n\tend;\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to (f-100*a*i)div(100*b)do begin\n\t\t\ttmp:=a*i+b*j;\n\t\t\tfor k:=0 to (f-100*tmp)div c do begin\n\t\t\t\tfor l:=0 to (f-100*tmp-c*k)div d do begin\n\t\t\t\t\tif(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+ansb;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.", "language": "Pascal", "metadata": {"date": 1538094911, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s607260294.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s607260294", "user_id": "u657913472"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tif(a=1)and(b=2)and(c=1)and(d=2)and(e=100)and(f=1000)then begin\n\t\twriteln('200 100');\n\t\texit;\n\tend;\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to (f-100*a*i)div(100*b)do begin\n\t\t\ttmp:=a*i+b*j;\n\t\t\tfor k:=0 to (f-100*tmp)div c do begin\n\t\t\t\tfor l:=0 to (f-100*tmp-c*k)div d do begin\n\t\t\t\t\tif(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+ansb;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 587, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s915383040", "group_id": "codeNet:p03601", "input_text": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to (f-100*a*i)div(100*b)do begin\n\t\t\tfor k:=0 to (f-100*(a*i+b*j))div c do begin\n\t\t\t\tfor l:=0 to (f-100*(a*i+b*j)-c*k)div d do begin\n\t\t\t\t\tif((a*i+b*j)*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*(a*i+b*j)+c*k+d*l))then begin\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+c*k+d*l;\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.\n", "language": "Pascal", "metadata": {"date": 1538094086, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s915383040.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s915383040", "user_id": "u657913472"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to (f-100*a*i)div(100*b)do begin\n\t\t\tfor k:=0 to (f-100*(a*i+b*j))div c do begin\n\t\t\t\tfor l:=0 to (f-100*(a*i+b*j)-c*k)div d do begin\n\t\t\t\t\tif((a*i+b*j)*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*(a*i+b*j)+c*k+d*l))then begin\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+c*k+d*l;\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 494, "cpu_time_ms": 8, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s080962431", "group_id": "codeNet:p03601", "input_text": "program V1506;\n var\n a,b,c,d,e,g,h,f,i,j,k,l,n,o:longint;\n m:real;\n begin\n readln(a,b,c,d,e,f);\n m:=0;\n for i:=0 to trunc(f/100) div a do\n for j:=0 to (trunc(f/100)-i*a) div b do\n for k:=0 to (f-(i*a+j*b)*100) div c do\n for l:=0 to (f-(i*a+j*b)*100-k*c) div d do\n if i+j>0 then\n begin\n g:=i*a+j*b;\n h:=k*c+l*d;\n if h>g*e then continue;\n if h/(g+h)>m then\n begin\n m:=h/(g+h);\n n:=g;\n o:=h;\n end;\n end;\n writeln(n*100+o,' ',o);\n end.\n", "language": "Pascal", "metadata": {"date": 1510179818, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s080962431.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s080962431", "user_id": "u018679195"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "program V1506;\n var\n a,b,c,d,e,g,h,f,i,j,k,l,n,o:longint;\n m:real;\n begin\n readln(a,b,c,d,e,f);\n m:=0;\n for i:=0 to trunc(f/100) div a do\n for j:=0 to (trunc(f/100)-i*a) div b do\n for k:=0 to (f-(i*a+j*b)*100) div c do\n for l:=0 to (f-(i*a+j*b)*100-k*c) div d do\n if i+j>0 then\n begin\n g:=i*a+j*b;\n h:=k*c+l*d;\n if h>g*e then continue;\n if h/(g+h)>m then\n begin\n m:=h/(g+h);\n n:=g;\n o:=h;\n end;\n end;\n writeln(n*100+o,' ',o);\n end.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 535, "cpu_time_ms": 9, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s831747294", "group_id": "codeNet:p03601", "input_text": "program V1506;\n var\n a,b,c,d,e,g,h,f,i,j,k,l,n,o:longint;\n m:real;\n begin\n readln(a,b,c,d,e,f);\n m:=0;\n for i:=0 to f div 100 div a do\n for j:=0 to (f div 100-i*a) div b do\n for k:=0 to (f-(i*a+j*b)*100) div c do\n for l:=0 to (f-(i*a+j*b)*100-k*c) div d do\n if i+j>0 then\n begin\n g:=i*a+j*b;\n h:=k*c+l*d;\n if h>g*e then continue;\n if h/(g+h)>m then\n begin\n m:=h/(g+h);\n n:=g;\n o:=h;\n end;\n end;\n writeln(n*100+o,' ',o);\n end.\n", "language": "Pascal", "metadata": {"date": 1510179508, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s831747294.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s831747294", "user_id": "u863370423"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "program V1506;\n var\n a,b,c,d,e,g,h,f,i,j,k,l,n,o:longint;\n m:real;\n begin\n readln(a,b,c,d,e,f);\n m:=0;\n for i:=0 to f div 100 div a do\n for j:=0 to (f div 100-i*a) div b do\n for k:=0 to (f-(i*a+j*b)*100) div c do\n for l:=0 to (f-(i*a+j*b)*100-k*c) div d do\n if i+j>0 then\n begin\n g:=i*a+j*b;\n h:=k*c+l*d;\n if h>g*e then continue;\n if h/(g+h)>m then\n begin\n m:=h/(g+h);\n n:=g;\n o:=h;\n end;\n end;\n writeln(n*100+o,' ',o);\n end.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 529, "cpu_time_ms": 9, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s089681602", "group_id": "codeNet:p03602", "input_text": "var\n n,i,j,k,t,q:longint;\n total:qword;\n a,b:array[1..300,1..300]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n for j:=1 to n do read(a[i,j]);\n b:=a;\n for i:=1 to n do\n for j:=i+1 to n do\n begin\n t:=0; q:=b[i,j];\n for k:=1 to n do if (k<>i)and(k<>j) then\n begin\n if (k<>i)and(k<>j)then\n begin\n if b[i,j]>b[i,k]+b[k,j] then\n begin\n inc(t);\n if q>b[i,k]+b[k,j] then q:=b[i,k]+b[k,j];\n end;\n if b[i,j]i)and(k<>j) then\n begin\n if (k<>i)and(k<>j)then\n begin\n if b[i,j]>b[i,k]+b[k,j] then\n begin\n inc(t);\n if q>b[i,k]+b[k,j] then q:=b[i,k]+b[k,j];\n end;\n if b[i,j]i)and(k<>j) then\n begin\n if (k<>i)and(k<>j)then\n begin\n if b[i,j]>b[i,k]+b[k,j] then\n begin\n inc(t);\n if q>b[i,k]+b[k,j] then q:=b[i,k]+b[k,j];\n end;\n if b[i,j]i)and(k<>j) then\n begin\n if (k<>i)and(k<>j)then\n begin\n if b[i,j]>b[i,k]+b[k,j] then\n begin\n inc(t);\n if q>b[i,k]+b[k,j] then q:=b[i,k]+b[k,j];\n end;\n if b[i,j]i)and(k<>j) then\n begin\n if (k<>i)and(k<>j)then\n begin\n if b[i,j]>b[i,k]+b[k,j] then inc(t);\n if b[i,j]i)and(k<>j) then\n begin\n if (k<>i)and(k<>j)then\n begin\n if b[i,j]>b[i,k]+b[k,j] then inc(t);\n if b[i,j]>1];\n repeat\n while a[i]j) then\n begin\n y:=a[i];a[i]:=a[j];\n a[j]:=y;inc(i);dec(j);\n end;\n until i>j;\n if ll then\n begin\n quickly_sort(a,l,r);\n i:=l;\n for i:=l to r do\n begin\n j:=i; \n while j>pred(l) do\n if a[j]b then\n exit(a);\n exit(b);\nend;\nfunction min(a,b:longint):longint;inline;\nbegin\n if a>b then\n exit(b);\n exit(a);\nend;\nfunction endl:ansistring;inline;\nbegin\n writeln;exit('');\nend;\nvar a:array[0..1000000]of longint;\n n,ans,i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n sort(a,1,n);\n i:=1;\n while i>1];\n repeat\n while a[i]j) then\n begin\n y:=a[i];a[i]:=a[j];\n a[j]:=y;inc(i);dec(j);\n end;\n until i>j;\n if ll then\n begin\n quickly_sort(a,l,r);\n i:=l;\n for i:=l to r do\n begin\n j:=i; \n while j>pred(l) do\n if a[j]b then\n exit(a);\n exit(b);\nend;\nfunction min(a,b:longint):longint;inline;\nbegin\n if a>b then\n exit(b);\n exit(a);\nend;\nfunction endl:ansistring;inline;\nbegin\n writeln;exit('');\nend;\nvar a:array[0..1000000]of longint;\n n,ans,i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n sort(a,1,n);\n i:=1;\n while im do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t; \n inc(i); dec(j);\n end; \n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t; \n inc(i); dec(j);\n end; \n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t; \n inc(i); dec(j);\n end; \n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t; \n inc(i); dec(j);\n end; \n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t; \n inc(i); dec(j);\n end; \n until i>j;\n if lm do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t; \n inc(i); dec(j);\n end; \n until i>j;\n if lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lm do dec(p);\n if o<=p then\n begin\n t:=a[o];\n a[o]:=a[p];\n a[p]:=t;\n inc(o);\n dec(p);\n end;\n until o>p;\n if oa[i-1] then\n begin\n if p mod 2=1 then inc(s);\n p:=1;\n end\n else inc(p);\n writeln(s);\n end.\n", "language": "Pascal", "metadata": {"date": 1510174287, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s012480767.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s012480767", "user_id": "u018679195"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program V1503;\n var\n a:array[0..100001] of longint;\n i,n,s,p:longint;\n procedure haha(l,r:longint);\n var\n o,p,m,t:longint;\n begin\n o:=l;\n p:=r;\n m:=a[(l+r) div 2];\n repeat\n while a[o]m do dec(p);\n if o<=p then\n begin\n t:=a[o];\n a[o]:=a[p];\n a[p]:=t;\n inc(o);\n dec(p);\n end;\n until o>p;\n if oa[i-1] then\n begin\n if p mod 2=1 then inc(s);\n p:=1;\n end\n else inc(p);\n writeln(s);\n end.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 714, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s164582163", "group_id": "codeNet:p03607", "input_text": "var n,i,j,ans:longint;\nvar a:array[0..100020] of longint;\nprocedure qsort(l,r:longint);\nvar i,j,mid,t:longint;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l>1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l>1];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if num mod 2=1 then inc(ans);\n num:=1;\n end else inc(num);\n if num mod 2=1 then inc(ans);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1505005966, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s006613812.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s006613812", "user_id": "u809476955"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n:longint;\n i:longint;\n a:array[0..200050]of longint;\n num,ans:longint;\n\nprocedure qs(l,r:longint);\nvar i,j,m,t:longint;\nbegin\n i:=l;\n j:=r;\n m:=a[(l+r)>>1];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if num mod 2=1 then inc(ans);\n num:=1;\n end else inc(num);\n if num mod 2=1 then inc(ans);\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 26, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s850685612", "group_id": "codeNet:p03610", "input_text": "var\n st:ansistring;\n i:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n if i mod 2=1 then write(st[i]);\n writeln;\nend.", "language": "Pascal", "metadata": {"date": 1554165264, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s850685612.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s850685612", "user_id": "u247366051"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n st:ansistring;\n i:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n if i mod 2=1 then write(st[i]);\n writeln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 132, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s718771112", "group_id": "codeNet:p03610", "input_text": "var\n st:ansistring;\n i:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n if i mod 2=1 then write(st[i]);\n writeln;\nend.", "language": "Pascal", "metadata": {"date": 1545959534, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s718771112.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718771112", "user_id": "u476418095"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n st:ansistring;\n i:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n if i mod 2=1 then write(st[i]);\n writeln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 132, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s392349633", "group_id": "codeNet:p03610", "input_text": "var s,t:String;i:Longint;\nbegin\nsetlength(s,100000);\nreadln(s);\nsetlength(t,50000);\nfor i:=1 to 50000 do\n\tt[i]:=s[i*2-1];\nwrite(t);\nend.", "language": "Pascal", "metadata": {"date": 1542914013, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s392349633.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s392349633", "user_id": "u657913472"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s,t:String;i:Longint;\nbegin\nsetlength(s,100000);\nreadln(s);\nsetlength(t,50000);\nfor i:=1 to 50000 do\n\tt[i]:=s[i*2-1];\nwrite(t);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s583018156", "group_id": "codeNet:p03610", "input_text": "var s,t:String;i:Longint;\nbegin\nsetlength(s,100000);\nreadln(s);\nsetlength(t,(length(s)+1)div 2);\nfor i:=1 to length(t)do\n\tt[i]:=s[i*2-1];\nwrite(t);\nend.", "language": "Pascal", "metadata": {"date": 1542913956, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s583018156.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s583018156", "user_id": "u657913472"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s,t:String;i:Longint;\nbegin\nsetlength(s,100000);\nreadln(s);\nsetlength(t,(length(s)+1)div 2);\nfor i:=1 to length(t)do\n\tt[i]:=s[i*2-1];\nwrite(t);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s309792969", "group_id": "codeNet:p03610", "input_text": "var s,t:String;i:Longint;\nbegin\nreadln(s);\nsetlength(t,(length(s)+1)div 2);\nfor i:=1 to length(t)do\n\tt[i]:=s[i*2-1];\nwrite(t);\nend.", "language": "Pascal", "metadata": {"date": 1542913929, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s309792969.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309792969", "user_id": "u657913472"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s,t:String;i:Longint;\nbegin\nreadln(s);\nsetlength(t,(length(s)+1)div 2);\nfor i:=1 to length(t)do\n\tt[i]:=s[i*2-1];\nwrite(t);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s356153160", "group_id": "codeNet:p03610", "input_text": "var\nf:string;\ni:longint;\nbegin\nread(f);\nfor i:=1 to length(f) do\n begin\n if i mod 2<>0 then write(f[i]);\n end;\nwriteln;\nend.", "language": "Pascal", "metadata": {"date": 1540350212, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s356153160.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s356153160", "user_id": "u247366051"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\nf:string;\ni:longint;\nbegin\nread(f);\nfor i:=1 to length(f) do\n begin\n if i mod 2<>0 then write(f[i]);\n end;\nwriteln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s619749023", "group_id": "codeNet:p03610", "input_text": "var\n s:string;\n i:longint;\nbegin\n read(s);\n for i:=1 to length(s) do \n if i mod 2=1 then write(S[i]);\n writeln;\nend.", "language": "Pascal", "metadata": {"date": 1538851541, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s619749023.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s619749023", "user_id": "u263933075"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n s:string;\n i:longint;\nbegin\n read(s);\n for i:=1 to length(s) do \n if i mod 2=1 then write(S[i]);\n writeln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s055528356", "group_id": "codeNet:p03610", "input_text": "var\n s:ansistring;\n i:longint;\nbegin\n readln(s);\n write(s[1]);\n for i:=1 to length(s) div 2 do write(s[i*2+1]);\n writeln;\nend.", "language": "Pascal", "metadata": {"date": 1538795353, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s055528356.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s055528356", "user_id": "u723721005"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n s:ansistring;\n i:longint;\nbegin\n readln(s);\n write(s[1]);\n for i:=1 to length(s) div 2 do write(s[i*2+1]);\n writeln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s553207428", "group_id": "codeNet:p03610", "input_text": "var\n s:ansistring;\n i:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if odd(i) then write(s[i]);\nend.", "language": "Pascal", "metadata": {"date": 1534896435, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s553207428.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s553207428", "user_id": "u426964396"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n s:ansistring;\n i:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if odd(i) then write(s[i]);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 109, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s682642381", "group_id": "codeNet:p03610", "input_text": "var s:ansistring ;\n i:longint ;\nbegin \n readln(s) ;\n\t for i:=1 to length(s) do \n\t if i mod 2=1 then write(s[i]) ;\n\t writeln ;\nend.", "language": "Pascal", "metadata": {"date": 1504401430, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s682642381.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s682642381", "user_id": "u049262741"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s:ansistring ;\n i:longint ;\nbegin \n readln(s) ;\n\t for i:=1 to length(s) do \n\t if i mod 2=1 then write(s[i]) ;\n\t writeln ;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s711182469", "group_id": "codeNet:p03610", "input_text": "var s:ansistring;\n i:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if i mod 2=1 then write(s[i]);\n writeln;\nend.", "language": "Pascal", "metadata": {"date": 1504400739, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s711182469.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s711182469", "user_id": "u809476955"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s:ansistring;\n i:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if i mod 2=1 then write(s[i]);\n writeln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 127, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s979451467", "group_id": "codeNet:p03611", "input_text": "var f:array[0..100000]of longint;\n n,a,ans,i:longint;\nbegin\n readln(n);\n for n:=1 to n do\n begin\n read(a);\n inc(f[a-1]);\n inc(f[a+1]);\n inc(f[a]);\n end;\n for i:=1 to 100000 do\n if f[i]>ans then\n ans:=f[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1583525552, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03611.html", "problem_id": "p03611", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03611/input.txt", "sample_output_relpath": "derived/input_output/data/p03611/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03611/Pascal/s979451467.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s979451467", "user_id": "u743614777"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var f:array[0..100000]of longint;\n n,a,ans,i:longint;\nbegin\n readln(n);\n for n:=1 to n do\n begin\n read(a);\n inc(f[a-1]);\n inc(f[a+1]);\n inc(f[a]);\n end;\n for i:=1 to 100000 do\n if f[i]>ans then\n ans:=f[i];\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03611", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s229235024", "group_id": "codeNet:p03611", "input_text": "uses math ;\nvar n,t,i,ans,k:longint ;\n a:array[-1..100000] of longint ;\nbegin\n readln(n) ;\n\t for i:=1 to n do \n\t begin \n\t read(k) ;\n\t\t inc(a[k]) ;\n\t\t inc(a[k-1]) ;\n\t\t inc(a[k+1]) ;\n\t\t t:=max(t,k) ;\n\t end;\n\t for i:=1 to t do \n\t if a[i]>ans then ans:=a[i] ;\n\t writeln(ans) ;\nend.", "language": "Pascal", "metadata": {"date": 1504402257, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03611.html", "problem_id": "p03611", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03611/input.txt", "sample_output_relpath": "derived/input_output/data/p03611/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03611/Pascal/s229235024.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s229235024", "user_id": "u049262741"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "uses math ;\nvar n,t,i,ans,k:longint ;\n a:array[-1..100000] of longint ;\nbegin\n readln(n) ;\n\t for i:=1 to n do \n\t begin \n\t read(k) ;\n\t\t inc(a[k]) ;\n\t\t inc(a[k-1]) ;\n\t\t inc(a[k+1]) ;\n\t\t t:=max(t,k) ;\n\t end;\n\t for i:=1 to t do \n\t if a[i]>ans then ans:=a[i] ;\n\t writeln(ans) ;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03611", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s328021484", "group_id": "codeNet:p03612", "input_text": "var n:longint;\n i:longint;\n v:array[0..100050]of boolean;\n x:longint;\n last:longint;\n ans:int64;\nbegin\n read(n);\n for i:=1 to n do\n begin\n read(x);\n if i=x then v[i]:=true;\n end;\n\n for i:=1 to n do\n begin\n if (v[i])and(not v[i-1]) then last:=i-1;\n if (v[i])and(not v[i+1]) then\n begin\n ans:=ans+(i-last)div 2;\n if (i-last) mod 2=1 then inc(ans);\n end;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1504401964, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03612.html", "problem_id": "p03612", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03612/input.txt", "sample_output_relpath": "derived/input_output/data/p03612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03612/Pascal/s328021484.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s328021484", "user_id": "u809476955"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n:longint;\n i:longint;\n v:array[0..100050]of boolean;\n x:longint;\n last:longint;\n ans:int64;\nbegin\n read(n);\n for i:=1 to n do\n begin\n read(x);\n if i=x then v[i]:=true;\n end;\n\n for i:=1 to n do\n begin\n if (v[i])and(not v[i-1]) then last:=i-1;\n if (v[i])and(not v[i+1]) then\n begin\n ans:=ans+(i-last)div 2;\n if (i-last) mod 2=1 then inc(ans);\n end;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "sample_input": "5\n1 4 3 5 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03612", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 428, "cpu_time_ms": 12, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s851090896", "group_id": "codeNet:p03612", "input_text": "var n,i,ans:longint;\nvar r:boolean;\nvar a:array[0..100020] of longint;\nbegin\n r:=false;\n read(n);for i:=1 to n do\n begin\n read(a[i]);\n if r then r:=false\n else if a[i]=i then begin inc(ans);r:=true;end;\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1504401626, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03612.html", "problem_id": "p03612", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03612/input.txt", "sample_output_relpath": "derived/input_output/data/p03612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03612/Pascal/s851090896.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s851090896", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,i,ans:longint;\nvar r:boolean;\nvar a:array[0..100020] of longint;\nbegin\n r:=false;\n read(n);for i:=1 to n do\n begin\n read(a[i]);\n if r then r:=false\n else if a[i]=i then begin inc(ans);r:=true;end;\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "sample_input": "5\n1 4 3 5 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03612", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s242926761", "group_id": "codeNet:p03613", "input_text": "var a:array[-1..100005]of longint;\n n,i,max,min,l:longint;\nbegin\n readln(n);min:=-1;max:=maxlongint;\n for i:=1 to n do begin\n read(l);\n inc(a[l]);inc(a[l-1]);inc(a[l+1]);\n if (l+1)>max then max:=l+1;\n if (l-1)100000then max:=100000;\n end;l:=0;\n for i:=min to max do\n if a[i]>l then l:=a[i];\n writeln(l);\nend.", "language": "Pascal", "metadata": {"date": 1504406447, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03613.html", "problem_id": "p03613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03613/input.txt", "sample_output_relpath": "derived/input_output/data/p03613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03613/Pascal/s242926761.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s242926761", "user_id": "u541853053"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var a:array[-1..100005]of longint;\n n,i,max,min,l:longint;\nbegin\n readln(n);min:=-1;max:=maxlongint;\n for i:=1 to n do begin\n read(l);\n inc(a[l]);inc(a[l-1]);inc(a[l+1]);\n if (l+1)>max then max:=l+1;\n if (l-1)100000then max:=100000;\n end;l:=0;\n for i:=min to max do\n if a[i]>l then l:=a[i];\n writeln(l);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03613", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 422, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s270621419", "group_id": "codeNet:p03614", "input_text": "var\n\ts,a,n,i:Longint;\nbegin\n\tread(n);\n\ti:=1;\n\twhile i<=n do begin\n\t\tread(a);\n\t\tif a<>i then begin\n\t\t\tinc(s);\n\t\t\tread(a);\n\t\t\tinc(i);\n\t\tend;\n\t\tinc(i);\n\tend;\n\twriteln(s)\nend.\n", "language": "Pascal", "metadata": {"date": 1539753705, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03614.html", "problem_id": "p03614", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03614/input.txt", "sample_output_relpath": "derived/input_output/data/p03614/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03614/Pascal/s270621419.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s270621419", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ts,a,n,i:Longint;\nbegin\n\tread(n);\n\ti:=1;\n\twhile i<=n do begin\n\t\tread(a);\n\t\tif a<>i then begin\n\t\t\tinc(s);\n\t\t\tread(a);\n\t\t\tinc(i);\n\t\tend;\n\t\tinc(i);\n\tend;\n\twriteln(s)\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "sample_input": "5\n1 4 3 5 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03614", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s380941482", "group_id": "codeNet:p03625", "input_text": "const big_root_priority_queue=true;\n small_root_priority_queue=false;\ntype priority_queue=object\n private\n main:array of longint;\n size:longint;\n mode:boolean;\n public\n procedure init(a:boolean);\n procedure push(a:longint);\n function pop:longint;\n procedure top;\n function empty:boolean;\n end;\nprocedure priority_queue.init(a:boolean);\nbegin\n setlength(main,1);\n size:=0;mode:=a;\nend;\nprocedure priority_queue.push(a:longint);\nvar x,t:longint;\nbegin\n inc(size);\n setlength(main,size+1);\n main[size]:=a;\n x:=size;\n while x<>1 do\n if (main[x]>1]) xor mode then\n begin\n t:=main[x];\n main[x]:=main[x>>1];\n x:=x>>1;\n main[x]:=t;\n end\n else\n break;\nend;\nfunction priority_queue.pop:longint;\nbegin\n exit(main[1]);\nend;\nprocedure priority_queue.top;\nvar t,x:longint;\nbegin\n t:=main[1];\n main[1]:=main[size];\n main[size]:=t;\n dec(size);\n setlength(main,size+1);\n x:=1;\n while x<<1main[x<<1]) xor mode) then\n begin\n t:=main[x];main[x]:=main[x<<1];main[x<<1]:=t;\n end;\nend;\nfunction priority_queue.empty:boolean;\nbegin\n exit(size<>0);\nend;\nprocedure sort(var a:array of longint;l,r:longint);\nvar i:longint;\n x:priority_queue;\nbegin\n x.init(small_root_priority_queue);\n for i:=l to r do\n x.push(a[i]);\n for i:=l to r do\n begin \n a[i]:=x.pop;\n x.top;\n end;\nend;\nvar n,x,i:longint;\n cnt:array[0..2]of longint;\n a:array[0..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n sort(a,1,n);\n i:=n;\n while i>=1 do\n if a[i]=a[i-1] then\n begin\n inc(x);\n cnt[x]:=a[i];\n dec(i,2);\n if x=2 then\n break;\n end\n else\n dec(i,1);\n writeln(qword(cnt[1]*cnt[2]));\nend.", "language": "Pascal", "metadata": {"date": 1583523347, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s380941482.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s380941482", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const big_root_priority_queue=true;\n small_root_priority_queue=false;\ntype priority_queue=object\n private\n main:array of longint;\n size:longint;\n mode:boolean;\n public\n procedure init(a:boolean);\n procedure push(a:longint);\n function pop:longint;\n procedure top;\n function empty:boolean;\n end;\nprocedure priority_queue.init(a:boolean);\nbegin\n setlength(main,1);\n size:=0;mode:=a;\nend;\nprocedure priority_queue.push(a:longint);\nvar x,t:longint;\nbegin\n inc(size);\n setlength(main,size+1);\n main[size]:=a;\n x:=size;\n while x<>1 do\n if (main[x]>1]) xor mode then\n begin\n t:=main[x];\n main[x]:=main[x>>1];\n x:=x>>1;\n main[x]:=t;\n end\n else\n break;\nend;\nfunction priority_queue.pop:longint;\nbegin\n exit(main[1]);\nend;\nprocedure priority_queue.top;\nvar t,x:longint;\nbegin\n t:=main[1];\n main[1]:=main[size];\n main[size]:=t;\n dec(size);\n setlength(main,size+1);\n x:=1;\n while x<<1main[x<<1]) xor mode) then\n begin\n t:=main[x];main[x]:=main[x<<1];main[x<<1]:=t;\n end;\nend;\nfunction priority_queue.empty:boolean;\nbegin\n exit(size<>0);\nend;\nprocedure sort(var a:array of longint;l,r:longint);\nvar i:longint;\n x:priority_queue;\nbegin\n x.init(small_root_priority_queue);\n for i:=l to r do\n x.push(a[i]);\n for i:=l to r do\n begin \n a[i]:=x.pop;\n x.top;\n end;\nend;\nvar n,x,i:longint;\n cnt:array[0..2]of longint;\n a:array[0..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n sort(a,1,n);\n i:=n;\n while i>=1 do\n if a[i]=a[i-1] then\n begin\n inc(x);\n cnt[x]:=a[i];\n dec(i,2);\n if x=2 then\n break;\n end\n else\n dec(i,1);\n writeln(qword(cnt[1]*cnt[2]));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2340, "cpu_time_ms": 43, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s336932880", "group_id": "codeNet:p03625", "input_text": " var\n a:array[0..10000000]of byte;\n i,n,c,max,m:longint;\n flag:boolean;\n begin\n fillchar(a,sizeof(a),0);max:=0;\n read(n);\n for i:=1 to n do\n begin\n read(c);\n if c>max then max:=c;\n if (a[c]<=4)then inc(a[c]);\n end;\n flag:=true;m:=0;\n for i:=max downto 1 do\n begin\n if (a[i]>=4)and(m=0)then begin writeln(i*i);halt;end;\n if (a[i]>=2) then if m=0 then m:=i\n else begin writeln(m*i);halt;end;\n end;\n writeln(0);\n end. ", "language": "Pascal", "metadata": {"date": 1504378567, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s336932880.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s336932880", "user_id": "u675137679"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " var\n a:array[0..10000000]of byte;\n i,n,c,max,m:longint;\n flag:boolean;\n begin\n fillchar(a,sizeof(a),0);max:=0;\n read(n);\n for i:=1 to n do\n begin\n read(c);\n if c>max then max:=c;\n if (a[c]<=4)then inc(a[c]);\n end;\n flag:=true;m:=0;\n for i:=max downto 1 do\n begin\n if (a[i]>=4)and(m=0)then begin writeln(i*i);halt;end;\n if (a[i]>=2) then if m=0 then m:=i\n else begin writeln(m*i);halt;end;\n end;\n writeln(0);\n end. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 706, "cpu_time_ms": 4, "memory_kb": 9856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s017696947", "group_id": "codeNet:p03625", "input_text": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l1 then begin if x=0 then x:=a[i] else y:=a[i];end;\n if y>0 then break;\n if (num>=4) then begin y:=a[i];break;end;\n end;\n writeln(x*y);\nend.", "language": "Pascal", "metadata": {"date": 1503280707, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s017696947.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s017696947", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l1 then begin if x=0 then x:=a[i] else y:=a[i];end;\n if y>0 then break;\n if (num>=4) then begin y:=a[i];break;end;\n end;\n writeln(x*y);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 702, "cpu_time_ms": 24, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s383538350", "group_id": "codeNet:p03625", "input_text": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then if x=0 then x:=a[i] else y:=a[i];\n if y>0 then break;\n end;\n writeln(x*y);\nend.\n", "language": "Pascal", "metadata": {"date": 1503279985, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s383538350.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s383538350", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then if x=0 then x:=a[i] else y:=a[i];\n if y>0 then break;\n end;\n writeln(x*y);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 647, "cpu_time_ms": 24, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s335426069", "group_id": "codeNet:p03625", "input_text": "var a:array[0..10020] of longint;\nvar n,i,j,ans,x,y,num:longint;\nprocedure qsort(l,r:longint);\nvar i,j,mid,t:longint;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then if x=0 then x:=a[i] else y:=a[i];\n if y>0 then break;\n end;\n writeln(x*y);\nend.", "language": "Pascal", "metadata": {"date": 1503279756, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s335426069.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s335426069", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array[0..10020] of longint;\nvar n,i,j,ans,x,y,num:longint;\nprocedure qsort(l,r:longint);\nvar i,j,mid,t:longint;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then if x=0 then x:=a[i] else y:=a[i];\n if y>0 then break;\n end;\n writeln(x*y);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 642, "cpu_time_ms": 109, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s407235735", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=-1000 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "language": "Pascal", "metadata": {"date": 1509564659, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Pascal/s340363197.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s340363197", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=-1000 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 873, "cpu_time_ms": 25, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s545641851", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta,b,site:array[1..100001] of longint;\n\tn,m,i,j,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "language": "Pascal", "metadata": {"date": 1509564147, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Pascal/s545641851.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s545641851", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\ta,b,site:array[1..100001] of longint;\n\tn,m,i,j,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 851, "cpu_time_ms": 25, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s375407166", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta:array[1..100001] of longint;\n\tn,m,i,j,max,sum,sum1:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=l[6-i] then begin\n Writeln(l[6-i]);\n break;\n end;\n end;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1516990926, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03644.html", "problem_id": "p03644", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03644/input.txt", "sample_output_relpath": "derived/input_output/data/p03644/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03644/Pascal/s556595217.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s556595217", "user_id": "u755925739"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;\n l:array[0..6] of Integer = (1,2,4,8,16,32,64);\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n for I := 0 to 6 do begin\n if n>=l[6-i] then begin\n Writeln(l[6-i]);\n break;\n end;\n end;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.\n\nHere, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.\n\nFor example,\n\n6 can be divided by 2 once: 6 -> 3.\n\n8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.\n\n3 can be divided by 2 zero times.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n\n4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.\n\nSample Input 2\n\n32\n\nSample Output 2\n\n32\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100\n\nSample Output 4\n\n64", "sample_input": "7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03644", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.\n\nHere, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.\n\nFor example,\n\n6 can be divided by 2 once: 6 -> 3.\n\n8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.\n\n3 can be divided by 2 zero times.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n\n4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.\n\nSample Input 2\n\n32\n\nSample Output 2\n\n32\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100\n\nSample Output 4\n\n64", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 568, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s020639163", "group_id": "codeNet:p03645", "input_text": "var a,b:array[0..2000000]of boolean;\n n,m,i,s,e:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(s,e);\n if s=1 then a[e]:=true;\n if e=n then b[s]:=true;\n end;\n for i:=1 to n do\n if a[i] and b[i] then\n begin\n writeln('POSSIBLE');\n halt;\n end;\n writeln('IMPOSSIBLE');\nend.", "language": "Pascal", "metadata": {"date": 1583521713, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s020639163.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s020639163", "user_id": "u743614777"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "var a,b:array[0..2000000]of boolean;\n n,m,i,s,e:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(s,e);\n if s=1 then a[e]:=true;\n if e=n then b[s]:=true;\n end;\n for i:=1 to n do\n if a[i] and b[i] then\n begin\n writeln('POSSIBLE');\n halt;\n end;\n writeln('IMPOSSIBLE');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 44, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s823796355", "group_id": "codeNet:p03645", "input_text": "var a,b:array[0..2000000]of boolean;\n n,m,i,s,e:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(s,e);\n if s=1 then a[e]:=true;\n if e=n then b[s]:=true;\n end;\n for i:=1 to n do\n if a[i] and b[i] then\n writeln('POSSIBLE');\n writeln('IMPOSSIBLE');\nend.", "language": "Pascal", "metadata": {"date": 1583521656, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s823796355.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s823796355", "user_id": "u743614777"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "var a,b:array[0..2000000]of boolean;\n n,m,i,s,e:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(s,e);\n if s=1 then a[e]:=true;\n if e=n then b[s]:=true;\n end;\n for i:=1 to n do\n if a[i] and b[i] then\n writeln('POSSIBLE');\n writeln('IMPOSSIBLE');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 44, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s262478583", "group_id": "codeNet:p03645", "input_text": "var a,b:array[0..2000000]of boolean;\n n,m,i,s,e:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(s,e);\n if s=1 then a[e]:=true;\n if e=n then b[s]:=true;\n end;\n for i:=1 to m do\n if a[i] and b[i] then\n writeln('POSSIBLE');\n writeln('IMPOSSIBLE');\nend.", "language": "Pascal", "metadata": {"date": 1583521514, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s262478583.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s262478583", "user_id": "u743614777"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "var a,b:array[0..2000000]of boolean;\n n,m,i,s,e:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(s,e);\n if s=1 then a[e]:=true;\n if e=n then b[s]:=true;\n end;\n for i:=1 to m do\n if a[i] and b[i] then\n writeln('POSSIBLE');\n writeln('IMPOSSIBLE');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 45, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s605608649", "group_id": "codeNet:p03645", "input_text": "program V1004;\n var\n a:array[0..200001,0..1] of longint;\n i,m,n,x,y,u:longint;\n begin\n readln(n,m);\n fillchar(a,sizeof(a),0);\n a[1,0]:=1;\n a[n,1]:=1;\n for i:=1 to m do\n begin\n readln(x,y);\n if x=1 then inc(a[y,0]);\n if y=n then inc(a[x,1]);\n end;\n u:=0;\n for i:=1 to n do\n if (a[i,0]>0) and (a[i,1]>0) then u:=1;\n if u=1 then writeln('POSSIBLE')\n else writeln('IMPOSSIBLE');\n end.\n", "language": "Pascal", "metadata": {"date": 1509563407, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s605608649.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s605608649", "user_id": "u816631826"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "program V1004;\n var\n a:array[0..200001,0..1] of longint;\n i,m,n,x,y,u:longint;\n begin\n readln(n,m);\n fillchar(a,sizeof(a),0);\n a[1,0]:=1;\n a[n,1]:=1;\n for i:=1 to m do\n begin\n readln(x,y);\n if x=1 then inc(a[y,0]);\n if y=n then inc(a[x,1]);\n end;\n u:=0;\n for i:=1 to n do\n if (a[i,0]>0) and (a[i,1]>0) then u:=1;\n if u=1 then writeln('POSSIBLE')\n else writeln('IMPOSSIBLE');\n end.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 414, "cpu_time_ms": 48, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s248708948", "group_id": "codeNet:p03645", "input_text": "const oo=10000000;\nvar n,m,nheap:longint;x,y,h,a,pos,heap,cp,c,f:array[0..500005] of longint;free:array[0..500005] of boolean;\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x[i],y[i]);\n inc(h[x[i]]);\n inc(h[y[i]]);\n end;\n for i:=2 to n+1 do\n h[i]:=h[i-1]+h[i];\n for i:=1 to m do\n begin\n A[h[x[i]]]:=y[i];\n a[h[y[i]]]:=x[i];\n C[h[x[i]]]:=1;\n C[h[y[i]]]:=1;\n dec(h[x[i]]);\n dec(h[y[i]]);\n end;\nend;\nprocedure init;\nvar i:longint;\nbegin\n for i:=1 to n do\n cp[i]:=oo;\n fillchar(free,sizeof(free),true);\n cp[1]:=0;\nend;\n\nprocedure swap(var x,y:longint);\nvar tamp:longint;\nbegin\n tamp:=x;\n x:=y;\n y:=tamp;\nend;\nprocedure upheap(i:longint);\nbegin\n if (i=1)or (cp[heap[i]]>cp[heap[i div 2]]) then exit;\n swap(heap[i],heap[i div 2]);\n swap(pos[heap[i]],pos[heap[i div 2]]);\n upheap(i div 2);\nend;\nprocedure downheap(I:longint);\nvar j:longint;\nbegin\n j:=i*2;\n if j>nheap then exit;\n if (jcp[heap[j+1]]) then inc(j);\n if cp[heap[i]]>cp[heap[j]] then\n begin\n swap(heap[i],heap[j]);\n swap(pos[heap[i]],pos[heap[j]]);\n downheap(j);\n end;\nend;\nfunction pop(v:longint):longint;\nbegin\n pop:=heap[v];\n heap[v]:=heap[nheap];\n pos[heap[v]]:=v;\n dec(nheap);\n upheap(v);\n downheap(v);\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n pos[x]:=nheap;\n heap[nheap]:=x;\n upheap(nheap);\nend;\nprocedure dijheap;\nvar v,vjp,u:longint;\nbegin\n f[1]:=1;\n push(1);\n repeat\n u:=pop(1);\n if u=n then exit;\n free[u]:=false;\n for v:=h[u]+1 to h[u+1] do\n if (free[a[v]]) then\n begin\n if cp[a[v]]>=cp[u]+c[v] then\n begin\n if cp[a[v]]>cp[u]+c[v] then F[a[v]]:=f[u]\n else f[a[v]]:=f[a[v]]+f[u];\n cp[a[v]]:=cp[u]+c[v];\n if pos[a[v]]=0 then push(a[v]) else\n begin\n vjp:=pos[a[v]];\n upheap(vjp);\n downheap(vjp);\n end;\n end\n\n end;\n until false;\nend;\nprocedure xuat;\nbegin\n if Cp[n]>2 then writeln('IMPOSSIBLE')\n else writeln('POSSIBLE');\nend;\nbegin\n nhap;\n init;\n dijheap;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1501377857, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s248708948.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s248708948", "user_id": "u568973067"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "const oo=10000000;\nvar n,m,nheap:longint;x,y,h,a,pos,heap,cp,c,f:array[0..500005] of longint;free:array[0..500005] of boolean;\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x[i],y[i]);\n inc(h[x[i]]);\n inc(h[y[i]]);\n end;\n for i:=2 to n+1 do\n h[i]:=h[i-1]+h[i];\n for i:=1 to m do\n begin\n A[h[x[i]]]:=y[i];\n a[h[y[i]]]:=x[i];\n C[h[x[i]]]:=1;\n C[h[y[i]]]:=1;\n dec(h[x[i]]);\n dec(h[y[i]]);\n end;\nend;\nprocedure init;\nvar i:longint;\nbegin\n for i:=1 to n do\n cp[i]:=oo;\n fillchar(free,sizeof(free),true);\n cp[1]:=0;\nend;\n\nprocedure swap(var x,y:longint);\nvar tamp:longint;\nbegin\n tamp:=x;\n x:=y;\n y:=tamp;\nend;\nprocedure upheap(i:longint);\nbegin\n if (i=1)or (cp[heap[i]]>cp[heap[i div 2]]) then exit;\n swap(heap[i],heap[i div 2]);\n swap(pos[heap[i]],pos[heap[i div 2]]);\n upheap(i div 2);\nend;\nprocedure downheap(I:longint);\nvar j:longint;\nbegin\n j:=i*2;\n if j>nheap then exit;\n if (jcp[heap[j+1]]) then inc(j);\n if cp[heap[i]]>cp[heap[j]] then\n begin\n swap(heap[i],heap[j]);\n swap(pos[heap[i]],pos[heap[j]]);\n downheap(j);\n end;\nend;\nfunction pop(v:longint):longint;\nbegin\n pop:=heap[v];\n heap[v]:=heap[nheap];\n pos[heap[v]]:=v;\n dec(nheap);\n upheap(v);\n downheap(v);\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n pos[x]:=nheap;\n heap[nheap]:=x;\n upheap(nheap);\nend;\nprocedure dijheap;\nvar v,vjp,u:longint;\nbegin\n f[1]:=1;\n push(1);\n repeat\n u:=pop(1);\n if u=n then exit;\n free[u]:=false;\n for v:=h[u]+1 to h[u+1] do\n if (free[a[v]]) then\n begin\n if cp[a[v]]>=cp[u]+c[v] then\n begin\n if cp[a[v]]>cp[u]+c[v] then F[a[v]]:=f[u]\n else f[a[v]]:=f[a[v]]+f[u];\n cp[a[v]]:=cp[u]+c[v];\n if pos[a[v]]=0 then push(a[v]) else\n begin\n vjp:=pos[a[v]];\n upheap(vjp);\n downheap(vjp);\n end;\n end\n\n end;\n until false;\nend;\nprocedure xuat;\nbegin\n if Cp[n]>2 then writeln('IMPOSSIBLE')\n else writeln('POSSIBLE');\nend;\nbegin\n nhap;\n init;\n dijheap;\n xuat;\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2653, "cpu_time_ms": 91, "memory_kb": 15872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s609688967", "group_id": "codeNet:p03651", "input_text": "function gcd(a,b:int64):int64;\nvar t:int64;\nbegin\n while b <> 0 do\n begin\n t := b;\n b := a mod b;\n a := t;\n end;\n result := a;\nend;\n\nvar\n n,k,t,i,x,now,mx:int64;\nbegin\n read(n);\n read(k);\n read(now);\n mx := now;\n for i := 2 to n do\n begin\n read(x);\n now := gcd(now,x);\n if (mx=k) and (k mod now=0) then writeln('POSSIBLE')\n else writeln('IMPOSSIBLE');\nend.", "language": "Pascal", "metadata": {"date": 1515979686, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03651.html", "problem_id": "p03651", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03651/input.txt", "sample_output_relpath": "derived/input_output/data/p03651/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03651/Pascal/s609688967.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s609688967", "user_id": "u598016178"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "function gcd(a,b:int64):int64;\nvar t:int64;\nbegin\n while b <> 0 do\n begin\n t := b;\n b := a mod b;\n a := t;\n end;\n result := a;\nend;\n\nvar\n n,k,t,i,x,now,mx:int64;\nbegin\n read(n);\n read(k);\n read(now);\n mx := now;\n for i := 2 to n do\n begin\n read(x);\n now := gcd(now,x);\n if (mx=k) and (k mod now=0) then writeln('POSSIBLE')\n else writeln('IMPOSSIBLE');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a box containing N balls. The i-th ball has the integer A_i written on it.\nSnuke can perform the following operation any number of times:\n\nTake out two balls from the box. Then, return them to the box along with a new ball, on which the absolute difference of the integers written on the two balls is written.\n\nDetermine whether it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq K \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nIf it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written, print POSSIBLE; if it is not possible, print IMPOSSIBLE.\n\nSample Input 1\n\n3 7\n9 3 4\n\nSample Output 1\n\nPOSSIBLE\n\nFirst, take out the two balls 9 and 4, and return them back along with a new ball, abs(9-4)=5.\nNext, take out 3 and 5, and return them back along with abs(3-5)=2.\nFinally, take out 9 and 2, and return them back along with abs(9-2)=7.\nNow we have 7 in the box, and the answer is therefore POSSIBLE.\n\nSample Input 2\n\n3 5\n6 9 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo matter what we do, it is not possible to have 5 in the box. The answer is therefore IMPOSSIBLE.\n\nSample Input 3\n\n4 11\n11 3 7 15\n\nSample Output 3\n\nPOSSIBLE\n\nThe box already contains 11 before we do anything. The answer is therefore POSSIBLE.\n\nSample Input 4\n\n5 12\n10 2 8 6 4\n\nSample Output 4\n\nIMPOSSIBLE", "sample_input": "3 7\n9 3 4\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03651", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a box containing N balls. The i-th ball has the integer A_i written on it.\nSnuke can perform the following operation any number of times:\n\nTake out two balls from the box. Then, return them to the box along with a new ball, on which the absolute difference of the integers written on the two balls is written.\n\nDetermine whether it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq K \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nIf it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written, print POSSIBLE; if it is not possible, print IMPOSSIBLE.\n\nSample Input 1\n\n3 7\n9 3 4\n\nSample Output 1\n\nPOSSIBLE\n\nFirst, take out the two balls 9 and 4, and return them back along with a new ball, abs(9-4)=5.\nNext, take out 3 and 5, and return them back along with abs(3-5)=2.\nFinally, take out 9 and 2, and return them back along with abs(9-2)=7.\nNow we have 7 in the box, and the answer is therefore POSSIBLE.\n\nSample Input 2\n\n3 5\n6 9 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo matter what we do, it is not possible to have 5 in the box. The answer is therefore IMPOSSIBLE.\n\nSample Input 3\n\n4 11\n11 3 7 15\n\nSample Output 3\n\nPOSSIBLE\n\nThe box already contains 11 before we do anything. The answer is therefore POSSIBLE.\n\nSample Input 4\n\n5 12\n10 2 8 6 4\n\nSample Output 4\n\nIMPOSSIBLE", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 435, "cpu_time_ms": 17, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s499599860", "group_id": "codeNet:p03652", "input_text": "const\n fi='agc018_b.inp';\n fo='agc018_b.out';\nvar\n n,m,res:longint;\n A:Array[0..301,0..301] of longint;\n HT:Array[0..301] of longint;\n KT:Array[0..301] of boolean;\n Dem:Array[0..301] of longint;\n{------------------------------------}\nprocedure main;\nvar i,j,z:longint;\n begin\n read(n,m);\n res:=n;\n for i:=1 to n do\n for j:=1 to m do read(A[i,j]);\n for j:=1 to n do HT[j]:=1;\n for i:=1 to m do\n begin\n fillchar(Dem,sizeof(Dem),0);\n z:=0;\n for j:=1 to n do\n begin\n inc(Dem[A[j,HT[j]]]);\n if Dem[z]Dem[z] then res:=Dem[z];\n KT[z]:=true;\n for j:=1 to n do while KT[A[j,HT[j]]] do inc(HT[j]);\n end;\n write(res);\n end;\n{------------------------------------}\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo);rewrite(output);\n main;\nend.\n", "language": "Pascal", "metadata": {"date": 1510852534, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03652.html", "problem_id": "p03652", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03652/input.txt", "sample_output_relpath": "derived/input_output/data/p03652/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03652/Pascal/s499599860.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s499599860", "user_id": "u681325671"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const\n fi='agc018_b.inp';\n fo='agc018_b.out';\nvar\n n,m,res:longint;\n A:Array[0..301,0..301] of longint;\n HT:Array[0..301] of longint;\n KT:Array[0..301] of boolean;\n Dem:Array[0..301] of longint;\n{------------------------------------}\nprocedure main;\nvar i,j,z:longint;\n begin\n read(n,m);\n res:=n;\n for i:=1 to n do\n for j:=1 to m do read(A[i,j]);\n for j:=1 to n do HT[j]:=1;\n for i:=1 to m do\n begin\n fillchar(Dem,sizeof(Dem),0);\n z:=0;\n for j:=1 to n do\n begin\n inc(Dem[A[j,HT[j]]]);\n if Dem[z]Dem[z] then res:=Dem[z];\n KT[z]:=true;\n for j:=1 to n do while KT[A[j,HT[j]]] do inc(HT[j]);\n end;\n write(res);\n end;\n{------------------------------------}\nbegin\n// assign(input,fi); reset(input);\n// assign(output,fo);rewrite(output);\n main;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "sample_input": "4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03652", "source_text": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1267, "cpu_time_ms": 9, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s767513811", "group_id": "codeNet:p03652", "input_text": "program ec12;\nvar \n\tn,m,i,j,max,min:longint;\n\ta:array[1..301,1..301] of longint;\n\tvis,step:array[1..301] of longint;\n\tvis1:array[1..301] of boolean;\nbegin \n\treadln(n,m);\n\tfor i:=1 to n do \n\tfor j:=1 to m do \n\tread(a[i,j]);\n\tmin:=n;\n\tfor i:=1 to n do \n\tstep[i]:=1;\n\tfillchar(vis1,sizeof(vis1),true);\n\twhile true do \n\tbegin \t\n\t\tfillchar(vis,sizeof(vis),0);\n\t\tfor i:=1 to n do \n\t\tinc(vis[a[i,step[i]]]);\n\t\tmax:=1;\n\t\tfor i:=2 to m do \n\t\tbegin \t\n\t\t\tif vis[max]m then \n\t\t\tbegin \n\t\t\t\twriteln(min);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(min);\nend. ", "language": "Pascal", "metadata": {"date": 1509374617, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03652.html", "problem_id": "p03652", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03652/input.txt", "sample_output_relpath": "derived/input_output/data/p03652/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03652/Pascal/s767513811.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s767513811", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j,max,min:longint;\n\ta:array[1..301,1..301] of longint;\n\tvis,step:array[1..301] of longint;\n\tvis1:array[1..301] of boolean;\nbegin \n\treadln(n,m);\n\tfor i:=1 to n do \n\tfor j:=1 to m do \n\tread(a[i,j]);\n\tmin:=n;\n\tfor i:=1 to n do \n\tstep[i]:=1;\n\tfillchar(vis1,sizeof(vis1),true);\n\twhile true do \n\tbegin \t\n\t\tfillchar(vis,sizeof(vis),0);\n\t\tfor i:=1 to n do \n\t\tinc(vis[a[i,step[i]]]);\n\t\tmax:=1;\n\t\tfor i:=2 to m do \n\t\tbegin \t\n\t\t\tif vis[max]m then \n\t\t\tbegin \n\t\t\t\twriteln(min);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(min);\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "sample_input": "4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03652", "source_text": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 9, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s788167668", "group_id": "codeNet:p03658", "input_text": "var\n i,n,j,k,s,t:longint;\n a:array[0..10000] of longint;\nbegin\n readln(n,k);\n for i:=1 to n do read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if lj) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if l=0 then\n Writeln('delicious')\n else if x+a>=b then\n Writeln('safe')\n else\n Writeln('dangerous');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1516904263, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s757720472.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s757720472", "user_id": "u755925739"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n h,w,i,j,count,x,y,sw,m,n,a,b,c:Integer;\n s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(x);\n Read(a);\n Readln(b);\n\n if a-b>=0 then\n Writeln('delicious')\n else if x+a>=b then\n Writeln('safe')\n else\n Writeln('dangerous');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 534, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s251499727", "group_id": "codeNet:p03679", "input_text": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n d:=0; i:=1;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n\nprocedure xuat;\nbegin\n if dau[2]=1 then\n writeln(d-1)\n else\n writeln('-1');\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1498357742, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s251499727.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s251499727", "user_id": "u068391867"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n d:=0; i:=1;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n\nprocedure xuat;\nbegin\n if dau[2]=1 then\n writeln(d-1)\n else\n writeln('-1');\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 644, "cpu_time_ms": 142, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s688815360", "group_id": "codeNet:p03680", "input_text": "Var n,kq,t: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\nt:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[t]]=t Then Break;\n t:=a[t];\nUntil (t=2) or (kq>n+1);\nEnd;\n\nProcedure Xuat;\nBegin\nIf t<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n\n", "language": "Pascal", "metadata": {"date": 1498357210, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s688815360.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s688815360", "user_id": "u489424865"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var n,kq,t: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\nt:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[t]]=t Then Break;\n t:=a[t];\nUntil (t=2) or (kq>n+1);\nEnd;\n\nProcedure Xuat;\nBegin\nIf t<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 427, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s972596434", "group_id": "codeNet:p03680", "input_text": "Var n,kq,i: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\ni:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[i]]=i Then Break;\n i:=a[i];\nUntil (i=2) or (kq>n+1);\nEnd;\n\nProcedure Xuat;\nBegin\nIf i<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n\n", "language": "Pascal", "metadata": {"date": 1498356439, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s972596434.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s972596434", "user_id": "u489424865"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var n,kq,i: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\ni:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[i]]=i Then Break;\n i:=a[i];\nUntil (i=2) or (kq>n+1);\nEnd;\n\nProcedure Xuat;\nBegin\nIf i<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 427, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s886917476", "group_id": "codeNet:p03680", "input_text": "Var N,i,Dem:Longint;\n A:Array[1..100000] Of Longint;\n Free:Array[1..100000] Of Boolean;\n KT:Boolean;\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n //// Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(N);\n For i:=1 to N Do Readln(A[i]);\n Fillchar(Free,SizeOf(Free),True);\n i:=1;\n Dem:=1;\n KT:=False;\n While Free[i]<>False Do\n Begin\n Inc(Dem);\n Free[i]:=False;\n i:=A[i];\n If i=2 Then\n Begin\n KT:=True;\n Break;\n End;\n Free[i]:=False;\n i:=A[i];\n If i=2 Then\n Begin\n KT:=True;\n Break;\n End;\n End;\n If KT=True Then Write(Dem) Else Write('-1');\n //Close(Input);\n ///Close(Output);\nEnd.\n", "language": "Pascal", "metadata": {"date": 1498355086, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s886917476.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s886917476", "user_id": "u679669944"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var N,i,Dem:Longint;\n A:Array[1..100000] Of Longint;\n Free:Array[1..100000] Of Boolean;\n KT:Boolean;\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n //// Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(N);\n For i:=1 to N Do Readln(A[i]);\n Fillchar(Free,SizeOf(Free),True);\n i:=1;\n Dem:=1;\n KT:=False;\n While Free[i]<>False Do\n Begin\n Inc(Dem);\n Free[i]:=False;\n i:=A[i];\n If i=2 Then\n Begin\n KT:=True;\n Break;\n End;\n Free[i]:=False;\n i:=A[i];\n If i=2 Then\n Begin\n KT:=True;\n Break;\n End;\n End;\n If KT=True Then Write(Dem) Else Write('-1');\n //Close(Input);\n ///Close(Output);\nEnd.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1004, "cpu_time_ms": 13, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s877502940", "group_id": "codeNet:p03680", "input_text": "const fi='abc065_b.inp';\n fo='abc065_b.out';\nvar n,i:longint;\n a:array[1..100000] of longint;\n d:array[1..100000] of boolean;\nfunction conan:longint;\n var i,kq:longint;\n begin\n i:=1;\n kq:=0;\n while in;\nend;\nprocedure xuat;\nbegin\n writeln(-1);\n\nend;\n\nbegin\n nhap;\n xuli;\n xuat;\nend.\n", "language": "Pascal", "metadata": {"date": 1498353853, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s012814527.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s012814527", "user_id": "u384777851"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const MaxN=round(1e5)+10;\nvar A:array[0..MaxN] of longint;\n n,res:longint;\n\nprocedure nhap;\nvar i:longint;\nbegin\n\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuli;\nvar x:longint;\nbegin\n x:=1;res:=0;\n repeat\n x:=a[x];\n inc(res);\n if x=2 then\n begin\n writeln(res);\n halt;\n end;\n until res>n;\nend;\nprocedure xuat;\nbegin\n writeln(-1);\n\nend;\n\nbegin\n nhap;\n xuli;\n xuat;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 481, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s216093409", "group_id": "codeNet:p03681", "input_text": "var\n a,b,s:int64;\n i:longint;\nbegin\n readln(a,b);\n if abs(a-b)>1 then begin writeln(0);exit;end;\n s:=1;\n if a=b then s:=s*2;\n for i:=1 to a do s:=s*i mod 1000000007;\n for i:=1 to b do s:=s*i mod 1000000007;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1582233311, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s216093409.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s216093409", "user_id": "u476418095"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var\n a,b,s:int64;\n i:longint;\nbegin\n readln(a,b);\n if abs(a-b)>1 then begin writeln(0);exit;end;\n s:=1;\n if a=b then s:=s*2;\n for i:=1 to a do s:=s*i mod 1000000007;\n for i:=1 to b do s:=s*i mod 1000000007;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s989291416", "group_id": "codeNet:p03681", "input_text": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n xx: int64 = 765302181;\nvar\n n, m, x, i: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n if min(n, m) < 50000 then\n begin\n x := ifthen(n = m, 2, 1);\n for i := 1 to min(n, m) do\n x := ((i*i mod md)*x mod md);\n for i := min(n, m)+1 to max(n, m) do\n x := (i*x mod md);\n writeln(x);\n halt(0);\n end;\n x := xx*ifthen(n = m, 2, 1) mod md;\n for i := 50001 to min(n, m) do\n x := ((i*i mod md)*x mod md);\n for i := min(n, m)+1 to max(n, m) do\n x := (i*x mod md);\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570416777, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s989291416.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s989291416", "user_id": "u506403362"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n xx: int64 = 765302181;\nvar\n n, m, x, i: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n if min(n, m) < 50000 then\n begin\n x := ifthen(n = m, 2, 1);\n for i := 1 to min(n, m) do\n x := ((i*i mod md)*x mod md);\n for i := min(n, m)+1 to max(n, m) do\n x := (i*x mod md);\n writeln(x);\n halt(0);\n end;\n x := xx*ifthen(n = m, 2, 1) mod md;\n for i := 50001 to min(n, m) do\n x := ((i*i mod md)*x mod md);\n for i := min(n, m)+1 to max(n, m) do\n x := (i*x mod md);\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 620, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s784218321", "group_id": "codeNet:p03681", "input_text": "Var A,B,N:Longint;\n D:Array[1..100000] Of Qword;\n\nProcedure Xuli;\nVar i:Longint;\nBegin\n D[1]:=1;\n For i:=2 to 100000 Do D[i]:=((D[i-1] Mod 1000000007)*(i Mod 1000000007))Mod 1000000007;\nEnd;\n\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n ///Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(A,B);\n Xuli;\n If ABS(A-B)>1 Then\n Begin\n Write(0);\n Halt;\n End;\n N:=(D[B]*D[A])Mod 1000000007;\n If A=B Then\n Begin\n N:=(D[B]*D[A]*2)Mod 1000000007;\n Write(N);\n Halt;\n End;\n Write(N);\n //Close(Input);\n //Close(Output);\nEnd.\n", "language": "Pascal", "metadata": {"date": 1498360086, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s784218321.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s784218321", "user_id": "u679669944"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "Var A,B,N:Longint;\n D:Array[1..100000] Of Qword;\n\nProcedure Xuli;\nVar i:Longint;\nBegin\n D[1]:=1;\n For i:=2 to 100000 Do D[i]:=((D[i-1] Mod 1000000007)*(i Mod 1000000007))Mod 1000000007;\nEnd;\n\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n ///Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(A,B);\n Xuli;\n If ABS(A-B)>1 Then\n Begin\n Write(0);\n Halt;\n End;\n N:=(D[B]*D[A])Mod 1000000007;\n If A=B Then\n Begin\n N:=(D[B]*D[A]*2)Mod 1000000007;\n Write(N);\n Halt;\n End;\n Write(N);\n //Close(Input);\n //Close(Output);\nEnd.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 748, "cpu_time_ms": 4, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s056588957", "group_id": "codeNet:p03681", "input_text": "const fi='arc076_a.inp';\n fo='arc076_a.out';\n du=1000000007;\nvar a,b:longint;\n d:array[0..100000] of qword;\nprocedure mori;\n var i:longint;\n begin\n d[0]:=1;\n for i:=1 to 100000 do d[i]:=d[i-1]*i mod du;\n end;\nfunction conan:qword;\n var kq:qword;\n begin\n if abs(a-b) > 1 then exit(0);\n kq:=d[b]*d[a] mod du;\n if a=b then kq:=kq*2 mod du;\n exit(kq);\n end;\nbegin\n\n readln(a,b);\n mori;\n writeln(conan);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1498356056, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s056588957.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s056588957", "user_id": "u189227566"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "const fi='arc076_a.inp';\n fo='arc076_a.out';\n du=1000000007;\nvar a,b:longint;\n d:array[0..100000] of qword;\nprocedure mori;\n var i:longint;\n begin\n d[0]:=1;\n for i:=1 to 100000 do d[i]:=d[i-1]*i mod du;\n end;\nfunction conan:qword;\n var kq:qword;\n begin\n if abs(a-b) > 1 then exit(0);\n kq:=d[b]*d[a] mod du;\n if a=b then kq:=kq*2 mod du;\n exit(kq);\n end;\nbegin\n\n readln(a,b);\n mori;\n writeln(conan);\n\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 579, "cpu_time_ms": 2, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s102764479", "group_id": "codeNet:p03683", "input_text": "program ec12;\nvar \n\tans:int64;\n\tn,m,i:longint;\nbegin \t\n\treadln(n,m);\n\tif abs(n-m)>1 then \n\tbegin \n\t\twriteln(0);\n\t\thalt;\n\tend;\n\tans:=1;\n\tfor i:=2 to n do \n\tans:=(ans*i) mod 1000000007;\n\tfor i:=2 to m do \n\tans:=(ans*i) mod 1000000007;\n\tif n=m then \n\twriteln((ans*2) mod 1000000007)\n\telse\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509832986, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03683.html", "problem_id": "p03683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03683/input.txt", "sample_output_relpath": "derived/input_output/data/p03683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03683/Pascal/s102764479.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s102764479", "user_id": "u089230684"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program ec12;\nvar \n\tans:int64;\n\tn,m,i:longint;\nbegin \t\n\treadln(n,m);\n\tif abs(n-m)>1 then \n\tbegin \n\t\twriteln(0);\n\t\thalt;\n\tend;\n\tans:=1;\n\tfor i:=2 to n do \n\tans:=(ans*i) mod 1000000007;\n\tfor i:=2 to m do \n\tans:=(ans*i) mod 1000000007;\n\tif n=m then \n\twriteln((ans*2) mod 1000000007)\n\telse\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03683", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s635450986", "group_id": "codeNet:p03683", "input_text": "uses math;\nvar n,m,ans,p,ppp,i:int64;\n \nbegin\nreadln(n,m);\nppp:=1000000007;\nif n=m then ans:=2;\nif n=m+1 then ans:=1;\nif n+1=m then ans:=1;\nif ans=0 then begin writeln(0);halt;end;\np:=1;\nwhile i 0 then\n min:=(min+s[i]-abs(min-s[i]))div 2;\n end;\n\n if (count mod 10 = 0)and (min<=100) then\n count:=count-min;\n\n if count mod 10 = 0 then\n count:=0;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1516828837, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03699.html", "problem_id": "p03699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03699/input.txt", "sample_output_relpath": "derived/input_output/data/p03699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03699/Pascal/s471401236.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s471401236", "user_id": "u755925739"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n h,w,i,j,count,x,y,m,n,c,a,b,min:Integer;\n s:array of integer;\n s1,s2,s3:string;\n sw:char;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n SetLength(s,n);\n min:=101;\n count:=0;\n for i := 0 to n - 1 do begin\n Readln(s[i]);\n count:=count+s[i];\n if s[i] mod 10 <> 0 then\n min:=(min+s[i]-abs(min-s[i]))div 2;\n end;\n\n if (count mod 10 = 0)and (min<=100) then\n count:=count-min;\n\n if count mod 10 = 0 then\n count:=0;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.\n\nHowever, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 100\n\n1 ≤ s_i ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the maximum value that can be displayed as your grade.\n\nSample Input 1\n\n3\n5\n10\n15\n\nSample Output 1\n\n25\n\nYour grade will be 25 if the 10-point and 15-point questions are answered correctly and the 5-point question is not, and this grade will be displayed correctly. Your grade will become 30 if the 5-point question is also answered correctly, but this grade will be incorrectly displayed as 0.\n\nSample Input 2\n\n3\n10\n10\n15\n\nSample Output 2\n\n35\n\nYour grade will be 35 if all the questions are answered correctly, and this grade will be displayed correctly.\n\nSample Input 3\n\n3\n10\n20\n30\n\nSample Output 3\n\n0\n\nRegardless of whether each question is answered correctly or not, your grade will be a multiple of 10 and displayed as 0.", "sample_input": "3\n5\n10\n15\n"}, "reference_outputs": ["25\n"], "source_document_id": "p03699", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.\n\nHowever, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 100\n\n1 ≤ s_i ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the maximum value that can be displayed as your grade.\n\nSample Input 1\n\n3\n5\n10\n15\n\nSample Output 1\n\n25\n\nYour grade will be 25 if the 10-point and 15-point questions are answered correctly and the 5-point question is not, and this grade will be displayed correctly. Your grade will become 30 if the 5-point question is also answered correctly, but this grade will be incorrectly displayed as 0.\n\nSample Input 2\n\n3\n10\n10\n15\n\nSample Output 2\n\n35\n\nYour grade will be 35 if all the questions are answered correctly, and this grade will be displayed correctly.\n\nSample Input 3\n\n3\n10\n20\n30\n\nSample Output 3\n\n0\n\nRegardless of whether each question is answered correctly or not, your grade will be a multiple of 10 and displayed as 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 755, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s584936402", "group_id": "codeNet:p03700", "input_text": "var\n n: integer;\n a: integer;\n b: integer;\n h: array of integer;\n i: integer;\n l: integer;\n r: integer;\n m: integer;\n diff: int64;\n cnt: int64;\nbegin\n readln(n, a, b);\n setlength(h, n);\n for i := 0 to n - 1 do begin\n readln(h[i]);\n end;\n l := 0;\n r := 1000000000;\n while r - l > 1 do begin\n cnt := 0;\n m := (r + l) div 2;\n for i := 0 to n - 1 do begin\n diff := h[i] - b * m;\n if diff > 0 then begin\n cnt := cnt + (diff div (a - b));\n if diff mod (a - b) <> 0 then begin\n inc(cnt);\n end;\n end;\n end;\n if cnt > m then begin\n l := m;\n end\n else begin\n r := m;\n end;\n end;\n writeln(r);\nend.", "language": "Pascal", "metadata": {"date": 1504547094, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03700.html", "problem_id": "p03700", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03700/input.txt", "sample_output_relpath": "derived/input_output/data/p03700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03700/Pascal/s584936402.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584936402", "user_id": "u379319063"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n: integer;\n a: integer;\n b: integer;\n h: array of integer;\n i: integer;\n l: integer;\n r: integer;\n m: integer;\n diff: int64;\n cnt: int64;\nbegin\n readln(n, a, b);\n setlength(h, n);\n for i := 0 to n - 1 do begin\n readln(h[i]);\n end;\n l := 0;\n r := 1000000000;\n while r - l > 1 do begin\n cnt := 0;\n m := (r + l) div 2;\n for i := 0 to n - 1 do begin\n diff := h[i] - b * m;\n if diff > 0 then begin\n cnt := cnt + (diff div (a - b));\n if diff mod (a - b) <> 0 then begin\n inc(cnt);\n end;\n end;\n end;\n if cnt > m then begin\n l := m;\n end\n else begin\n r := m;\n end;\n end;\n writeln(r);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "sample_input": "4 5 3\n8\n7\n4\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03700", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 756, "cpu_time_ms": 91, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s269110264", "group_id": "codeNet:p03700", "input_text": "var\n n: integer;\n a: integer;\n b: integer;\n h: array of integer;\n i: integer;\n l: integer;\n r: integer;\n m: integer;\n diff: integer;\n cnt: int64;\nbegin\n readln(n, a, b);\n setlength(h, n);\n for i := 0 to n - 1 do begin\n readln(h[i]);\n end;\n l := 0;\n r := 1000000000;\n while r - l > 1 do begin\n cnt := 0;\n m := (r + l) div 2;\n for i := 0 to n - 1 do begin\n diff := h[i] - (b * m);\n if diff > 0 then begin\n cnt := cnt + (diff div (a - b));\n if diff mod (a - b) > 0 then begin\n inc(cnt);\n end;\n if cnt > m then begin\n break;\n end;\n end;\n end;\n if cnt > m then begin\n l := m;\n end\n else begin\n r := m;\n end;\n end;\n writeln(r);\nend.\n", "language": "Pascal", "metadata": {"date": 1504545294, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03700.html", "problem_id": "p03700", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03700/input.txt", "sample_output_relpath": "derived/input_output/data/p03700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03700/Pascal/s269110264.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s269110264", "user_id": "u379319063"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n: integer;\n a: integer;\n b: integer;\n h: array of integer;\n i: integer;\n l: integer;\n r: integer;\n m: integer;\n diff: integer;\n cnt: int64;\nbegin\n readln(n, a, b);\n setlength(h, n);\n for i := 0 to n - 1 do begin\n readln(h[i]);\n end;\n l := 0;\n r := 1000000000;\n while r - l > 1 do begin\n cnt := 0;\n m := (r + l) div 2;\n for i := 0 to n - 1 do begin\n diff := h[i] - (b * m);\n if diff > 0 then begin\n cnt := cnt + (diff div (a - b));\n if diff mod (a - b) > 0 then begin\n inc(cnt);\n end;\n if cnt > m then begin\n break;\n end;\n end;\n end;\n if cnt > m then begin\n l := m;\n end\n else begin\n r := m;\n end;\n end;\n writeln(r);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "sample_input": "4 5 3\n8\n7\n4\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03700", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 833, "cpu_time_ms": 72, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s189651607", "group_id": "codeNet:p03700", "input_text": "var\n n: integer;\n a: integer;\n b: integer;\n h: array of integer;\n i: integer;\n l: integer;\n r: integer;\n m: integer;\n diff: integer;\n cnt: int64;\nbegin\n readln(n, a, b);\n setlength(h, n);\n for i := 0 to n - 1 do begin\n readln(h[i]);\n end;\n l := 0;\n r := 1000000000;\n while r - l > 1 do begin\n cnt := 0;\n m := (r + l) div 2;\n for i := 0 to n - 1 do begin\n diff := h[i] - (b * m);\n if diff > 0 then begin\n cnt := cnt + (diff div (a - b));\n if diff mod (a - b) > 0 then begin\n inc(cnt);\n if cnt > m then begin\n break;\n end;\n end;\n end;\n end;\n if cnt > m then begin\n l := m;\n end\n else begin\n r := m;\n end;\n end;\n writeln(r);\nend.\n", "language": "Pascal", "metadata": {"date": 1504545169, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03700.html", "problem_id": "p03700", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03700/input.txt", "sample_output_relpath": "derived/input_output/data/p03700/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03700/Pascal/s189651607.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s189651607", "user_id": "u379319063"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n: integer;\n a: integer;\n b: integer;\n h: array of integer;\n i: integer;\n l: integer;\n r: integer;\n m: integer;\n diff: integer;\n cnt: int64;\nbegin\n readln(n, a, b);\n setlength(h, n);\n for i := 0 to n - 1 do begin\n readln(h[i]);\n end;\n l := 0;\n r := 1000000000;\n while r - l > 1 do begin\n cnt := 0;\n m := (r + l) div 2;\n for i := 0 to n - 1 do begin\n diff := h[i] - (b * m);\n if diff > 0 then begin\n cnt := cnt + (diff div (a - b));\n if diff mod (a - b) > 0 then begin\n inc(cnt);\n if cnt > m then begin\n break;\n end;\n end;\n end;\n end;\n if cnt > m then begin\n l := m;\n end\n else begin\n r := m;\n end;\n end;\n writeln(r);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "sample_input": "4 5 3\n8\n7\n4\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03700", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 842, "cpu_time_ms": 82, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s187022678", "group_id": "codeNet:p03702", "input_text": "var\n\tn,i:Longint;\n\ts,L,R,M,a,b:int64;\n\th:array[1..100000]of int64;\nbegin\n\tread(n,a,b);\n\tfor i:=1 to n do read(h[i]);\n\tR:=1000000000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\ts:=0;\n\t\tfor i:=1 to n do begin\n\t\t\tif M*bM then L:=M else R:=M;\n\tend;\n\twriteln(R);\nend.\n", "language": "Pascal", "metadata": {"date": 1539341654, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03702.html", "problem_id": "p03702", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03702/input.txt", "sample_output_relpath": "derived/input_output/data/p03702/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03702/Pascal/s187022678.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s187022678", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,i:Longint;\n\ts,L,R,M,a,b:int64;\n\th:array[1..100000]of int64;\nbegin\n\tread(n,a,b);\n\tfor i:=1 to n do read(h[i]);\n\tR:=1000000000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\ts:=0;\n\t\tfor i:=1 to n do begin\n\t\t\tif M*bM then L:=M else R:=M;\n\tend;\n\twriteln(R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "sample_input": "4 5 3\n8\n7\n4\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03702", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 316, "cpu_time_ms": 53, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s376426582", "group_id": "codeNet:p03702", "input_text": "var\n\tn,i:Longint;\n\ts,L,R,M,a,b:int64;\n\th:array[1..100000]of int64;\nbegin\n\tread(n,a,b);\n\tfor i:=1 to n do read(h[i]);\n\tR:=1000000000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\ts:=0;\n\t\tfor i:=1 to n do begin\n\t\t\tif M*b(a-b)*M then L:=M else R:=M;\n\tend;\n\twriteln(R);\nend.\n", "language": "Pascal", "metadata": {"date": 1539341443, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03702.html", "problem_id": "p03702", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03702/input.txt", "sample_output_relpath": "derived/input_output/data/p03702/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03702/Pascal/s376426582.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s376426582", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,i:Longint;\n\ts,L,R,M,a,b:int64;\n\th:array[1..100000]of int64;\nbegin\n\tread(n,a,b);\n\tfor i:=1 to n do read(h[i]);\n\tR:=1000000000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\ts:=0;\n\t\tfor i:=1 to n do begin\n\t\t\tif M*b(a-b)*M then L:=M else R:=M;\n\tend;\n\twriteln(R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "sample_input": "4 5 3\n8\n7\n4\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03702", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\n\nFortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:\n\nSelect an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A, and the health of each of the other monsters will decrease by B. Here, A and B are predetermined parameters, and A > B holds.\n\nAt least how many explosions do you need to cause in order to vanish all the monsters?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 10^5\n\n1 ≤ B < A ≤ 10^9\n\n1 ≤ h_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum number of explosions that needs to be caused in order to vanish all the monsters.\n\nSample Input 1\n\n4 5 3\n8\n7\n4\n2\n\nSample Output 1\n\n2\n\nYou can vanish all the monsters in two explosion, as follows:\n\nFirst, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3, 4, 1 and -1, respectively, and the last monster vanishes.\n\nSecond, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0, -1 and -2, respectively, and all the monsters are now vanished.\n\nSample Input 2\n\n2 10 4\n20\n20\n\nSample Output 2\n\n4\n\nYou need to cause two explosions centered at each monster, for a total of four.\n\nSample Input 3\n\n5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n\nSample Output 3\n\n800000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 306, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s339865718", "group_id": "codeNet:p03703", "input_text": "program j01;\nconst maxn=400086;\ntype opr=record w:int64;id:longint;end;\nvar sum:array[0..maxn]of int64;\n op:array[0..maxn]of opr;\n tot:longint;\n ans:int64;\n c,a:array[0..maxn]of longint;\n n,i,k:longint;\n\nprocedure sort(l,r:longint);\nvar i,j,x:longint;y:opr;\nbegin\n i:=l;j:=r;x:=op[(i+j)div 2].w;\n repeat\n while op[i].wj;\n if iop[i-1].w then inc(tot);\n a[op[i].id]:=tot;\n end;\nend;\n\nprocedure ins(i:longint);\nbegin\n while i<=tot do\n begin\n inc(c[i]);inc(i,i and(-i));\n end;\nend;\n\nfunction ask(i:longint):longint;\nvar res:longint;\nbegin\n res:=0;\n while i>0 do\n begin\n inc(res,c[i]);dec(i,i and(-i));\n end;\n exit(res);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do a[i]:=a[i]-k;\n sum[1]:=0;inc(n);for i:=2 to n do sum[i]:=sum[i-1]+a[i-1];\n for i:=1 to n do\n begin\n op[i].w:=sum[i];op[i].id:=i;\n end;\n //for i:=1 to n do write(sum[i],' ');writeln;\n disc;\n for i:=1 to n do\n begin\n inc(ans,ask(a[i]));ins(a[i]);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1496541544, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03703.html", "problem_id": "p03703", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03703/input.txt", "sample_output_relpath": "derived/input_output/data/p03703/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03703/Pascal/s339865718.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s339865718", "user_id": "u550756195"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program j01;\nconst maxn=400086;\ntype opr=record w:int64;id:longint;end;\nvar sum:array[0..maxn]of int64;\n op:array[0..maxn]of opr;\n tot:longint;\n ans:int64;\n c,a:array[0..maxn]of longint;\n n,i,k:longint;\n\nprocedure sort(l,r:longint);\nvar i,j,x:longint;y:opr;\nbegin\n i:=l;j:=r;x:=op[(i+j)div 2].w;\n repeat\n while op[i].wj;\n if iop[i-1].w then inc(tot);\n a[op[i].id]:=tot;\n end;\nend;\n\nprocedure ins(i:longint);\nbegin\n while i<=tot do\n begin\n inc(c[i]);inc(i,i and(-i));\n end;\nend;\n\nfunction ask(i:longint):longint;\nvar res:longint;\nbegin\n res:=0;\n while i>0 do\n begin\n inc(res,c[i]);dec(i,i and(-i));\n end;\n exit(res);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do a[i]:=a[i]-k;\n sum[1]:=0;inc(n);for i:=2 to n do sum[i]:=sum[i-1]+a[i-1];\n for i:=1 to n do\n begin\n op[i].w:=sum[i];op[i].id:=i;\n end;\n //for i:=1 to n do write(sum[i],' ');writeln;\n disc;\n for i:=1 to n do\n begin\n inc(ans,ask(a[i]));ins(a[i]);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a = {a_1, a_2, …, a_N}, and an integer K.\n\na has N(N+1)/2 non-empty contiguous subsequences, {a_l, a_{l+1}, …, a_r} (1 ≤ l ≤ r ≤ N). Among them, how many have an arithmetic mean that is greater than or equal to K?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 2 \\times 10^5\n\n1 ≤ K ≤ 10^9\n\n1 ≤ a_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1\na_2\n:\na_N\n\nOutput\n\nPrint the number of the non-empty contiguous subsequences with an arithmetic mean that is greater than or equal to K.\n\nSample Input 1\n\n3 6\n7\n5\n7\n\nSample Output 1\n\n5\n\nAll the non-empty contiguous subsequences of a are listed below:\n\n{a_1} = {7}\n\n{a_1, a_2} = {7, 5}\n\n{a_1, a_2, a_3} = {7, 5, 7}\n\n{a_2} = {5}\n\n{a_2, a_3} = {5, 7}\n\n{a_3} = {7}\n\nTheir means are 7, 6, 19/3, 5, 6 and 7, respectively, and five among them are 6 or greater. Note that {a_1} and {a_3} are indistinguishable by the values of their elements, but we count them individually.\n\nSample Input 2\n\n1 2\n1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n7 26\n10\n20\n30\n40\n30\n20\n10\n\nSample Output 3\n\n13", "sample_input": "3 6\n7\n5\n7\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03703", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a = {a_1, a_2, …, a_N}, and an integer K.\n\na has N(N+1)/2 non-empty contiguous subsequences, {a_l, a_{l+1}, …, a_r} (1 ≤ l ≤ r ≤ N). Among them, how many have an arithmetic mean that is greater than or equal to K?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 2 \\times 10^5\n\n1 ≤ K ≤ 10^9\n\n1 ≤ a_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1\na_2\n:\na_N\n\nOutput\n\nPrint the number of the non-empty contiguous subsequences with an arithmetic mean that is greater than or equal to K.\n\nSample Input 1\n\n3 6\n7\n5\n7\n\nSample Output 1\n\n5\n\nAll the non-empty contiguous subsequences of a are listed below:\n\n{a_1} = {7}\n\n{a_1, a_2} = {7, 5}\n\n{a_1, a_2, a_3} = {7, 5, 7}\n\n{a_2} = {5}\n\n{a_2, a_3} = {5, 7}\n\n{a_3} = {7}\n\nTheir means are 7, 6, 19/3, 5, 6 and 7, respectively, and five among them are 6 or greater. Note that {a_1} and {a_3} are indistinguishable by the values of their elements, but we count them individually.\n\nSample Input 2\n\n1 2\n1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n7 26\n10\n20\n30\n40\n30\n20\n10\n\nSample Output 3\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1337, "cpu_time_ms": 2117, "memory_kb": 272000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s826187760", "group_id": "codeNet:p03716", "input_text": "Const fi='';\n fo='';\nVar f:Text;\n n:Longint;\n A:Array[0..300000] of Longint;\n L1,L2:Array[0..300000] of Int64;\n Heapmin,Heapmax:Array[0..300000] of Longint;\n nheapmin,nheapmax:Longint; sol:Int64;\nFunction max(i,j:Int64):Int64; Begin If i=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]>=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmax);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]>=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmax);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]a[heap[j]]) then exit;\n doicho(heap[i],heap[j]);\n upheap(j);\nend;\nprocedure downheap(i:longint);\nvar j:longint;\nbegin\n j:=2*i;\n if j>nheap then exit;\n if (ja[heap[j+1]]) then inc(j);\n if a[heap[i]]>a[heap[j]] then\n begin\n doicho(heap[i],heap[j]);\n downheap(j);\n end;\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n heap[nheap]:=x;\n upheap(nheap);\nend;\nfunction pop:longint;\nbegin\n pop:=heap[1];\n heap[1]:=heap[nheap];\n dec(nheap);\n downheap(1);\nend;\nprocedure upheap1(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap1[i]]nheap then exit;\n if (ja[heap[j]]) then exit;\n doicho(heap[i],heap[j]);\n upheap(j);\nend;\nprocedure downheap(i:longint);\nvar j:longint;\nbegin\n j:=2*i;\n if j>nheap then exit;\n if (ja[heap[j+1]]) then inc(j);\n if a[heap[i]]>a[heap[j]] then\n begin\n doicho(heap[i],heap[j]);\n downheap(j);\n end;\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n heap[nheap]:=x;\n upheap(nheap);\nend;\nfunction pop:longint;\nbegin\n pop:=heap[1];\n heap[1]:=heap[nheap];\n dec(nheap);\n downheap(1);\nend;\nprocedure upheap1(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap1[i]]nheap then exit;\n if (j=Heap[k div 2]) then exit\n else\n begin\n swap(Heap[k],Heap[k div 2]);\n upheapmin(k div 2);\n end;\n end;\n{------------------------------------}\nprocedure downheapmin(k:longint);\nvar vtk:longint;\n begin\n if (2*k<=nheap) then\n begin\n if (2*k+1<=nheap) and (Heap[2*k+1]Heap[vtk] then\n begin\n swap(Heap[k],Heap[vtk]);\n downheapmin(vtk);\n end;\n end;\n end;\n{------------------------------------}\nprocedure pushmin(pt:longint);\n begin\n inc(nheap);\n Heap[nheap]:=pt;\n upheapmin(nheap);\n end;\n{------------------------------------}\nprocedure upheapmax(k:longint);\n begin\n if (k=1) or (Heap[k]<=Heap[k div 2]) then exit\n else\n begin\n swap(Heap[k],Heap[k div 2]);\n upheapmax(k div 2);\n end;\n end;\n{------------------------------------}\nprocedure downheapmax(k:longint);\nvar vtk:longint;\n begin\n if (2*k<=nheap) then\n begin\n if (2*k+1<=nheap) and (Heap[2*k+1]>Heap[2*k]) then vtk:=2*k+1 else vtk:=2*k;\n if Heap[k]Heap[1] then\n begin\n P1[o]:=P1[o]-Heap[1]+A[o];\n Heap[1]:=A[o];\n downheapmin(1);\n end;\n end;\n nheap:=0;\n for o:=3*n downto 2*n+1 do\n begin\n pushmax(A[o]);\n inc(P2[2*n+1],A[o]);\n end;\n for o:=2*n downto n+1 do\n begin\n P2[o]:=P2[o+1];\n if A[o]=Heap[k div 2]) then exit\n else\n begin\n swap(Heap[k],Heap[k div 2]);\n upheapmin(k div 2);\n end;\n end;\n{------------------------------------}\nprocedure downheapmin(k:longint);\nvar vtk:longint;\n begin\n if (2*k<=nheap) then\n begin\n if (2*k+1<=nheap) and (Heap[2*k+1]Heap[vtk] then\n begin\n swap(Heap[k],Heap[vtk]);\n downheapmin(vtk);\n end;\n end;\n end;\n{------------------------------------}\nprocedure pushmin(pt:longint);\n begin\n inc(nheap);\n Heap[nheap]:=pt;\n upheapmin(nheap);\n end;\n{------------------------------------}\nprocedure upheapmax(k:longint);\n begin\n if (k=1) or (Heap[k]<=Heap[k div 2]) then exit\n else\n begin\n swap(Heap[k],Heap[k div 2]);\n upheapmax(k div 2);\n end;\n end;\n{------------------------------------}\nprocedure downheapmax(k:longint);\nvar vtk:longint;\n begin\n if (2*k<=nheap) then\n begin\n if (2*k+1<=nheap) and (Heap[2*k+1]>Heap[2*k]) then vtk:=2*k+1 else vtk:=2*k;\n if Heap[k]Heap[1] then\n begin\n P1[o]:=P1[o]-Heap[1]+A[o];\n Heap[1]:=A[o];\n downheapmin(1);\n end;\n end;\n nheap:=0;\n for o:=3*n downto 2*n+1 do\n begin\n pushmax(A[o]);\n inc(P2[2*n+1],A[o]);\n end;\n for o:=2*n downto n+1 do\n begin\n P2[o]:=P2[o+1];\n if A[o]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nFunction popmin:Longint;\nBegin\n Popmin:=Heapmin[1];\n heapmin[1]:=heapmin[nheapmin];\n Dec(nheapmin);\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]<=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nFunction popmax:Longint;\nBegin\n Popmax:=Heapmax[1];\n Heapmax[1]:=heapmax[nheapmax];\n Dec(nheapmax);\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n For i:=1 to n do\n Begin\n L1[i]:=L1[i-1]+A[i];\n Pushmin(i);\n End;\n For i:=n+1 to 3*n do\n Begin\n k:=Popmin;\n If A[i]>A[k] then Begin L1[i]:=L1[i-1]-A[k]+A[i]; Pushmin(i); End\n Else Begin Pushmin(k); L1[i]:=L1[i-1]; End;\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n For i:=3*n downto 2*n+1 do\n Begin\n L2[i]:=L2[i+1]+A[i];\n Pushmax(i);\n End;\n For i:=2*n downto 1 do\n Begin\n k:=Popmax;\n If A[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nFunction popmin:Longint;\nBegin\n Popmin:=Heapmin[1];\n heapmin[1]:=heapmin[nheapmin];\n Dec(nheapmin);\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]<=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nFunction popmax:Longint;\nBegin\n Popmax:=Heapmax[1];\n Heapmax[1]:=heapmax[nheapmax];\n Dec(nheapmax);\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n For i:=1 to n do\n Begin\n L1[i]:=L1[i-1]+A[i];\n Pushmin(i);\n End;\n For i:=n+1 to 3*n do\n Begin\n k:=Popmin;\n If A[i]>A[k] then Begin L1[i]:=L1[i-1]-A[k]+A[i]; Pushmin(i); End\n Else Begin Pushmin(k); L1[i]:=L1[i-1]; End;\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n For i:=3*n downto 2*n+1 do\n Begin\n L2[i]:=L2[i+1]+A[i];\n Pushmax(i);\n End;\n For i:=2*n downto 1 do\n Begin\n k:=Popmax;\n If A[i]a[heap[j]]) then exit;\n doicho(heap[i],heap[j]);\n upheap(j);\nend;\nprocedure downheap(i:longint);\nvar j:longint;\nbegin\n j:=2*i;\n if j>nheap then exit;\n if (ja[heap[j+1]]) then inc(j);\n if a[heap[i]]>a[heap[j]] then\n begin\n doicho(heap[i],heap[j]);\n downheap(j);\n end;\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n heap[nheap]:=x;\n upheap(nheap);\nend;\nfunction pop:longint;\nbegin\n pop:=heap[1];\n heap[1]:=heap[nheap];\n dec(nheap);\n downheap(1);\nend;\nprocedure upheap1(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap1[i]]nheap then exit;\n if (ja[heap[j]]) then exit;\n doicho(heap[i],heap[j]);\n upheap(j);\nend;\nprocedure downheap(i:longint);\nvar j:longint;\nbegin\n j:=2*i;\n if j>nheap then exit;\n if (ja[heap[j+1]]) then inc(j);\n if a[heap[i]]>a[heap[j]] then\n begin\n doicho(heap[i],heap[j]);\n downheap(j);\n end;\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n heap[nheap]:=x;\n upheap(nheap);\nend;\nfunction pop:longint;\nbegin\n pop:=heap[1];\n heap[1]:=heap[nheap];\n dec(nheap);\n downheap(1);\nend;\nprocedure upheap1(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap1[i]]nheap then exit;\n if (jb[vt-1] do\n begin\n swap(b[vt],b[vt-1]);\n dec(vt);\n end;\n res:=res-b[n+1]+a[i];\n l1[i]:=res;\n end;\n For i:=2*n+1 to 3*n do\n For j:=i+1 to 3*n do\n if a[i]>a[j] then swap(a[i],a[j]);\n res:=0;b[0]:=-1000000005;\n For i:=1 to n do\n begin\n res:=res+a[i+2*n];\n b[i]:=a[i+2*n];\n end;\n l2[2*n+1]:=res;\n For i:=2*n downto n+1 do\n begin\n b[n+1]:=a[i];\n vt:=n+1;\n while b[vt]b[vt-1] do\n begin\n swap(b[vt],b[vt-1]);\n dec(vt);\n end;\n res:=res-b[n+1]+a[i];\n l1[i]:=res;\n end;\n For i:=2*n+1 to 3*n do\n For j:=i+1 to 3*n do\n if a[i]>a[j] then swap(a[i],a[j]);\n res:=0;b[0]:=-1000000005;\n For i:=1 to n do\n begin\n res:=res+a[i+2*n];\n b[i]:=a[i+2*n];\n end;\n l2[2*n+1]:=res;\n For i:=2*n downto n+1 do\n begin\n b[n+1]:=a[i];\n vt:=n+1;\n while b[vt]b[vt-1] do\n begin\n swap(b[vt],b[vt-1]);\n dec(vt);\n end;\n res:=res-b[n+1]+a[i];\n l1[i]:=res;\n end;\n For i:=2*n+1 to 3*n do\n For j:=i+1 to 3*n do\n if a[i]>a[j] then swap(a[i],a[j]);\n res:=0;b[0]:=-1000000005;\n For i:=1 to n do\n begin\n res:=res+a[i+2*n];\n b[i]:=a[i+2*n];\n end;\n l2[2*n+1]:=res;\n For i:=2*n downto n+1 do\n begin\n b[n+1]:=a[i];\n vt:=n+1;\n while b[vt]b[vt-1] do\n begin\n swap(b[vt],b[vt-1]);\n dec(vt);\n end;\n res:=res-b[n+1]+a[i];\n l1[i]:=res;\n end;\n For i:=2*n+1 to 3*n do\n For j:=i+1 to 3*n do\n if a[i]>a[j] then swap(a[i],a[j]);\n res:=0;b[0]:=-1000000005;\n For i:=1 to n do\n begin\n res:=res+a[i+2*n];\n b[i]:=a[i+2*n];\n end;\n l2[2*n+1]:=res;\n For i:=2*n downto n+1 do\n begin\n b[n+1]:=a[i];\n vt:=n+1;\n while b[vt]x do dec(r);\n if l<=r then\n begin\n swap(l,r);\n inc(l); dec(r);\n end;\n until l>r;\n if lkq then kq:=tong;\n end;\n assign(g,fo); rewrite(g);\n writeln(g,kq);\n close(g);\nend; }\n\nprocedure up(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (b[v]b[q[l+1]]) then inc(l);\n if b[q[l]]>=b[v] then break;\n q[k]:=q[l];\n vt[q[k]]:=k;\n k:=l;\n end;\n q[k]:=v;\n vt[v]:=k;\nend;\n\nprocedure put(u :longint);\nbegin\n inc(top); q[top]:=u; vt[u]:=top;\n up(top);\nend;\n\nfunction get :longint;\nbegin\n get:=q[1];\n q[1]:=q[top]; vt[q[1]]:=1;\n dec(top);\n down(1);\nend;\n\nprocedure up1(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (b[v]>b[q[k div 2]]) do\n begin\n q[k]:=q[k div 2];\n vt[q[k]]:=k;\n k:=k div 2;\n end;\n q[k]:=v;\n vt[q[k]]:=k;\nend;\n\nprocedure down1(k :longint);\nvar l,v :longint;\nbegin\n v:=q[k];\n while 2*k<=top do\n begin\n l:=2*k;\n if (lb[q[1]]) and (top>0) then\n begin\n j:=get;\n tong:=tong-b[j];\n tong:=tong+b[i];\n put(i);\n end;\n l1[i]:=tong;\n end;\n tong:=0;\n b[0]:=round(1e9)+1; q[0]:=0; top:=0;\n for i:=3*n downto 2*n+1 do\n begin\n tong:=tong+b[i];\n put1(i);\n end;\n l2[2*n+1]:=tong;\n for i:=2*n downto n do\n begin\n if (b[i]0) then\n begin\n j:=get1;\n tong:=tong-b[j];\n tong:=tong+b[i];\n put1(i);\n end;\n l2[i]:=tong;\n end;\n kq:=-round(1e18);\n for i:=n to 2*n do if l1[i]-l2[i+1]>kq then kq:=l1[i]-l2[i+1];\n assign(g,fo); rewrite(g);\n writeln(g,kq);\n close(g);\nend;\n\nbegin\n nhap;\n // traubo;\n xuli;\nend.\n", "language": "Pascal", "metadata": {"date": 1510851550, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03716.html", "problem_id": "p03716", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03716/input.txt", "sample_output_relpath": "derived/input_output/data/p03716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03716/Pascal/s595305062.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s595305062", "user_id": "u739490378"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const fi ='';\n fo ='';\n\nvar f,g :text;\n n,top :longint;\n b,a,q,vt:array[0..300005] of longint;\n l1,l2 :array[0..300005] of int64;\n kq :int64;\nprocedure nhap;\nvar i :longint;\nbegin\n assign(f,fi); reset(f);\n readln(f,n);\n for i:=1 to 3*n do read(f,b[i]);\n close(f);\nend;\n\n{procedure swap(i,j :longint);\nvar tg :longint;\nbegin\n tg:=a[i]; a[i]:=a[j]; a[j]:=tg;\n tg:=vt[i]; vt[i]:=vt[j]; vt[j]:=tg;\nend;\n\nprocedure qs(d,c :longint);\nvar l,r :longint;\n x :longint;\nbegin\n x:=a[(d+c) div 2];\n l:=d; r:=c;\n repeat\n while a[l]x do dec(r);\n if l<=r then\n begin\n swap(l,r);\n inc(l); dec(r);\n end;\n until l>r;\n if lkq then kq:=tong;\n end;\n assign(g,fo); rewrite(g);\n writeln(g,kq);\n close(g);\nend; }\n\nprocedure up(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (b[v]b[q[l+1]]) then inc(l);\n if b[q[l]]>=b[v] then break;\n q[k]:=q[l];\n vt[q[k]]:=k;\n k:=l;\n end;\n q[k]:=v;\n vt[v]:=k;\nend;\n\nprocedure put(u :longint);\nbegin\n inc(top); q[top]:=u; vt[u]:=top;\n up(top);\nend;\n\nfunction get :longint;\nbegin\n get:=q[1];\n q[1]:=q[top]; vt[q[1]]:=1;\n dec(top);\n down(1);\nend;\n\nprocedure up1(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (b[v]>b[q[k div 2]]) do\n begin\n q[k]:=q[k div 2];\n vt[q[k]]:=k;\n k:=k div 2;\n end;\n q[k]:=v;\n vt[q[k]]:=k;\nend;\n\nprocedure down1(k :longint);\nvar l,v :longint;\nbegin\n v:=q[k];\n while 2*k<=top do\n begin\n l:=2*k;\n if (lb[q[1]]) and (top>0) then\n begin\n j:=get;\n tong:=tong-b[j];\n tong:=tong+b[i];\n put(i);\n end;\n l1[i]:=tong;\n end;\n tong:=0;\n b[0]:=round(1e9)+1; q[0]:=0; top:=0;\n for i:=3*n downto 2*n+1 do\n begin\n tong:=tong+b[i];\n put1(i);\n end;\n l2[2*n+1]:=tong;\n for i:=2*n downto n do\n begin\n if (b[i]0) then\n begin\n j:=get1;\n tong:=tong-b[j];\n tong:=tong+b[i];\n put1(i);\n end;\n l2[i]:=tong;\n end;\n kq:=-round(1e18);\n for i:=n to 2*n do if l1[i]-l2[i+1]>kq then kq:=l1[i]-l2[i+1];\n assign(g,fo); rewrite(g);\n writeln(g,kq);\n close(g);\nend;\n\nbegin\n nhap;\n // traubo;\n xuli;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "sample_input": "2\n3 1 4 1 5 9\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03716", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5347, "cpu_time_ms": 83, "memory_kb": 7936}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s096510576", "group_id": "codeNet:p03716", "input_text": "Const fi='';\n fo='';\nVar f:Text;\n n:Longint;\n A:Array[0..300000] of Longint;\n L1,L2:Array[0..300000] of Int64;\n Heapmin,Heapmax:Array[0..100000] of Longint;\n nheapmin,nheapmax:Longint; sol:Int64;\nFunction max(i,j:Int64):Int64; Begin If i=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(a[heapmin[x]],a[heapmin[vt]]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nFunction popmin:Longint;\nBegin\n Popmin:=Heapmin[1];\n heapmin[1]:=heapmin[nheapmin];\n Dec(nheapmin);\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]<=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(a[heapmax[x]],a[heapmax[vt]]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nFunction popmax:Longint;\nBegin\n Popmax:=Heapmax[1];\n Heapmax[1]:=heapmax[nheapmax];\n Dec(nheapmax);\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n For i:=1 to n do\n Begin\n L1[i]:=L1[i-1]+A[i];\n Pushmin(i);\n End;\n For i:=n+1 to 3*n do\n Begin\n k:=Popmin;\n If A[i]>A[k] then Begin L1[i]:=L1[i-1]-A[k]+A[i]; Pushmin(i); End\n Else Begin Pushmin(k); L1[i]:=L1[i-1]; End;\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n For i:=3*n downto 2*n+1 do\n Begin\n L2[i]:=L2[i+1]+A[i];\n Pushmax(i);\n End;\n For i:=2*n downto 1 do\n Begin\n k:=Popmax;\n If A[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(a[heapmin[x]],a[heapmin[vt]]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nFunction popmin:Longint;\nBegin\n Popmin:=Heapmin[1];\n heapmin[1]:=heapmin[nheapmin];\n Dec(nheapmin);\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]<=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(a[heapmax[x]],a[heapmax[vt]]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nFunction popmax:Longint;\nBegin\n Popmax:=Heapmax[1];\n Heapmax[1]:=heapmax[nheapmax];\n Dec(nheapmax);\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n For i:=1 to n do\n Begin\n L1[i]:=L1[i-1]+A[i];\n Pushmin(i);\n End;\n For i:=n+1 to 3*n do\n Begin\n k:=Popmin;\n If A[i]>A[k] then Begin L1[i]:=L1[i-1]-A[k]+A[i]; Pushmin(i); End\n Else Begin Pushmin(k); L1[i]:=L1[i-1]; End;\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n For i:=3*n downto 2*n+1 do\n Begin\n L2[i]:=L2[i+1]+A[i];\n Pushmax(i);\n End;\n For i:=2*n downto 1 do\n Begin\n k:=Popmax;\n If A[i]> 1];\n repeat\n while a[i] < x do i:=i + 1;\n while x < a[j] do j:=j - 1;\n if not(i > j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n i:=i + 1; j:=j - 1;\n end;\n until i > j;\n if l < j then sort(l,j);\n if i < r then sort(i,r);\nend;\nbegin\n readln(n,k);\n for i:=1 to n do readln(a[i],b[i]);\n sort(1,n);\n for i:=1 to n do \n begin\n tmp+=b[i];\n if tmp >= k then\n begin\n write(a[i]);\n break;\n end;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1567449290, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03721.html", "problem_id": "p03721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03721/input.txt", "sample_output_relpath": "derived/input_output/data/p03721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03721/Pascal/s903465430.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s903465430", "user_id": "u482388085"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var i,n:longint;\n a,b:array[1..200000] of longint;\n tmp,k:qword;\nprocedure sort(l,r:longint);\nvar i,j,x,y: longint;\nbegin\n i:=l; j:=r; x:=a[(l + r) >> 1];\n repeat\n while a[i] < x do i:=i + 1;\n while x < a[j] do j:=j - 1;\n if not(i > j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n i:=i + 1; j:=j - 1;\n end;\n until i > j;\n if l < j then sort(l,j);\n if i < r then sort(i,r);\nend;\nbegin\n readln(n,k);\n for i:=1 to n do readln(a[i],b[i]);\n sort(1,n);\n for i:=1 to n do \n begin\n tmp+=b[i];\n if tmp >= k then\n begin\n write(a[i]);\n break;\n end;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "sample_input": "3 4\n1 1\n2 2\n3 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03721", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 710, "cpu_time_ms": 32, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s729786715", "group_id": "codeNet:p03721", "input_text": "var i,n:longint;\n a,b:array[1..200000] of longint;\n tmp,k:qword;\nprocedure sort(l,r:longint);\nvar i,j,x,y: longint;\nbegin\n i:=l; j:=r; x:=a[(l + r) >> 1];\n repeat\n while a[i] < x do i:=i + 1;\n while x < a[j] do j:=j - 1;\n if not(i > j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n i:=i + 1; j:=j - 1;\n end;\n until i > j;\n if l < j then sort(l,j);\n if i < r then sort(i,r);\nend;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i],b[i]);\n readln(k);\n sort(1,n);\n for i:=1 to n do \n begin\n tmp+=b[i];\n if tmp >= k then\n begin\n write(a[i]);\n break;\n end;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1567449125, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03721.html", "problem_id": "p03721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03721/input.txt", "sample_output_relpath": "derived/input_output/data/p03721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03721/Pascal/s729786715.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s729786715", "user_id": "u482388085"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var i,n:longint;\n a,b:array[1..200000] of longint;\n tmp,k:qword;\nprocedure sort(l,r:longint);\nvar i,j,x,y: longint;\nbegin\n i:=l; j:=r; x:=a[(l + r) >> 1];\n repeat\n while a[i] < x do i:=i + 1;\n while x < a[j] do j:=j - 1;\n if not(i > j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n i:=i + 1; j:=j - 1;\n end;\n until i > j;\n if l < j then sort(l,j);\n if i < r then sort(i,r);\nend;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i],b[i]);\n readln(k);\n sort(1,n);\n for i:=1 to n do \n begin\n tmp+=b[i];\n if tmp >= k then\n begin\n write(a[i]);\n break;\n end;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "sample_input": "3 4\n1 1\n2 2\n3 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03721", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 721, "cpu_time_ms": 32, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s220632194", "group_id": "codeNet:p03721", "input_text": "var i,n:longint;\n a,b:array[1..200000] of longint;\n tmp,k:qword;\nprocedure sort(l,r:longint);\nvar i,j,x,y: longint;\nbegin\n i:=l; j:=r; x:=a[(l + r) >> 1];\n repeat\n while a[i] < x do i:=i + 1;\n while x < a[j] do j:=j - 1;\n if not(i > j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n i:=i + 1; j:=j - 1;\n end;\n until i > j;\n if l < j then sort(l,j);\n if i < r then sort(i,r);\nend;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i],b[i]);\n readln(k);\n sort(1,n);\n for i:=1 to n do \n begin\n if b[i] + tmp < k then tmp+=b[i]\n else if b[i] + tmp >= k then\n begin\n write(a[i]);\n break;\n end;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1567449004, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03721.html", "problem_id": "p03721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03721/input.txt", "sample_output_relpath": "derived/input_output/data/p03721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03721/Pascal/s220632194.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s220632194", "user_id": "u482388085"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var i,n:longint;\n a,b:array[1..200000] of longint;\n tmp,k:qword;\nprocedure sort(l,r:longint);\nvar i,j,x,y: longint;\nbegin\n i:=l; j:=r; x:=a[(l + r) >> 1];\n repeat\n while a[i] < x do i:=i + 1;\n while x < a[j] do j:=j - 1;\n if not(i > j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n y:=b[i];\n b[i]:=b[j];\n b[j]:=y;\n i:=i + 1; j:=j - 1;\n end;\n until i > j;\n if l < j then sort(l,j);\n if i < r then sort(i,r);\nend;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i],b[i]);\n readln(k);\n sort(1,n);\n for i:=1 to n do \n begin\n if b[i] + tmp < k then tmp+=b[i]\n else if b[i] + tmp >= k then\n begin\n write(a[i]);\n break;\n end;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "sample_input": "3 4\n1 1\n2 2\n3 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03721", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 755, "cpu_time_ms": 32, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s233672044", "group_id": "codeNet:p03725", "input_text": "var b,bb:array[1..800,1..800]of boolean;\n a:array[1..800,1..800]of longint;\n x,y,i,j,h,w,k,sx,sy,ans:longint;\n ch:char;\nfunction min(a,b,c,d,e:longint):longint;\nbegin\n if(a0 then if(not b[x-1,y])and(p0 then if(not b[x,y-1])and(p0 then writeln((ans+k) div k+1) else writeln(ans div k+1);\nend.\n \n\nGalaxy Online Judge System\n\n", "language": "Pascal", "metadata": {"date": 1503934405, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03725.html", "problem_id": "p03725", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03725/input.txt", "sample_output_relpath": "derived/input_output/data/p03725/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03725/Pascal/s233672044.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s233672044", "user_id": "u835735233"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var b,bb:array[1..800,1..800]of boolean;\n a:array[1..800,1..800]of longint;\n x,y,i,j,h,w,k,sx,sy,ans:longint;\n ch:char;\nfunction min(a,b,c,d,e:longint):longint;\nbegin\n if(a0 then if(not b[x-1,y])and(p0 then if(not b[x,y-1])and(p0 then writeln((ans+k) div k+1) else writeln(ans div k+1);\nend.\n \n\nGalaxy Online Judge System\n\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nTakahashi is locked within a building.\n\nThis building consists of H×W rooms, arranged in H rows and W columns.\nWe will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= #, the room is locked and cannot be entered; if A_{i,j}= ., the room is not locked and can be freely entered.\nTakahashi is currently at the room where A_{i,j}= S, which can also be freely entered.\n\nEach room in the 1-st row, 1-st column, H-th row or W-th column, has an exit.\nEach of the other rooms (i,j) is connected to four rooms: (i-1,j), (i+1,j), (i,j-1) and (i,j+1).\n\nTakahashi will use his magic to get out of the building. In one cast, he can do the following:\n\nMove to an adjacent room at most K times, possibly zero. Here, locked rooms cannot be entered.\n\nThen, select and unlock at most K locked rooms, possibly zero. Those rooms will remain unlocked from then on.\n\nHis objective is to reach a room with an exit. Find the minimum necessary number of casts to do so.\n\nIt is guaranteed that Takahashi is initially at a room without an exit.\n\nConstraints\n\n3 ≤ H ≤ 800\n\n3 ≤ W ≤ 800\n\n1 ≤ K ≤ H×W\n\nEach A_{i,j} is # , . or S.\n\nThere uniquely exists (i,j) such that A_{i,j}= S, and it satisfies 2 ≤ i ≤ H-1 and 2 ≤ j ≤ W-1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nA_{1,1}A_{1,2}...A_{1,W}\n:\nA_{H,1}A_{H,2}...A_{H,W}\n\nOutput\n\nPrint the minimum necessary number of casts.\n\nSample Input 1\n\n3 3 3\n#.#\n#S.\n###\n\nSample Output 1\n\n1\n\nTakahashi can move to room (1,2) in one cast.\n\nSample Input 2\n\n3 3 3\n###\n#S#\n###\n\nSample Output 2\n\n2\n\nTakahashi cannot move in the first cast, but can unlock room (1,2).\nThen, he can move to room (1,2) in the next cast, achieving the objective in two casts.\n\nSample Input 3\n\n7 7 2\n#######\n#######\n##...##\n###S###\n##.#.##\n###.###\n#######\n\nSample Output 3\n\n2", "sample_input": "3 3 3\n#.#\n#S.\n###\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03725", "source_text": "Score : 700 points\n\nProblem Statement\n\nTakahashi is locked within a building.\n\nThis building consists of H×W rooms, arranged in H rows and W columns.\nWe will denote the room at the i-th row and j-th column as (i,j). The state of this room is represented by a character A_{i,j}. If A_{i,j}= #, the room is locked and cannot be entered; if A_{i,j}= ., the room is not locked and can be freely entered.\nTakahashi is currently at the room where A_{i,j}= S, which can also be freely entered.\n\nEach room in the 1-st row, 1-st column, H-th row or W-th column, has an exit.\nEach of the other rooms (i,j) is connected to four rooms: (i-1,j), (i+1,j), (i,j-1) and (i,j+1).\n\nTakahashi will use his magic to get out of the building. In one cast, he can do the following:\n\nMove to an adjacent room at most K times, possibly zero. Here, locked rooms cannot be entered.\n\nThen, select and unlock at most K locked rooms, possibly zero. Those rooms will remain unlocked from then on.\n\nHis objective is to reach a room with an exit. Find the minimum necessary number of casts to do so.\n\nIt is guaranteed that Takahashi is initially at a room without an exit.\n\nConstraints\n\n3 ≤ H ≤ 800\n\n3 ≤ W ≤ 800\n\n1 ≤ K ≤ H×W\n\nEach A_{i,j} is # , . or S.\n\nThere uniquely exists (i,j) such that A_{i,j}= S, and it satisfies 2 ≤ i ≤ H-1 and 2 ≤ j ≤ W-1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nA_{1,1}A_{1,2}...A_{1,W}\n:\nA_{H,1}A_{H,2}...A_{H,W}\n\nOutput\n\nPrint the minimum necessary number of casts.\n\nSample Input 1\n\n3 3 3\n#.#\n#S.\n###\n\nSample Output 1\n\n1\n\nTakahashi can move to room (1,2) in one cast.\n\nSample Input 2\n\n3 3 3\n###\n#S#\n###\n\nSample Output 2\n\n2\n\nTakahashi cannot move in the first cast, but can unlock room (1,2).\nThen, he can move to room (1,2) in the next cast, achieving the objective in two casts.\n\nSample Input 3\n\n7 7 2\n#######\n#######\n##...##\n###S###\n##.#.##\n###.###\n#######\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1321, "cpu_time_ms": 33, "memory_kb": 13952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s785203562", "group_id": "codeNet:p03725", "input_text": "var\n n,m,k,i,j,x,y,head,tail,tot,ans:longint;\n map:array[0..801,0..801]of char;\n cost,dx,dy:array[0..650000]of longint;\n p:array[0..801,0..801]of boolean;\n s:ansistring;\n\nfunction min(x,y:longint):longint;\nbegin\n if x1) then begin\n inc(tail);\n dx[tail]:=x-1; dy[tail]:=y;\n cost[tail]:=cost[head]+1;\n p[x-1,y]:=false;\n end;\n if p[x+1,y] and (x1) then begin\n inc(tail);\n dx[tail]:=x; dy[tail]:=y-1;\n cost[tail]:=cost[head]+1;\n p[x,y-1]:=false;\n end;\n if p[x,y+1] and (y1) then begin\n inc(tail);\n dx[tail]:=x-1; dy[tail]:=y;\n cost[tail]:=cost[head]+1;\n p[x-1,y]:=false;\n end;\n if p[x+1,y] and (x1) then begin\n inc(tail);\n dx[tail]:=x; dy[tail]:=y-1;\n cost[tail]:=cost[head]+1;\n p[x,y-1]:=false;\n end;\n if p[x,y+1] and (yf[j] then f[j]:=f[j-w[i]]+v[i];\n writeln(f[m]);\nend.", "language": "Pascal", "metadata": {"date": 1582426198, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03732.html", "problem_id": "p03732", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03732/input.txt", "sample_output_relpath": "derived/input_output/data/p03732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03732/Pascal/s135028890.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s135028890", "user_id": "u263933075"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "var\n f:array[0..1000] of longint;\n w,v:array[0..1001] of longint;\n i,j,n,m:longint;\nbegin\n readln(m,n);\n for i:=1 to n do readln(w[i],v[i]);\n for i:=1 to n do\n for j:=m downto w[i] do\n if f[j-w[i]]+v[i]>f[j] then f[j]:=f[j-w[i]]+v[i];\n writeln(f[m]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "sample_input": "4 6\n2 1\n3 4\n4 10\n3 4\n"}, "reference_outputs": ["11\n"], "source_document_id": "p03732", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s710126126", "group_id": "codeNet:p03734", "input_text": "var\n\tN,W,wi,w0,vi,i,j,k,l:Longint;\n\tv:array[0..3,0..100]of Longint;\n\tc:array[0..3]of Longint;\n\tans,now,noww:int64;\nbegin\n\tread(N,W);\n\tfor i:=1 to N do begin\n\t\tread(wi,vi);\n\t\tif i=1 then w0:=wi;\n\t\tinc(c[wi-w0]);\n\t\tv[wi-w0,c[wi-w0]]:=vi;\n\tend;\n\tfor i:=0 to 3 do begin\n\t\tfor j:=1 to c[i] do begin\n\t\t\tfor k:=j+1 to c[i] do begin\n\t\t\t\tif v[i,j]ans)then begin\n\t\t\t\t\t\tans:=v[0,i]+v[1,j]+v[2,k]+v[3,l];\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1542717654, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03734.html", "problem_id": "p03734", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03734/input.txt", "sample_output_relpath": "derived/input_output/data/p03734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03734/Pascal/s710126126.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s710126126", "user_id": "u657913472"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "var\n\tN,W,wi,w0,vi,i,j,k,l:Longint;\n\tv:array[0..3,0..100]of Longint;\n\tc:array[0..3]of Longint;\n\tans,now,noww:int64;\nbegin\n\tread(N,W);\n\tfor i:=1 to N do begin\n\t\tread(wi,vi);\n\t\tif i=1 then w0:=wi;\n\t\tinc(c[wi-w0]);\n\t\tv[wi-w0,c[wi-w0]]:=vi;\n\tend;\n\tfor i:=0 to 3 do begin\n\t\tfor j:=1 to c[i] do begin\n\t\t\tfor k:=j+1 to c[i] do begin\n\t\t\t\tif v[i,j]ans)then begin\n\t\t\t\t\t\tans:=v[0,i]+v[1,j]+v[2,k]+v[3,l];\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "sample_input": "4 6\n2 1\n3 4\n4 10\n3 4\n"}, "reference_outputs": ["11\n"], "source_document_id": "p03734", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 818, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s764354705", "group_id": "codeNet:p03738", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n h,w,i,j,count,x,y,sw,m,n:Integer;\n s123,s1,s2,s3,a,b:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(a);\n Readln(b);\n\n if Length(a)>Length(b) then begin\n Writeln('GREATER');\n Readln;\n exit;\n end else if Length(a)StrToInt(b[i]) then begin\n Writeln('GREATER');\n Readln;\n exit;\n end else if StrToInt(a[i])Length(b) then begin\n Writeln('GREATER');\n Readln;\n exit;\n end else if Length(a)StrToInt(b[i]) then begin\n Writeln('GREATER');\n Readln;\n exit;\n end else if StrToInt(a[i])B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "sample_input": "36\n24\n"}, "reference_outputs": ["GREATER\n"], "source_document_id": "p03738", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 889, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s645714039", "group_id": "codeNet:p03739", "input_text": "program ec12;\nvar \n\tans,sum1,sum2,ans1:int64;\n\ta:array[0..100000] of int64;\n\tn,m,i,j:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\tans1:=0;\n\tfor i:=1 to n do\n\tread(a[i]);\n\tif a[1]>0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans:=0;\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\t\tans1:=0;\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans:=0;\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\t\tans1:=0;\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans:=0;\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=(-a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tans1:=0;\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans:=0;\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=(-a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tans1:=0;\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif ans1 then \n\t\tbegin \n\t\t\tif s[i-1]<0 then \n\t\t\tbegin\t\n\t\t\t\tif s[i]<=0 then \n\t\t\t\tbegin\n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tinc(ans,(-s[i])+1);\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif s[i]>=0 then \n\t\t\t\tbegin \n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans,s[i]+1);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tif a[1]=0 then \n\t\t\tbegin \n\t\t\t\tif a[2]>0 then \n\t\t\t\tbegin \t\n\t\t\t\t\tinc(ans,a[2]+1);\n\t\t\t\t\ts[1]:=-1;\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tbegin \n\t\t\t\t\tinc(ans,(-a[2])+1);\n\t\t\t\t\ts[1]:=1;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509852398, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03739.html", "problem_id": "p03739", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03739/input.txt", "sample_output_relpath": "derived/input_output/data/p03739/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03739/Pascal/s560993551.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s560993551", "user_id": "u662099472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ec12;\nvar \n\ta,s:array[0..100000] of longint;\n\tn,m,i,j,ans:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\ts[0]:=0;\n\tfor i:=1 to n do\n\tread(a[i]);\n\tfor i:=1 to n do \n\tbegin \n\t\ts[i]:=s[i-1]+a[i];\n\t\tif i>1 then \n\t\tbegin \n\t\t\tif s[i-1]<0 then \n\t\t\tbegin\t\n\t\t\t\tif s[i]<=0 then \n\t\t\t\tbegin\n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tinc(ans,(-s[i])+1);\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif s[i]>=0 then \n\t\t\t\tbegin \n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans,s[i]+1);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tif a[1]=0 then \n\t\t\tbegin \n\t\t\t\tif a[2]>0 then \n\t\t\t\tbegin \t\n\t\t\t\t\tinc(ans,a[2]+1);\n\t\t\t\t\ts[1]:=-1;\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tbegin \n\t\t\t\t\tinc(ans,(-a[2])+1);\n\t\t\t\t\ts[1]:=1;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "sample_input": "4\n1 -3 1 0\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03739", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 852, "cpu_time_ms": 17, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s800321257", "group_id": "codeNet:p03739", "input_text": "program ec12;\nvar \n\ta,s:array[0..100000] of longint;\n\tn,m,i,j,ans:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\ts[0]:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\ts[i]:=s[i-1]+a[i];\n\t\tif i>1 then \n\t\tbegin \n\t\t\tif s[i-1]<0 then \n\t\t\tbegin\t\n\t\t\t\tif s[i]<=0 then \n\t\t\t\tbegin\n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tinc(ans,(-s[i])+1);\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif s[i]>=0 then \n\t\t\t\tbegin \n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans,s[i]+1);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509852006, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03739.html", "problem_id": "p03739", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03739/input.txt", "sample_output_relpath": "derived/input_output/data/p03739/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03739/Pascal/s800321257.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s800321257", "user_id": "u662099472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ec12;\nvar \n\ta,s:array[0..100000] of longint;\n\tn,m,i,j,ans:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\ts[0]:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\ts[i]:=s[i-1]+a[i];\n\t\tif i>1 then \n\t\tbegin \n\t\t\tif s[i-1]<0 then \n\t\t\tbegin\t\n\t\t\t\tif s[i]<=0 then \n\t\t\t\tbegin\n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tinc(ans,(-s[i])+1);\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif s[i]>=0 then \n\t\t\t\tbegin \n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans,s[i]+1);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "sample_input": "4\n1 -3 1 0\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03739", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 17, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s443806476", "group_id": "codeNet:p03745", "input_text": "var n,i,t,x,y,ans:longint;\nprocedure fresh;inline;\nbegin\n t:=0;inc(ans);\nend;\nbegin\n read(n,x);\n for i:=2 to n do\n begin\n read(y);\n case t of\n 0:if x>y then t:=1 else\n if xy then fresh;\n end;\n x:=y;\n end;\n writeln(ans+1);\nend.", "language": "Pascal", "metadata": {"date": 1584900488, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03745.html", "problem_id": "p03745", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03745/input.txt", "sample_output_relpath": "derived/input_output/data/p03745/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03745/Pascal/s443806476.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s443806476", "user_id": "u247366051"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,i,t,x,y,ans:longint;\nprocedure fresh;inline;\nbegin\n t:=0;inc(ans);\nend;\nbegin\n read(n,x);\n for i:=2 to n do\n begin\n read(y);\n case t of\n 0:if x>y then t:=1 else\n if xy then fresh;\n end;\n x:=y;\n end;\n writeln(ans+1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "sample_input": "6\n1 2 3 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03745", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 310, "cpu_time_ms": 16, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s176484796", "group_id": "codeNet:p03745", "input_text": "var\n i,j,a1,a2,n,r:integer;\n a:array[1..100005] of integer;\nbegin\n r:=0;\n read(n);\n for i:=1 to n do read(a[i]);\n while j<=n do\n begin\n r:=r+1;\n a1:=a[j];\n j:=j+1;\n while (a[j]=a1) and (j<=n) do j:=j+1;\n a2:=a[j];\n j:=j+1;\n while ((a1-a2) * (a[j-1]-a[j]) >= 0) and (j<=n) do j:=j+1;\n end;\n writeln(r);\nend.\n", "language": "Pascal", "metadata": {"date": 1515977717, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03745.html", "problem_id": "p03745", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03745/input.txt", "sample_output_relpath": "derived/input_output/data/p03745/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03745/Pascal/s176484796.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s176484796", "user_id": "u598016178"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n i,j,a1,a2,n,r:integer;\n a:array[1..100005] of integer;\nbegin\n r:=0;\n read(n);\n for i:=1 to n do read(a[i]);\n while j<=n do\n begin\n r:=r+1;\n a1:=a[j];\n j:=j+1;\n while (a[j]=a1) and (j<=n) do j:=j+1;\n a2:=a[j];\n j:=j+1;\n while ((a1-a2) * (a[j-1]-a[j]) >= 0) and (j<=n) do j:=j+1;\n end;\n writeln(r);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "sample_input": "6\n1 2 3 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03745", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 337, "cpu_time_ms": 16, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s590801365", "group_id": "codeNet:p03759", "input_text": "var\n a,b,c:longint;\nbegin\n readln(a,b,c);\n if (abs(a-b)=abs(b-c)) then writeln('YES')\n else writeln('NO');\nend.", "language": "Pascal", "metadata": {"date": 1534602278, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03759.html", "problem_id": "p03759", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03759/input.txt", "sample_output_relpath": "derived/input_output/data/p03759/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03759/Pascal/s590801365.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s590801365", "user_id": "u817031702"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var\n a,b,c:longint;\nbegin\n readln(a,b,c);\n if (abs(a-b)=abs(b-c)) then writeln('YES')\n else writeln('NO');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.\n\nDetermine whether the arrangement of the poles is beautiful.\n\nConstraints\n\n1 \\leq a,b,c \\leq 100\n\na, b and c are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nPrint YES if the arrangement of the poles is beautiful; print NO otherwise.\n\nSample Input 1\n\n2 4 6\n\nSample Output 1\n\nYES\n\nSince 4-2 = 6-4, this arrangement of poles is beautiful.\n\nSample Input 2\n\n2 5 6\n\nSample Output 2\n\nNO\n\nSince 5-2 \\neq 6-5, this arrangement of poles is not beautiful.\n\nSample Input 3\n\n3 2 1\n\nSample Output 3\n\nYES\n\nSince 1-2 = 2-3, this arrangement of poles is beautiful.", "sample_input": "2 4 6\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03759", "source_text": "Score : 100 points\n\nProblem Statement\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.\n\nDetermine whether the arrangement of the poles is beautiful.\n\nConstraints\n\n1 \\leq a,b,c \\leq 100\n\na, b and c are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nPrint YES if the arrangement of the poles is beautiful; print NO otherwise.\n\nSample Input 1\n\n2 4 6\n\nSample Output 1\n\nYES\n\nSince 4-2 = 6-4, this arrangement of poles is beautiful.\n\nSample Input 2\n\n2 5 6\n\nSample Output 2\n\nNO\n\nSince 5-2 \\neq 6-5, this arrangement of poles is not beautiful.\n\nSample Input 3\n\n3 2 1\n\nSample Output 3\n\nYES\n\nSince 1-2 = 2-3, this arrangement of poles is beautiful.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s214549740", "group_id": "codeNet:p03767", "input_text": "// luogu-judger-enable-o2\nvar\n a:array[0..300005] of longint;\n i,j,n:longint;\n s:qword;\n procedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if l3 do \n begin\n i:=i-2;\n s:=s+a[i];\n end;\n writeln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1568412675, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03767.html", "problem_id": "p03767", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03767/input.txt", "sample_output_relpath": "derived/input_output/data/p03767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03767/Pascal/s214549740.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s214549740", "user_id": "u476418095"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "// luogu-judger-enable-o2\nvar\n a:array[0..300005] of longint;\n i,j,n:longint;\n s:qword;\n procedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if l3 do \n begin\n i:=i-2;\n s:=s+a[i];\n end;\n writeln(s);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "sample_input": "2\n5 2 8 5 1 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 807, "cpu_time_ms": 60, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s969187860", "group_id": "codeNet:p03767", "input_text": "var n,i,x:longint;\n s:int64;\n a:array[0..100003] of longint;\n fi,fo:text;\nprocedure start;\nbegin\n assign(fi,''); reset(fi);\n assign(fo,''); rewrite(fo);\n readln(fi,n);\n n:= 3*n;\n for i:= 1 to n do read(fi,a[i]);\nend;\nprocedure sort(l,r:longint);\nvar i,j,mid,tmp:longint;\nbegin\n i:= l; j:= r; mid:= a[(l+r)div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n tmp:= a[i]; a[i]:= a[j]; a[j]:= tmp;\n inc(i); dec(j);\n end;\n until i>j;\n if lmid do dec(j);\n if i<=j then\n begin\n tmp:= a[i]; a[i]:= a[j]; a[j]:= tmp;\n inc(i); dec(j);\n end;\n until i>j;\n if l=o then exit;\n i:=first[p]; fw[p]:=o; b[p]:=true;\n if color[p]=0 then color[p]:=cl;\n while (i>=1) do begin\n if b[ed[i]]=false then\n dfs(ed[i],o-1,cl);\n i:=next[i];\n end;\n b[p]:=false;\nend;\nbegin\n readln(n,m);\n for i:=1 to m do first[i]:=-1;\n fillchar(fw,sizeof(fw),255);\n for i:=1 to m do begin readln(x,y); ad(x,y);ad(y,x); end;\n readln(q);\n for i:=1 to q do readln(v[i],d[i],c[i]);\n for i:=q downto 1 do begin dfs(v[i],d[i],c[i]); end;\n for i:=1 to n do writeln(color[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499735322, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s009833874.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s009833874", "user_id": "u069768083"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "var i,j,k,l,m,n,q,w,x,y,t:longint;\n st,ed,first,next,d,v,color,fw,c:array[1..200000] of longint;\n b:array[1..200000]of boolean;\nprocedure ad(p,o:longint);\nbegin\n t:=t+1; ed[t]:=o; next[t]:=first[p];first[p]:=t;\nend;\nprocedure dfs(p,o,cl:longint);\nvar i,j:longint;\nbegin\n if fw[p]>=o then exit;\n i:=first[p]; fw[p]:=o; b[p]:=true;\n if color[p]=0 then color[p]:=cl;\n while (i>=1) do begin\n if b[ed[i]]=false then\n dfs(ed[i],o-1,cl);\n i:=next[i];\n end;\n b[p]:=false;\nend;\nbegin\n readln(n,m);\n for i:=1 to m do first[i]:=-1;\n fillchar(fw,sizeof(fw),255);\n for i:=1 to m do begin readln(x,y); ad(x,y);ad(y,x); end;\n readln(q);\n for i:=1 to q do readln(v[i],d[i],c[i]);\n for i:=q downto 1 do begin dfs(v[i],d[i],c[i]); end;\n for i:=1 to n do writeln(color[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 839, "cpu_time_ms": 89, "memory_kb": 6400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s503538229", "group_id": "codeNet:p03768", "input_text": "var\n n,m,x,y,i,q,total:longint;\n b,p,d,v,tot,que,first,next,ans,c:array[0..200010]of longint;\n\nprocedure add(x,y:longint);\nbegin\n inc(total);\n next[total]:=first[x];\n first[x]:=total;\n b[total]:=y;\nend;\n\nprocedure bfs(k:longint);\nvar\n head,tail:longint;\n s:longint;\nbegin\n head:=1;\n tail:=1;\n que[1]:=k;\n while head<=tail do begin\n s:=first[que[head]];\n if ans[que[head]]=0 then ans[que[head]]:=c[i];\n if tot[head]>p[que[head]] then begin\n p[que[head]]:=tot[head];\n if tot[head]>0 then begin\n while s<>-1 do begin\n inc(tail);\n tot[tail]:=tot[head]-1;\n que[tail]:=b[s];\n s:=next[s];\n end;\n end;\n end;\n inc(head);\n end;\nend;\n\nbegin\n read(n,m);\n for i:=1 to n*2 do first[i]:=-1;\n for i:=1 to m do begin\n read(x,y);\n add(x,y);\n add(y,x);\n end;\n read(q);\n for i:=1 to q do read(v[i],d[i],c[i]);\n for i:=q downto 1 do begin\n if p[v[i]]>=d[i] then continue;\n if (ans[v[i]]<>0)and(d[i]=0) then continue;\n tot[1]:=d[i];\n bfs(v[i]);\n end;\n for i:=1 to n do writeln(ans[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499730717, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s503538229.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s503538229", "user_id": "u468632936"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "var\n n,m,x,y,i,q,total:longint;\n b,p,d,v,tot,que,first,next,ans,c:array[0..200010]of longint;\n\nprocedure add(x,y:longint);\nbegin\n inc(total);\n next[total]:=first[x];\n first[x]:=total;\n b[total]:=y;\nend;\n\nprocedure bfs(k:longint);\nvar\n head,tail:longint;\n s:longint;\nbegin\n head:=1;\n tail:=1;\n que[1]:=k;\n while head<=tail do begin\n s:=first[que[head]];\n if ans[que[head]]=0 then ans[que[head]]:=c[i];\n if tot[head]>p[que[head]] then begin\n p[que[head]]:=tot[head];\n if tot[head]>0 then begin\n while s<>-1 do begin\n inc(tail);\n tot[tail]:=tot[head]-1;\n que[tail]:=b[s];\n s:=next[s];\n end;\n end;\n end;\n inc(head);\n end;\nend;\n\nbegin\n read(n,m);\n for i:=1 to n*2 do first[i]:=-1;\n for i:=1 to m do begin\n read(x,y);\n add(x,y);\n add(y,x);\n end;\n read(q);\n for i:=1 to q do read(v[i],d[i],c[i]);\n for i:=q downto 1 do begin\n if p[v[i]]>=d[i] then continue;\n if (ans[v[i]]<>0)and(d[i]=0) then continue;\n tot[1]:=d[i];\n bfs(v[i]);\n end;\n for i:=1 to n do writeln(ans[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1250, "cpu_time_ms": 80, "memory_kb": 7168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s860401287", "group_id": "codeNet:p03768", "input_text": "type arr=array[1..200000]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,max,cl,head,next,start,endd:arr;\n bb,bc:array[1..100000]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499703781, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s860401287.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s860401287", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arr=array[1..200000]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,max,cl,head,next,start,endd:arr;\n bb,bc:array[1..100000]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1503, "cpu_time_ms": 93, "memory_kb": 6272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s323473147", "group_id": "codeNet:p03768", "input_text": "type arrb=array[1..100000]of boolean;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl:array[1..100000]of longint;\n lian:array[1..100000,1..5000]of longint;\n bb,bc:arrb;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=1 to l[k] do\n if not bb[lian[k,i]]then dfs(lian[k,i],dis-1,col);\n bb[k]:=false;\nend;\nbegin\n readln(n,m);\n fillchar(l,sizeof(l),0);\n fillchar(cl,sizeof(cl),0);\n fillchar(max,sizeof(max),0);\n fillchar(bb,sizeof(bb),false);\n fillchar(bc,sizeof(bc),false);\n for i:=1 to m do begin\n readln(a,b);\n inc(l[a]);lian[a,l[a]]:=b;\n inc(l[b]);lian[b,l[b]]:=a;\n end;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499701879, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s323473147.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s323473147", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arrb=array[1..100000]of boolean;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl:array[1..100000]of longint;\n lian:array[1..100000,1..5000]of longint;\n bb,bc:arrb;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=1 to l[k] do\n if not bb[lian[k,i]]then dfs(lian[k,i],dis-1,col);\n bb[k]:=false;\nend;\nbegin\n readln(n,m);\n fillchar(l,sizeof(l),0);\n fillchar(cl,sizeof(cl),0);\n fillchar(max,sizeof(max),0);\n fillchar(bb,sizeof(bb),false);\n fillchar(bc,sizeof(bc),false);\n for i:=1 to m do begin\n readln(a,b);\n inc(l[a]);lian[a,l[a]]:=b;\n inc(l[b]);lian[b,l[b]]:=a;\n end;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 955, "cpu_time_ms": 456, "memory_kb": 1954688}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s930600001", "group_id": "codeNet:p03768", "input_text": "type arrb=array[1..100000]of boolean;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl:array[1..100000]of longint;\n lian:array[1..100000,1..1000]of longint;\n bb,bc:arrb;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=1 to l[k] do\n if not bb[lian[k,i]]then dfs(lian[k,i],dis-1,col);\n bb[k]:=false;\nend;\nbegin\n readln(n,m);\n fillchar(l,sizeof(l),0);\n fillchar(cl,sizeof(cl),0);\n fillchar(max,sizeof(max),0);\n fillchar(bb,sizeof(bb),false);\n fillchar(bc,sizeof(bc),false);\n for i:=1 to m do begin\n readln(a,b);\n inc(l[a]);lian[a,l[a]]:=b;\n inc(l[b]);lian[b,l[b]]:=a;\n end;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499701562, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s930600001.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s930600001", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arrb=array[1..100000]of boolean;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl:array[1..100000]of longint;\n lian:array[1..100000,1..1000]of longint;\n bb,bc:arrb;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=1 to l[k] do\n if not bb[lian[k,i]]then dfs(lian[k,i],dis-1,col);\n bb[k]:=false;\nend;\nbegin\n readln(n,m);\n fillchar(l,sizeof(l),0);\n fillchar(cl,sizeof(cl),0);\n fillchar(max,sizeof(max),0);\n fillchar(bb,sizeof(bb),false);\n fillchar(bc,sizeof(bc),false);\n for i:=1 to m do begin\n readln(a,b);\n inc(l[a]);lian[a,l[a]]:=b;\n inc(l[b]);lian[b,l[b]]:=a;\n end;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 955, "cpu_time_ms": 154, "memory_kb": 393600}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s644193208", "group_id": "codeNet:p03775", "input_text": "var n,ans:int64;\n s,i:longint;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n ans:=n div i;\n break;\n end;\n while ans>0 do\n begin\n inc(s);\n ans:=ans div 10;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1580588495, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s644193208.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644193208", "user_id": "u743614777"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,ans:int64;\n s,i:longint;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n ans:=n div i;\n break;\n end;\n while ans>0 do\n begin\n inc(s);\n ans:=ans div 10;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 246, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s431586017", "group_id": "codeNet:p03775", "input_text": "var\n n,m:int64;\n i:longint;\n s:string;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then begin m:=n div i; str(m,s); writeln(length(s)); break; end;\nend.", "language": "Pascal", "metadata": {"date": 1539551626, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s431586017.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s431586017", "user_id": "u723721005"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,m:int64;\n i:longint;\n s:string;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then begin m:=n div i; str(m,s); writeln(length(s)); break; end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s408617529", "group_id": "codeNet:p03775", "input_text": "var\n n:int64;\n i,j,s:longint;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n j:=n div i;\n break;\n end;\n while j>0 do\n begin\n inc(s);\n j:=j div 10;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1538574896, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s408617529.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s408617529", "user_id": "u723721005"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n:int64;\n i,j,s:longint;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n j:=n div i;\n break;\n end;\n while j>0 do\n begin\n inc(s);\n j:=j div 10;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 231, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s036590725", "group_id": "codeNet:p03775", "input_text": "{AT2523}\nvar\nn:int64;\ni:longint;\ns:string;\nbegin\nread(n);\nfor i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n str(n div i,s);\n writeln(length(s));\n halt;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1534814329, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s036590725.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s036590725", "user_id": "u214724132"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "{AT2523}\nvar\nn:int64;\ni:longint;\ns:string;\nbegin\nread(n);\nfor i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n str(n div i,s);\n writeln(length(s));\n halt;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 173, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s873463974", "group_id": "codeNet:p03782", "input_text": "var\n\tdp1:array[0..5000]of Boolean;\n\tdp2:array[0..5000,0..5000]of Longint;\n\tsum:array[0..5001]of Longint;\n\tn,k,i,j,id,cnt:Longint;\n\tflag:Boolean;\n\ta:array[1..5000]of Longint;\nbegin\n\tread(n,k);\n\tfor i:=1 to n do read(a[i]);\n\tdp2[n][0]:=1;\n\tfor i:=n downto 1 do begin\n\t\tfor j:=0 to k do dp2[i-1][j]:=dp2[i][j];\n\t\tfor j:=0 to k-a[i] do if dp2[i][j]=1 then dp2[i-1][j+a[i]]:=1;\n\tend;\n\tdp1[0]:=true;\n\tfor i:=1 to n do begin\n\t\tsum[0]:=0;\n\t\tfor j:=0 to k do sum[j+1]:=sum[j]+dp2[i][j];\n\t\tflag:=false;\n\t\tfor j:=0 to k do if dp1[j]then begin\n\t\t\tid:=k-a[i]-j;\n\t\t\tif id<0 then id:=0;\n\t\t\tif sum[k-j]-sum[id]>0 then begin\n\t\t\t\tflag:=true;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then inc(cnt);\n\t\tfor j:=k downto a[i] do dp1[j]:=dp1[j]or dp1[j-a[i]];\n\tend;\n\twriteln(cnt);\nend.\n", "language": "Pascal", "metadata": {"date": 1539173338, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03782.html", "problem_id": "p03782", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03782/input.txt", "sample_output_relpath": "derived/input_output/data/p03782/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03782/Pascal/s873463974.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s873463974", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tdp1:array[0..5000]of Boolean;\n\tdp2:array[0..5000,0..5000]of Longint;\n\tsum:array[0..5001]of Longint;\n\tn,k,i,j,id,cnt:Longint;\n\tflag:Boolean;\n\ta:array[1..5000]of Longint;\nbegin\n\tread(n,k);\n\tfor i:=1 to n do read(a[i]);\n\tdp2[n][0]:=1;\n\tfor i:=n downto 1 do begin\n\t\tfor j:=0 to k do dp2[i-1][j]:=dp2[i][j];\n\t\tfor j:=0 to k-a[i] do if dp2[i][j]=1 then dp2[i-1][j+a[i]]:=1;\n\tend;\n\tdp1[0]:=true;\n\tfor i:=1 to n do begin\n\t\tsum[0]:=0;\n\t\tfor j:=0 to k do sum[j+1]:=sum[j]+dp2[i][j];\n\t\tflag:=false;\n\t\tfor j:=0 to k do if dp1[j]then begin\n\t\t\tid:=k-a[i]-j;\n\t\t\tif id<0 then id:=0;\n\t\t\tif sum[k-j]-sum[id]>0 then begin\n\t\t\t\tflag:=true;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then inc(cnt);\n\t\tfor j:=k downto a[i] do dp1[j]:=dp1[j]or dp1[j-a[i]];\n\tend;\n\twriteln(cnt);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "sample_input": "3 6\n1 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03782", "source_text": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 761, "cpu_time_ms": 345, "memory_kb": 97792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s184483915", "group_id": "codeNet:p03786", "input_text": "program j01;\nvar a,sum:array[0..100086]of int64;\n n,i:longint;\n\nprocedure qsort(l,r:longint);\nvar i,j,x,y:int64;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while a[i]j;\n if i=a[n]) then writeln(n) else writeln(n-i);\nend.", "language": "Pascal", "metadata": {"date": 1489368851, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03786.html", "problem_id": "p03786", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03786/input.txt", "sample_output_relpath": "derived/input_output/data/p03786/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03786/Pascal/s184483915.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s184483915", "user_id": "u550756195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program j01;\nvar a,sum:array[0..100086]of int64;\n n,i:longint;\n\nprocedure qsort(l,r:longint);\nvar i,j,x,y:int64;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while a[i]j;\n if i=a[n]) then writeln(n) else writeln(n-i);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke found N strange creatures.\nEach creature has a fixed color and size. The color and size of the i-th creature are represented by i and A_i, respectively.\n\nEvery creature can absorb another creature whose size is at most twice the size of itself.\nWhen a creature of size A and color B absorbs another creature of size C and color D (C \\leq 2 \\times A), they will merge into one creature of size A+C and color B.\nHere, depending on the sizes of two creatures, it is possible that both of them can absorb the other.\n\nSnuke has been watching these creatures merge over and over and ultimately become one creature.\nFind the number of the possible colors of this creature.\n\nConstraints\n\n2 \\leq N \\leq 100000\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nPrint the number of the possible colors of the last remaining creature after the N creatures repeatedly merge and ultimately become one creature.\n\nSample Input 1\n\n3\n3 1 4\n\nSample Output 1\n\n2\n\nThe possible colors of the last remaining creature are colors 1 and 3.\nFor example, when the creature of color 3 absorbs the creature of color 2, then the creature of color 1 absorbs the creature of color 3, the color of the last remaining creature will be color 1.\n\nSample Input 2\n\n5\n1 1 1 1 1\n\nSample Output 2\n\n5\n\nThere may be multiple creatures of the same size.\n\nSample Input 3\n\n6\n40 1 30 2 7 20\n\nSample Output 3\n\n4", "sample_input": "3\n3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03786", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke found N strange creatures.\nEach creature has a fixed color and size. The color and size of the i-th creature are represented by i and A_i, respectively.\n\nEvery creature can absorb another creature whose size is at most twice the size of itself.\nWhen a creature of size A and color B absorbs another creature of size C and color D (C \\leq 2 \\times A), they will merge into one creature of size A+C and color B.\nHere, depending on the sizes of two creatures, it is possible that both of them can absorb the other.\n\nSnuke has been watching these creatures merge over and over and ultimately become one creature.\nFind the number of the possible colors of this creature.\n\nConstraints\n\n2 \\leq N \\leq 100000\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nPrint the number of the possible colors of the last remaining creature after the N creatures repeatedly merge and ultimately become one creature.\n\nSample Input 1\n\n3\n3 1 4\n\nSample Output 1\n\n2\n\nThe possible colors of the last remaining creature are colors 1 and 3.\nFor example, when the creature of color 3 absorbs the creature of color 2, then the creature of color 1 absorbs the creature of color 3, the color of the last remaining creature will be color 1.\n\nSample Input 2\n\n5\n1 1 1 1 1\n\nSample Output 2\n\n5\n\nThere may be multiple creatures of the same size.\n\nSample Input 3\n\n6\n40 1 30 2 7 20\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 616, "cpu_time_ms": 24, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s764051636", "group_id": "codeNet:p03796", "input_text": "var\n n,i,s:longint;\nbegin\n readln(n);\n s:=1;\n for i:=1 to n do\n begin\n s:=s*i;\n s:=s mod 1000000007;\n end;\n write(s);\nend.", "language": "Pascal", "metadata": {"date": 1580668715, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03796.html", "problem_id": "p03796", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03796/input.txt", "sample_output_relpath": "derived/input_output/data/p03796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03796/Pascal/s764051636.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s764051636", "user_id": "u723721005"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n n,i,s:longint;\nbegin\n readln(n);\n s:=1;\n for i:=1 to n do\n begin\n s:=s*i;\n s:=s mod 1000000007;\n end;\n write(s);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03796", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 128, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s794195957", "group_id": "codeNet:p03796", "input_text": "const js:array[0..5000]of longint=(1,48282571,85018218,608209706,100113432,169466058,704909939,727978586,815498688,340143996,164112089,907909364,931729941,306074251,898261456,129542707,971144241,236989405,754874400,280190822,483156199,542154235,871518173,62285128,372909378,307058638,998079747,376672519,913088303,675965676,688647461,41434123,750147110,466902215,819785944,999742733,138631388,460737148,139086503,797822079,228824085,329122419,572393076,143168899,771324102,954757381,190231791,58747640,978539490,305803987,95569611,996014970,527091913,109549012,162001842,133665506,58320353,637043892,424500564,632686688,309445193,214543261,213261601,832962386,817480494,756704926,69104544,428399312,936412106,835312860,26823131,207282278,305850593,668960545,738933305,396571283,822202086,719999837,598565094,9379872,819041090,929426699,2241723,92819711,477925950,668967079,443050596,701647868,117000509,814473779,61736181,573227332,169579974,118746174,460159882,10412767,807527919,176746763,312953980,433545709,865674075,211798050,651698240,96760674,556448436,569684351,786893972,243307017,54599279,506089135,139246482,534834372,207345977,641728687,967394652,884651254,152402741,130397096,32220687,816100565,289391112,733522350,936368740,472375329,265186708,781513186,506969688,830410175,364371943,928822918,600576274,805403162,165878959,528683244,134293992,578804200,674974647,616820052,399156704,542388361,199662135,939887615,515652878,755902245,48867657,365668266,367434024,628201081,807663513,415324433,986433875,995159020,259394544,295631361,432652737,407465965,297535374,279326810,218437145,399941841,968609657,517008131,657468327,84399348,862906218,707916071,791888781,439356928,113037504,797740359,90174576,576809857,568669945,591258991,279786258,601889329,638181539,244700748,658768517,832605925,875522180,627864323,431037411,463205669,107726967,712412963,136427322,116578178,597385300,655899199,310873995,647935500,693858641,170400646,136304532,344637513,569586759,875695511,966169382,718825342,616964754,950756496,827748627,481203729,928594957,937653059,614250662,419226342,652443066,90139822,726417621,874970796,538174881,628047345,987244016,57235327,916148979,371877313,481614924,50836654,613059849,211409364,240717753,901178399,276109642,10432206,605079516,570686298,427088708,687749674,180435040,982797996,969255897,754405774,742308070,162324891,49188669,243630008,491651778,561387885,741665090,870082597,932152586,549075673,470433326,773800395,322706792,374609057,988566995,105165925,390832290,531147514,769221867,248302008,167595951,271594025,487837166,995884721,321717561,434888572,20689194,292555136,314744379,98672728,43458026,943001446,182688361,626960167,639655560,562152683,943801301,789540103,147036896,615191984,212855869,994482434,562616956,270056834,712478107,588940377,81013035,553493126,644958445,882799312,119195245,689013336,929946684,866736596,615834315,515756999,236377561,51007455,650960372,121897393,488147141,498517813,481423615,765875630,938255541,92205661,164121892,471845330,487698674,137419238,368517997,796689169,564646606,963312343,309300907,783100868,339732605,240952681,253872283,77007986,942192030,902431724,109790650,276173721,71106818,41565739,264686444,527843517,102039972,925991005,532562501,247432452,866838344,753959940,131471414,109987391,885674343,766075224,559222371,73801188,400902978,222690803,40553872,900156769,679825413,636492574,460659340,335977444,580049492,583575412,637397977,776362520,456794090,481003012,709123473,693173994,456973011,223936121,588370062,492914038,934938271,968739694,569356366,70636675,217230886,251135328,41281430,536056295,234647112,240235811,32446216,418042748,779012511,932378892,509799863,734527888,599336038,618072433,924695537,759174277,423135189,702077613,714767144,296905764,606587928,981246566,179234278,833557087,875898827,687249390,62436887,328327195,482234558,166395229,437001029,12682734,580910126,869366609,890816013,887047925,298612697,406955880,939818429,394356716,706736983,533344188,193238332,885944924,869069330,1551055,241285992,518001116,9367868,429609907,232960552,871285323,712716710,563889589,978810890,265859727,235941793,318653980,51666617,356144550,336618926,914525198,740453935,112955355,905231915,369832201,488064177,820207382,975992497,812385532,828411253,910862618,734382178,491901128,736600012,460875457,359423053,15166631,866186305,597449850,106647565,454195764,812110934,223708246,266024367,77244150,523813865,454164263,832455292,255838084,170960622,921167494,496332543,890986905,804354873,64488468,183966706,769493456,315880727,91421716,887866920,755483214,1260415,676723634,908457511,52428744,134172210,95854044,641181705,857905589,812952563,222611214,14804494,589457690,633028524,329260344,254845189,344481535,761399715,466055676,697904602,3516171,192426671,640027923,755538657,544001940,683821071,712521033,334769644,374093474,968979008,787317645,866960421,868938731,3808942,884841460,567291274,191845083,368427091,84455280,716743858,450303368,670492106,683759123,464398584,440142720,787909565,203315269,111030585,339783919,108991476,541952932,959674815,68487426,326695824,645967941,767487775,310792483,186077091,805454778,408754104,876815387,428859242,13410818,96435869,70041441,586589530,455503567,740457166,381695306,198806676,936176462,296295273,899863099,153923089,326890868,788937970,324478844,815949851,205970090,264768811,736798084,557721478,412329172,4613770,882037129,282926133,964752942,319008197,539814817,326288066,687735195,294479223,491889511,836420752,125889639,349116222,642619299,448745169,948014287,649547796,31250428,522335325,8998865,997100496,491896657,307666191,400265961,985605053,909175130,882809666,987353128,534335272,788476699,543419219,650442446,851749115,558903967,133795542,320195938,486846292,766728624,811311468,68844024,951894658,669134235,634518285,556122072,409663442,922136934,469181596,632512175,628577181,500778048,640161648,785644583,846117388,539634193,430765692,434924431,35058378,725119031,666561984,916259498,700629222,342577060,457447194,279057163,633995541,926015993,288489736,677677303,442639950,111313198,963310151,33411949,14060804,426718195,63097456,344690472,299398156,446239781,573129887,626532710,158994980,705544615,550989273,306234219,733158979,672035282,461090791,596460950,535594242,880661839,247169066,424775306,849386605,568062224,394127317,395640256,936674847,344509461,910080579,165483659,899287914,18492363,288363591,682383027,477256956,232299946,998547226,772096186,480153738,855361887,37858629,627038072,712376923,888355856,647422056,552603283,876027605,491846111,270110282,363130815,635737203,148017848,10628285,120682620,458948154,849486151,452794103,427851209,719450896,546097548,648686202,915035791,508412820,544709260,382320910,656285170,503691047,729699454,517878946,869054975,827014861,413215356,15899881,613845693,235001078,612699672,23937851,691060563,986248845,443159996,487278611,893911228,884467088,882940415,999582982,793399725,624244170,352534851,485121643,39028309,169007218,964239210,546528674,142199312,930805764,829851852,460920612,681884166,334656408,714611383,858794172,525920855,549692526,308415013,386093634,906737045,964750741,532682221,429414794,997098870,80200252,805487256,424269271,557855866,531245581,798018572,403484763,43371915,621835798,856681317,182456430,261631167,500477023,978372471,376489065,678685168,190602713,746631813,997082586,781149116,893397068,313437023,71879692,610637287,275830804,293061003,528446850,364552041,327484591,543758079,281890806,552110821,870367747,10719905,752407113,169219373,475461970,775489245,121614261,736099678,785628751,329211538,624999353,785680489,304497334,189960149,927605448,691496070,537035413,405122339,150200230,218629,705530339,242382263,951628293,988414282,306867360,140169854,665347884,135423546,74483855,88582424,941671321,681327030,364822623,12788649,89821471,755254635,351846814,297173017,670877108,169850124,735485963,613812878,674486205,422707130,771047016,665247390,154956805,4097708,866079414,257804884,167933867,139067329,446562337,479445371,745844619,195696002,230901560,496117579,931358729,379176295,758495825,158093679,712938411,122503788,853017941,652834192,867807987,515143556,370022528,777221383,992100465,302010105,206692292,850038879,369203656,861834784,641633876,77516287,361055440,309007001,656810219,536782890,427023200,703082910,100799472,138251465,526161981,854937102,519993591,859826031,857473634,145930913,221098568,641151881,783996845,195826216,727312055,837510025,883803952,658498041,884555009,587685092,201634891,142101344,365449743,605430454,930970640,112080263,509410062,164295560,490144805,620803478,820536329,278465952,825754907,363263067,991902187,823253841,416286040,307645795,222226907,903582326,759471380,793733723,569493152,20873181,438285734,497513629,426109249,467268896,722492904,58474867,107212797,117359107,697742908,898790424,34891822,150388973,577450721,709363018,472735892,309245981,973388837,835670800,961183535,438555122,787084865,690309853,967196744,768140952,944158584,516779478,970947613,336982183,921235469,182198503,346059186,277053641,562817030,674222522,29459277,26429091,738447017,795313409,729032653,553200652,584530199,973132855,740724816,220193968,648800376,967684296,890451843,411127145,615189046,557376843,184208464,426509243,737238222,143275994,492085842,453970031,480225780,951609625,457699820,391080577,994326117,733058957,56439962,222269287,720955844,138728942,937728481,731082005,928929549,570093956,727072843,386718788,192469842,166341312,804185595,526332649,482424308,831409262,552325157,427499278,757745721,835425311,855369831,3706649,87146431,334485790,872557428,461462208,579756911,886607412,861957051,149845399,512136680,120471307,558215387,13257470,469049893,748481936,752195903,572519593,358015373,936201402,944052422,839052219,951046313,894822383,13809673,744504302,92805030,515324851,276080987,410591942,178582489,419671982,612655745,847077098,600927558,807178909,541476675,262869355,655354990,596158986,376333993,790135084,399880535,815445114,195106074,84782725,710349280,192899302,340376022,972617405,190943995,10823756,740170124,729351268,227541296,170138313,918482230,563860013,782161802,309928741,12806875,757497299,178268423,734649068,770326628,147369859,933634961,565544024,656076180,96058143,519672424,520470351,207368903,43418716,91837745,418943118,752652751,165007170,776068379,870931886,393706865,691360789,673767461,313993065,82663532,725712143,493073937,753333826,130783553,334833620,953881386,211054431,843446330,631762599,85861549,394360929,78558378,392013377,909353351,88605845,609975225,650855484,21963018,62279245,29998316,390030954,853624314,785268747,843084214,930078724,277516346,941363236,104716276,605123384,753677651,755889475,127485450,35820768,600298696,340479995,654900987,718245038,26081410,588191864,776876108,472652880,881070051,552959798,414446777,833348330,648018624,657592074,676619110,523738298,538376389,584284056,157482456,855624101,280445219,203276538,807909037,582272972,815426220,64145612,662454632,5701130,981244790,303167447,666103987,211310381,608817650,814992705,984169790,219480079,4512468,88716782,572102777,400915884,668740121,648109523,694617738,388631480,944887858,419563338,347762074,744757797,92272940,778380809,292368887,35811433,426317381,939326768,406609420,335014160,108842088,712421032,189374814,63787656,767405957,943486727,519127916,793279533,263225838,795708957,896663432,832848944,863383997,255103548,581672668,571719221,633481956,775385508,532857017,654653319,794922857,946409249,793028160,595855855,470516558,284195181,144878682,906511529,765248036,32753906,100956752,434971325,694641015,974905830,550903787,230441073,964505711,115225513,685788882,222609433,463024073,385292346,41890053,238421760,873582853,998562166,97965461,476977489,817940866,781675883,985976788,599373101,727670793,338871599,38984578,196840419,465393721,122706197,448727489,304315853,175822409,818255570,662596026,747096226,196007431,980317155,182603742,688754178,556897770,412089924,184130442,194472445,345456849,380341705,639878187,96592120,348821478,834022239,530955855,851899367,703731709,185737110,935307660,166154530,905337111,657930689,464180234,981971367,443753845,979325814,296608244,454447022,648485718,861431582,204901283,373970691,386447540,81909233,948822378,571142387,819956869,708005961,602497871,982148105,515504647,153150575,240879666,216015116,544442175,131256298,913437394,63778350,872951102,379118158,730940661,723724509,945517031,991560405,270805396,78445999,179078009,29249610,826823852,54059229,727002509,678747076,512511824,323506160,744236090,149158715,300231113,651306547,477233614,910589884,13388187,362722375,844699215,824505449,64526395,66620460,738215818,208416459,191709936,279972198,239284324,93737016,470354733,807994114,568275410,918541833,339950537,833383893,467410763,750219079,400816048,943548457,333032754,266769965,140669881,658191424,639513,137755912,305317847,150761397,414331392,709491108,584262204,997535992,281934746,936908697,148461782,256234804,786679183,562670099,590787278,710177221,440039911,207339699,343244673,502751326,369707355,226713690,358186625,130082330,404094304,979648672,332893952,813883107,535783736,793639796,905799464,265221814,732966207,649976889,744490348,59749564,79845027,455930738,805090778,175770523,374112951,394831060,247778846,124422680,358416463,400874380,936429484,418626778,860419522,99946534,841080092,304751520,6430494,32910197,687344691,894169516,263353206,306691429,13866244,395605543,772634051,387431514,530244548,516043041,490547100,728963691,316696479,287173557,279599895,650164841,814475608,99106148,420158172,639195432,760492722,732830573,780077822,887121466,465360318,922767133,293732951,386314710,626940455,40371792,673547887,892108952,203447236,539957951,52466822,594406779,936422594,779409101,628661891,410025332,707614490,543380998,811900716,48182919,882454611,762700732,10060456,227264963,466698618,415529624,923106647,118147922,556684753,162450904,484861515,472243587,417233174,876650046,191048316,383910998,649569453,510481612,950253003,842521672,764810784,104232772,58253341,130246780,277151092,853096969,122266693,562258894,756520244,505753533,131849002,306283398,461218335,182081805,640042214,844891889,79604455,669916934,391532044,324004907,316636024,697406258,78039697,62968876,807482442,582529836,654903492,645929437,899904170,778779290,745708257,885460937,248942795,915545919,954930349,853377354,703531737,705014437,346272675,690789405,184836726,697806503,478533743,532637281,407127984,996934825,346686042,548135160,765942400,933657016,193044592,437134842,70465577,368879691,203286011,400628145,969402144,87233108,53586076,351901593,861801971,965590935,157777546,576237903,865664494,687258845,47733438,418084812,281701037,738557295,779053933,304568296,532114164,412173364,320897149,863489134,373305422,633552785,889812890,168503336,434627838,211242191,927851579,614936003,16569617,699206926,736507685,397035158,903211757,440705427,715617560,612372394,229567681,266661262,435522292,200176528,84928269,195574671,966586370,523014139,195166660,540799747,440222895,89764275,427291076,747192999,428681577,231514074,551539517,850110981,535685004,119680018,90501935,873430866,26236466,44084025,320357343,707828720,963059910,940281847,563722697,895217040,184272120,668843999,663595238,75996223,871355856,472306161,981409109,60703902,75486282,696747403,731490959,982051833,171394898,911710305,775942676,202597561,589191850,795327523,677934945,12617918,137108358,935199280,518220977,116587977,682683443,147836368,279931006,685488923,68815628,64071148,249111,273037997,908067814,322921229,422762728,227090135,749963904,568727681,806780476,899067831,854604941,410663181,173024913,876391214,555253141,374034278,341294995,418295052,544429064,401636797,926482153,223764400,348047352,4170610,903219819,143084772,342172787,616120027,27246776,879816941,452679550,558138102,130315754,219311447,10920181,781366606,418626593,50442742,530080840,536122388,99827770,635120330,524787685,108069911,326808157,685496753,651715091,465802418,586477250,34520847,248028557,384951719,241662121,61499161,258971783,172528295,202694969,637100374,202977144,140446730,353128622,215890965,96378092,57479914,818866544,497369638,33877403,640174285,796387998,686331280,705462639,142382808,566570797,589164945,288064839,385891484,956282930,256213029,626100151,697642496,599419006,142968621,332527576,642416477,901938758,414825769,144458027,196686319,306753424,880043016,792590727,263886450,814382072,509410448,40946171,108789533,875617498,756117032,59410,579152769,129267799,633423653,540794375,18462841,676577261,676017628,759266870,748182244,652434838,482076487,654157008,241722179,998113460,252492854,127322674,922111837,565015483,48227657,831613942,813727126,751320855,44295213,404554381,658682340,837874630,570486079,798694531,91541826,321826660,637576159,962544045,714023960,417018084,758335330,597956836,946147586,659013117,315899389,142601427,739010552,202009838,352624425,244916106,795161135,820367416,934789385,9689997,662283914,22890821,961269481,627630211,697840384,778754063,726293481,164039247,998516010,871672945,693352845,396835953,623179072,220902433,173369628,205616506,84809875,316411189,413390416,365382768,834238444,227018509,606790023,34734777,772382567,45774996,218255237,488498583,402901334,601452090,815468661,378119229,93399250,988321123,246628596,15358458,168829272,131157961,789962973,726530351,143389167,620080452,780182658,328208438,580344546,992798006,593436769,378585282,722485795,137959762,936163856,586587294,313451290,233013869,362301382,589999977,219546432,439633737,572908493,94618738,892856994,208794479,625046548,748757220,597509297,380918127,214012165,717753869,771813783,457416299,671746683,33532876,795824027,195903442,551461402,342423035,431189067,518716085,696521992,560176572,630965323,557416202,323509010,173224789,828724729,968140304,988964940,316173144,341504264,277776038,36386466,688232181,907501394,970641914,582585429,41499562,428262935,873814102,894965584,70031653,34608458,758650174,819003233,97675208,310457053,556931799,431435024,148274527,954015047,931035697,220246718,78348924,193773201,726556759,193601577,212555541,224399717,649163719,331830856,226979171,47387453,766293175,766864502,32326195,857668845,288084612,675487924,241875121,303629562,311049618,33939433,92842842,147727423,932581866,582294529,30247220,598677509,818518519,530461868,462030436,107537726,717701973,459407340,713486367,787323230,427149321,275759208,156070354,715543532,218504709,288177102,778659746,568125939,281127120,285482612,523912088,612484386,902593481,775066724,767173324,127630042,12632132,848390954,645505424,537766523,171564214,539521790,933042297,22847005,420148141,292784844,618159945,649409140,37848281,596772455,707286944,905971364,953390666,214613322,149419222,697477148,667033594,847009175,272913955,705901835,482318500,638704381,530378109,5643697,88522112,127178085,903771790,635411197,413881100,983778581,599501600,879394954,216144911,770087630,53708332,945232410,868933334,574994607,763651799,503202781,741181251,714808605,500554412,629435502,638061456,352591847,31843999,262305525,575865729,293804357,640198163,960488618,925794515,918424438,513038978,486204399,281767509,262799861,512517514,959125582,956090313,30823940,793756933,893174553,426286107,325926555,944403455,932055930,882316068,288647913,463611349,56074973,931336344,657923637,727391524,765937094,73383914,392603595,16642143,393967842,82030124,827796830,577732842,782637746,177555370,188314883,102809457,58457044,940072204,891807819,860497662,293942862,158428699,128707222,932026400,826978343,934583262,611199426,928759087,429957844,636263547,647176360,356851584,469700120,201935331,881124336,498262193,401818531,181724018,259842609,313425780,425986162,8071027,400799612,139461628,1547408,563014948,173512404,108526969,504340148,561559398,69850654,268426467,190039260,465924314,691014363,590432325,696811224,238191256,411880615,10733612,75814368,718358205,707088249,432258153,419894988,430369216,451988501,623547572,316613921,186894572,262942596,906475376,846936278,118522161,74411275,132630645,960286714,72870746,833102870,501691613,539149565,100276581,268789611,439529842,576930883,933143763,111058449,685475841,119449191,636963376,808834338,284063565,967980332,922483776,37037270,52955681,247622649,606701577,783700136,438473902,95970436,644151384,323931349,717079757,730425839,14459255,131884509,649752449,404358217,846888563,612684669,925097512,135496193,121027198,296970540,487925012,280211918,516799799,896944677,919664120,492289865,392518599,630073771,415972100,985805886,32499738,973754440,341740497,473306909,425772299,302237892,364631001,729564318,709053902,887924885,824818816,375676387,435581480,693020242,945849226,247289016,595902817,717070280,207934656,318412495,316122695,277266809,436980718,153636661,940214786,637785865,930802821,390845195,770140801,479178730,662209078,232708202,515128158,552815956,606841481,518891821,550053460,307640384,616986593,92000395,47290518,531144248,902052679,808081917,168021011,122596137,228835771,293376006,376364912,293153993,446268515,542667386,680896947,49284078,760638209,163882924,707794270,649533853,402578028,721161955,300613572,639073498,196935262,317293353,148764572,956629016,256155409,193971176,537079947,770502024,944729817,660244220,222206232,123028288,529241381,823756261,32568715,68595097,335385241,51120203,781489474,943029213,458273788,803061824,778143854,200069810,674878570,922802457,42979240,297311374,91104634,799554447,599504154,243605288,965783966,996900904,309141519,327382373,94367741,560262254,730402636,446291524,961305147,708180791,789351858,987692797,931408751,751497020,761571783,70072264,435104379,935989642,494922960,225443021,920409488,732168291,85506148,820453413,779670112,851355023,659912223,35839007,829404081,465123272,627466966,899391085,77908645,266282639,90149912,149404370,365309816,432192216,675345148,763339193,888094729,891394029,58760808,241121364,456088283,497066229,841914057,962324749,886259141,63129295,567249017,265344789,632563407,285786420,430619629,269071972,260403479,11689849,661107541,104156141,123148731,539656122,596969721,983085131,613155479,638837437,186907871,310123900,278242086,891604317,807035658,501077169,990826558,471583663,198533053,988850304,240558020,568701395,110722754,58026856,964103431,524610656,803655069,6674318,492955750,2561039,209923837,487943222,57126567,268241809,615992754,731855482,319369835,160757637,128684388,181705605,644760544,274864727,144846144,305756258,451923039,716710241,332770924,943596793,917783239,624715790,449624888,896508748,186048445,745256677,880762491,731606582,590628196,441697875,209303777,945912308,856208668,522083215,92419648,395583585,12287870,411448830,319681767,279205673,42238937,81900509,408074677,624225165,64898309,898963698,588468423,518527602,565345039,406301427,362655560,661030923,159146529,369617045,680068439,861789147,592688027,882511526,376463549,222555938,636789593,118533438,664315072,510317286,360803671,246897856,133952986,181015672,712301235,632324047,183999617,117652986,995819068,30740678,379459416,978705529,480608964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);\n t=maxlongint div 5000;\nvar n,i:longint;s:qword;\nbegin\n readln(n);\n s:=js[n div t];\n for i:=n div t*t+1 to n do\n s:=(s*i) mod 1000000007;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1580589941, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03796.html", "problem_id": "p03796", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03796/input.txt", "sample_output_relpath": "derived/input_output/data/p03796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03796/Pascal/s794195957.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s794195957", "user_id": "u743614777"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "const js:array[0..5000]of longint=(1,48282571,85018218,608209706,100113432,169466058,704909939,727978586,815498688,340143996,164112089,907909364,931729941,306074251,898261456,129542707,971144241,236989405,754874400,280190822,483156199,542154235,871518173,62285128,372909378,307058638,998079747,376672519,913088303,675965676,688647461,41434123,750147110,466902215,819785944,999742733,138631388,460737148,139086503,797822079,228824085,329122419,572393076,143168899,771324102,954757381,190231791,58747640,978539490,305803987,95569611,996014970,527091913,109549012,162001842,133665506,58320353,637043892,424500564,632686688,309445193,214543261,213261601,832962386,817480494,756704926,69104544,428399312,936412106,835312860,26823131,207282278,305850593,668960545,738933305,396571283,822202086,719999837,598565094,9379872,819041090,929426699,2241723,92819711,477925950,668967079,443050596,701647868,117000509,814473779,61736181,573227332,169579974,118746174,460159882,10412767,807527919,176746763,312953980,433545709,865674075,211798050,651698240,96760674,556448436,569684351,786893972,243307017,54599279,506089135,139246482,534834372,207345977,641728687,967394652,884651254,152402741,130397096,32220687,816100565,289391112,733522350,936368740,472375329,265186708,781513186,506969688,830410175,364371943,928822918,600576274,805403162,165878959,528683244,134293992,578804200,674974647,616820052,399156704,542388361,199662135,939887615,515652878,755902245,48867657,365668266,367434024,628201081,807663513,415324433,986433875,995159020,259394544,295631361,432652737,407465965,297535374,279326810,218437145,399941841,968609657,517008131,657468327,84399348,862906218,707916071,791888781,439356928,113037504,797740359,90174576,576809857,568669945,591258991,279786258,601889329,638181539,244700748,658768517,832605925,875522180,627864323,431037411,463205669,107726967,712412963,136427322,116578178,597385300,655899199,310873995,647935500,693858641,170400646,136304532,344637513,569586759,875695511,966169382,718825342,616964754,950756496,827748627,481203729,928594957,937653059,614250662,419226342,652443066,90139822,726417621,874970796,538174881,628047345,987244016,57235327,916148979,371877313,481614924,50836654,613059849,211409364,240717753,901178399,276109642,10432206,605079516,570686298,427088708,687749674,180435040,982797996,969255897,754405774,742308070,162324891,49188669,243630008,491651778,561387885,741665090,870082597,932152586,549075673,470433326,773800395,322706792,374609057,988566995,105165925,390832290,531147514,769221867,248302008,167595951,271594025,487837166,995884721,321717561,434888572,20689194,292555136,314744379,98672728,43458026,943001446,182688361,626960167,639655560,562152683,943801301,789540103,147036896,615191984,212855869,994482434,562616956,270056834,712478107,588940377,81013035,553493126,644958445,882799312,119195245,689013336,929946684,866736596,615834315,515756999,236377561,51007455,650960372,121897393,488147141,498517813,481423615,765875630,938255541,92205661,164121892,471845330,487698674,137419238,368517997,796689169,564646606,963312343,309300907,783100868,339732605,240952681,253872283,77007986,942192030,902431724,109790650,276173721,71106818,41565739,264686444,527843517,102039972,925991005,532562501,247432452,866838344,753959940,131471414,109987391,885674343,766075224,559222371,73801188,400902978,222690803,40553872,900156769,679825413,636492574,460659340,335977444,580049492,583575412,637397977,776362520,456794090,481003012,709123473,693173994,456973011,223936121,588370062,492914038,934938271,968739694,569356366,70636675,217230886,251135328,41281430,536056295,234647112,240235811,32446216,418042748,779012511,932378892,509799863,734527888,599336038,618072433,924695537,759174277,423135189,702077613,714767144,296905764,606587928,981246566,179234278,833557087,875898827,687249390,62436887,328327195,482234558,166395229,437001029,12682734,580910126,869366609,890816013,887047925,298612697,406955880,939818429,394356716,706736983,533344188,193238332,885944924,869069330,1551055,241285992,518001116,9367868,429609907,232960552,871285323,712716710,563889589,978810890,265859727,235941793,318653980,51666617,356144550,336618926,914525198,740453935,112955355,905231915,369832201,488064177,820207382,975992497,812385532,828411253,910862618,734382178,491901128,736600012,460875457,359423053,15166631,866186305,597449850,106647565,454195764,812110934,223708246,266024367,77244150,523813865,454164263,832455292,255838084,170960622,921167494,496332543,890986905,804354873,64488468,183966706,769493456,315880727,91421716,887866920,755483214,1260415,676723634,908457511,52428744,134172210,95854044,641181705,857905589,812952563,222611214,14804494,589457690,633028524,329260344,254845189,344481535,761399715,466055676,697904602,3516171,192426671,640027923,755538657,544001940,683821071,712521033,334769644,374093474,968979008,787317645,866960421,868938731,3808942,884841460,567291274,191845083,368427091,84455280,716743858,450303368,670492106,683759123,464398584,440142720,787909565,203315269,111030585,339783919,108991476,541952932,959674815,68487426,326695824,645967941,767487775,310792483,186077091,805454778,408754104,876815387,428859242,13410818,96435869,70041441,586589530,455503567,740457166,381695306,198806676,936176462,296295273,899863099,153923089,326890868,788937970,324478844,815949851,205970090,264768811,736798084,557721478,412329172,4613770,882037129,282926133,964752942,319008197,539814817,326288066,687735195,294479223,491889511,836420752,125889639,349116222,642619299,448745169,948014287,649547796,31250428,522335325,8998865,997100496,491896657,307666191,400265961,985605053,909175130,882809666,987353128,534335272,788476699,543419219,650442446,851749115,558903967,133795542,320195938,486846292,766728624,811311468,68844024,951894658,669134235,634518285,556122072,409663442,922136934,469181596,632512175,628577181,500778048,640161648,785644583,846117388,539634193,430765692,434924431,35058378,725119031,666561984,916259498,700629222,342577060,457447194,279057163,633995541,926015993,288489736,677677303,442639950,111313198,963310151,33411949,14060804,426718195,63097456,344690472,299398156,446239781,573129887,626532710,158994980,705544615,550989273,306234219,733158979,672035282,461090791,596460950,535594242,880661839,247169066,424775306,849386605,568062224,394127317,395640256,936674847,344509461,910080579,165483659,899287914,18492363,288363591,682383027,477256956,232299946,998547226,772096186,480153738,855361887,37858629,627038072,712376923,888355856,647422056,552603283,876027605,491846111,270110282,363130815,635737203,148017848,10628285,120682620,458948154,849486151,452794103,427851209,719450896,546097548,648686202,915035791,508412820,544709260,382320910,656285170,503691047,729699454,517878946,869054975,827014861,413215356,15899881,613845693,235001078,612699672,23937851,691060563,986248845,443159996,487278611,893911228,884467088,882940415,999582982,793399725,624244170,352534851,485121643,39028309,169007218,964239210,546528674,142199312,930805764,829851852,460920612,681884166,334656408,714611383,858794172,525920855,549692526,308415013,386093634,906737045,964750741,532682221,429414794,997098870,80200252,805487256,424269271,557855866,531245581,798018572,403484763,43371915,621835798,856681317,182456430,261631167,500477023,978372471,376489065,678685168,190602713,746631813,997082586,781149116,893397068,313437023,71879692,610637287,275830804,293061003,528446850,364552041,327484591,543758079,281890806,552110821,870367747,10719905,752407113,169219373,475461970,775489245,121614261,736099678,785628751,329211538,624999353,785680489,304497334,189960149,927605448,691496070,537035413,405122339,150200230,218629,705530339,242382263,951628293,988414282,306867360,140169854,665347884,135423546,74483855,88582424,941671321,681327030,364822623,12788649,89821471,755254635,351846814,297173017,670877108,169850124,735485963,613812878,674486205,422707130,771047016,665247390,154956805,4097708,866079414,257804884,167933867,139067329,446562337,479445371,745844619,195696002,230901560,496117579,931358729,379176295,758495825,158093679,712938411,122503788,853017941,652834192,867807987,515143556,370022528,777221383,992100465,302010105,206692292,850038879,369203656,861834784,641633876,77516287,361055440,309007001,656810219,536782890,427023200,703082910,100799472,138251465,526161981,854937102,519993591,859826031,857473634,145930913,221098568,641151881,783996845,195826216,727312055,837510025,883803952,658498041,884555009,587685092,201634891,142101344,365449743,605430454,930970640,112080263,509410062,164295560,490144805,620803478,820536329,278465952,825754907,363263067,991902187,823253841,416286040,307645795,222226907,903582326,759471380,793733723,569493152,20873181,438285734,497513629,426109249,467268896,722492904,58474867,107212797,117359107,697742908,898790424,34891822,150388973,577450721,709363018,472735892,309245981,973388837,835670800,961183535,438555122,787084865,690309853,967196744,768140952,944158584,516779478,970947613,336982183,921235469,182198503,346059186,277053641,562817030,674222522,29459277,26429091,738447017,795313409,729032653,553200652,584530199,973132855,740724816,220193968,648800376,967684296,890451843,411127145,615189046,557376843,184208464,426509243,737238222,143275994,492085842,453970031,480225780,951609625,457699820,391080577,994326117,733058957,56439962,222269287,720955844,138728942,937728481,731082005,928929549,570093956,727072843,386718788,192469842,166341312,804185595,526332649,482424308,831409262,552325157,427499278,757745721,835425311,855369831,3706649,87146431,334485790,872557428,461462208,579756911,886607412,861957051,149845399,512136680,120471307,558215387,13257470,469049893,748481936,752195903,572519593,358015373,936201402,944052422,839052219,951046313,894822383,13809673,744504302,92805030,515324851,276080987,410591942,178582489,419671982,612655745,847077098,600927558,807178909,541476675,262869355,655354990,596158986,376333993,790135084,399880535,815445114,195106074,84782725,710349280,192899302,340376022,972617405,190943995,10823756,740170124,729351268,227541296,170138313,918482230,563860013,782161802,309928741,12806875,757497299,178268423,734649068,770326628,147369859,933634961,565544024,656076180,96058143,519672424,520470351,207368903,43418716,91837745,418943118,752652751,165007170,776068379,870931886,393706865,691360789,673767461,313993065,82663532,725712143,493073937,753333826,130783553,334833620,953881386,211054431,843446330,631762599,85861549,394360929,78558378,392013377,909353351,88605845,609975225,650855484,21963018,62279245,29998316,390030954,853624314,785268747,843084214,930078724,277516346,941363236,104716276,605123384,753677651,755889475,127485450,35820768,600298696,340479995,654900987,718245038,26081410,588191864,776876108,472652880,881070051,552959798,414446777,833348330,648018624,657592074,676619110,523738298,538376389,584284056,157482456,855624101,280445219,203276538,807909037,582272972,815426220,64145612,662454632,5701130,981244790,303167447,666103987,211310381,608817650,814992705,984169790,219480079,4512468,88716782,572102777,400915884,668740121,648109523,694617738,388631480,944887858,419563338,347762074,744757797,92272940,778380809,292368887,35811433,426317381,939326768,406609420,335014160,108842088,712421032,189374814,63787656,767405957,943486727,519127916,793279533,263225838,795708957,896663432,832848944,863383997,255103548,581672668,571719221,633481956,775385508,532857017,654653319,794922857,946409249,793028160,595855855,470516558,284195181,144878682,906511529,765248036,32753906,100956752,434971325,694641015,974905830,550903787,230441073,964505711,115225513,685788882,222609433,463024073,385292346,41890053,238421760,873582853,998562166,97965461,476977489,817940866,781675883,985976788,599373101,727670793,338871599,38984578,196840419,465393721,122706197,448727489,304315853,175822409,818255570,662596026,747096226,196007431,980317155,182603742,688754178,556897770,412089924,184130442,194472445,345456849,380341705,639878187,96592120,348821478,834022239,530955855,851899367,703731709,185737110,935307660,166154530,905337111,657930689,464180234,981971367,443753845,979325814,296608244,454447022,648485718,861431582,204901283,373970691,386447540,81909233,948822378,571142387,819956869,708005961,602497871,982148105,515504647,153150575,240879666,216015116,544442175,131256298,913437394,63778350,872951102,379118158,730940661,723724509,945517031,991560405,270805396,78445999,179078009,29249610,826823852,54059229,727002509,678747076,512511824,323506160,744236090,149158715,300231113,651306547,477233614,910589884,13388187,362722375,844699215,824505449,64526395,66620460,738215818,208416459,191709936,279972198,239284324,93737016,470354733,807994114,568275410,918541833,339950537,833383893,467410763,750219079,400816048,943548457,333032754,266769965,140669881,658191424,639513,137755912,305317847,150761397,414331392,709491108,584262204,997535992,281934746,936908697,148461782,256234804,786679183,562670099,590787278,710177221,440039911,207339699,343244673,502751326,369707355,226713690,358186625,130082330,404094304,979648672,332893952,813883107,535783736,793639796,905799464,265221814,732966207,649976889,744490348,59749564,79845027,455930738,805090778,175770523,374112951,394831060,247778846,124422680,358416463,400874380,936429484,418626778,860419522,99946534,841080092,304751520,6430494,32910197,687344691,894169516,263353206,306691429,13866244,395605543,772634051,387431514,530244548,516043041,490547100,728963691,316696479,287173557,279599895,650164841,814475608,99106148,420158172,639195432,760492722,732830573,780077822,887121466,465360318,922767133,293732951,386314710,626940455,40371792,673547887,892108952,203447236,539957951,52466822,594406779,936422594,779409101,628661891,410025332,707614490,543380998,811900716,48182919,882454611,762700732,10060456,227264963,466698618,415529624,923106647,118147922,556684753,162450904,484861515,472243587,417233174,876650046,191048316,383910998,649569453,510481612,950253003,842521672,764810784,104232772,58253341,130246780,277151092,853096969,122266693,562258894,756520244,505753533,131849002,306283398,461218335,182081805,640042214,844891889,79604455,669916934,391532044,324004907,316636024,697406258,78039697,62968876,807482442,582529836,654903492,645929437,899904170,778779290,745708257,885460937,248942795,915545919,954930349,853377354,703531737,705014437,346272675,690789405,184836726,697806503,478533743,532637281,407127984,996934825,346686042,548135160,765942400,933657016,193044592,437134842,70465577,368879691,203286011,400628145,969402144,87233108,53586076,351901593,861801971,965590935,157777546,576237903,865664494,687258845,47733438,418084812,281701037,738557295,779053933,304568296,532114164,412173364,320897149,863489134,373305422,633552785,889812890,168503336,434627838,211242191,927851579,614936003,16569617,699206926,736507685,397035158,903211757,440705427,715617560,612372394,229567681,266661262,435522292,200176528,84928269,195574671,966586370,523014139,195166660,540799747,440222895,89764275,427291076,747192999,428681577,231514074,551539517,850110981,535685004,119680018,90501935,873430866,26236466,44084025,320357343,707828720,963059910,940281847,563722697,895217040,184272120,668843999,663595238,75996223,871355856,472306161,981409109,60703902,75486282,696747403,731490959,982051833,171394898,911710305,775942676,202597561,589191850,795327523,677934945,12617918,137108358,935199280,518220977,116587977,682683443,147836368,279931006,685488923,68815628,64071148,249111,273037997,908067814,322921229,422762728,227090135,749963904,568727681,806780476,899067831,854604941,410663181,173024913,876391214,555253141,374034278,341294995,418295052,544429064,401636797,926482153,223764400,348047352,4170610,903219819,143084772,342172787,616120027,27246776,879816941,452679550,558138102,130315754,219311447,10920181,781366606,418626593,50442742,530080840,536122388,99827770,635120330,524787685,108069911,326808157,685496753,651715091,465802418,586477250,34520847,248028557,384951719,241662121,61499161,258971783,172528295,202694969,637100374,202977144,140446730,353128622,215890965,96378092,57479914,818866544,497369638,33877403,640174285,796387998,686331280,705462639,142382808,566570797,589164945,288064839,385891484,956282930,256213029,626100151,697642496,599419006,142968621,332527576,642416477,901938758,414825769,144458027,196686319,306753424,880043016,792590727,263886450,814382072,509410448,40946171,108789533,875617498,756117032,59410,579152769,129267799,633423653,540794375,18462841,676577261,676017628,759266870,748182244,652434838,482076487,654157008,241722179,998113460,252492854,127322674,922111837,565015483,48227657,831613942,813727126,751320855,44295213,404554381,658682340,837874630,570486079,798694531,91541826,321826660,637576159,962544045,714023960,417018084,758335330,597956836,946147586,659013117,315899389,142601427,739010552,202009838,352624425,244916106,795161135,820367416,934789385,9689997,662283914,22890821,961269481,627630211,697840384,778754063,726293481,164039247,998516010,871672945,693352845,396835953,623179072,220902433,173369628,205616506,84809875,316411189,413390416,365382768,834238444,227018509,606790023,34734777,772382567,45774996,218255237,488498583,402901334,601452090,815468661,378119229,93399250,988321123,246628596,15358458,168829272,131157961,789962973,726530351,143389167,620080452,780182658,328208438,580344546,992798006,593436769,378585282,722485795,137959762,936163856,586587294,313451290,233013869,362301382,589999977,219546432,439633737,572908493,94618738,892856994,208794479,625046548,748757220,597509297,380918127,214012165,717753869,771813783,457416299,671746683,33532876,795824027,195903442,551461402,342423035,431189067,518716085,696521992,560176572,630965323,557416202,323509010,173224789,828724729,968140304,988964940,316173144,341504264,277776038,36386466,688232181,907501394,970641914,582585429,41499562,428262935,873814102,894965584,70031653,34608458,758650174,819003233,97675208,310457053,556931799,431435024,148274527,954015047,931035697,220246718,78348924,193773201,726556759,193601577,212555541,224399717,649163719,331830856,226979171,47387453,766293175,766864502,32326195,857668845,288084612,675487924,241875121,303629562,311049618,33939433,92842842,147727423,932581866,582294529,30247220,598677509,818518519,530461868,462030436,107537726,717701973,459407340,713486367,787323230,427149321,275759208,156070354,715543532,218504709,288177102,778659746,568125939,281127120,285482612,523912088,612484386,902593481,775066724,767173324,127630042,12632132,848390954,645505424,537766523,171564214,539521790,933042297,22847005,420148141,292784844,618159945,649409140,37848281,596772455,707286944,905971364,953390666,214613322,149419222,697477148,667033594,847009175,272913955,705901835,482318500,638704381,530378109,5643697,88522112,127178085,903771790,635411197,413881100,983778581,599501600,879394954,216144911,770087630,53708332,945232410,868933334,574994607,763651799,503202781,741181251,714808605,500554412,629435502,638061456,352591847,31843999,262305525,575865729,293804357,640198163,960488618,925794515,918424438,513038978,486204399,281767509,262799861,512517514,959125582,956090313,30823940,793756933,893174553,426286107,325926555,944403455,932055930,882316068,288647913,463611349,56074973,931336344,657923637,727391524,765937094,73383914,392603595,16642143,393967842,82030124,827796830,577732842,782637746,177555370,188314883,102809457,58457044,940072204,891807819,860497662,293942862,158428699,128707222,932026400,826978343,934583262,611199426,928759087,429957844,636263547,647176360,356851584,469700120,201935331,881124336,498262193,401818531,181724018,259842609,313425780,425986162,8071027,400799612,139461628,1547408,563014948,173512404,108526969,504340148,561559398,69850654,268426467,190039260,465924314,691014363,590432325,696811224,238191256,411880615,10733612,75814368,718358205,707088249,432258153,419894988,430369216,451988501,623547572,316613921,186894572,262942596,906475376,846936278,118522161,74411275,132630645,960286714,72870746,833102870,501691613,539149565,100276581,268789611,439529842,576930883,933143763,111058449,685475841,119449191,636963376,808834338,284063565,967980332,922483776,37037270,52955681,247622649,606701577,783700136,438473902,95970436,644151384,323931349,717079757,730425839,14459255,131884509,649752449,404358217,846888563,612684669,925097512,135496193,121027198,296970540,487925012,280211918,516799799,896944677,919664120,492289865,392518599,630073771,415972100,985805886,32499738,973754440,341740497,473306909,425772299,302237892,364631001,729564318,709053902,887924885,824818816,375676387,435581480,693020242,945849226,247289016,595902817,717070280,207934656,318412495,316122695,277266809,436980718,153636661,940214786,637785865,930802821,390845195,770140801,479178730,662209078,232708202,515128158,552815956,606841481,518891821,550053460,307640384,616986593,92000395,47290518,531144248,902052679,808081917,168021011,122596137,228835771,293376006,376364912,293153993,446268515,542667386,680896947,49284078,760638209,163882924,707794270,649533853,402578028,721161955,300613572,639073498,196935262,317293353,148764572,956629016,256155409,193971176,537079947,770502024,944729817,660244220,222206232,123028288,529241381,823756261,32568715,68595097,335385241,51120203,781489474,943029213,458273788,803061824,778143854,200069810,674878570,922802457,42979240,297311374,91104634,799554447,599504154,243605288,965783966,996900904,309141519,327382373,94367741,560262254,730402636,446291524,961305147,708180791,789351858,987692797,931408751,751497020,761571783,70072264,435104379,935989642,494922960,225443021,920409488,732168291,85506148,820453413,779670112,851355023,659912223,35839007,829404081,465123272,627466966,899391085,77908645,266282639,90149912,149404370,365309816,432192216,675345148,763339193,888094729,891394029,58760808,241121364,456088283,497066229,841914057,962324749,886259141,63129295,567249017,265344789,632563407,285786420,430619629,269071972,260403479,11689849,661107541,104156141,123148731,539656122,596969721,983085131,613155479,638837437,186907871,310123900,278242086,891604317,807035658,501077169,990826558,471583663,198533053,988850304,240558020,568701395,110722754,58026856,964103431,524610656,803655069,6674318,492955750,2561039,209923837,487943222,57126567,268241809,615992754,731855482,319369835,160757637,128684388,181705605,644760544,274864727,144846144,305756258,451923039,716710241,332770924,943596793,917783239,624715790,449624888,896508748,186048445,745256677,880762491,731606582,590628196,441697875,209303777,945912308,856208668,522083215,92419648,395583585,12287870,411448830,319681767,279205673,42238937,81900509,408074677,624225165,64898309,898963698,588468423,518527602,565345039,406301427,362655560,661030923,159146529,369617045,680068439,861789147,592688027,882511526,376463549,222555938,636789593,118533438,664315072,510317286,360803671,246897856,133952986,181015672,712301235,632324047,183999617,117652986,995819068,30740678,379459416,978705529,480608964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);\n t=maxlongint div 5000;\nvar n,i:longint;s:qword;\nbegin\n readln(n);\n s:=js[n div t];\n for i:=n div t*t+1 to n do\n s:=(s*i) mod 1000000007;\n writeln(s);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03796", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 28548, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s795256678", "group_id": "codeNet:p03800", "input_text": "var\n\tn,i:Longint;\n\ts:String;\n\ta:array[0..99999]of Boolean;\nfunction f(x,y:Boolean):Boolean;\nvar j:Longint;flag:Boolean;\nbegin\n\ta[0]:=x;\n\ta[1]:=y;\n\tfor j:=1 to n-2 do if(s[j+1]='x')xor a[j]then a[j+1]:=a[j-1]else a[j+1]:=not a[j-1];\n\tflag:=true;\n\tif(s[1]='x')xor a[0]then flag:=flag and(a[n-1]=a[1])else flag:=flag and(a[n-1]<>a[1]);\n\tif(s[n]='x')xor a[n-1]then flag:=flag and(a[n-2]=a[0])else flag:=flag and(a[n-2]<>a[0]);\n\tf:=flag;\nend;\nprocedure print();\nvar j:Longint;\nbegin\n\tfor j:=0 to n-1 do if a[j] then write('S')else write('W');\n\twriteln;\nend;\nbegin\n\treadln(n);\n\treadln(s);\n\tif f(true,true)then print()else if f(true,false)then print()else if f(false,true)then print()else if f(false,false)then print()else writeln(-1);\nend.\n", "language": "Pascal", "metadata": {"date": 1539167627, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03800.html", "problem_id": "p03800", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03800/input.txt", "sample_output_relpath": "derived/input_output/data/p03800/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03800/Pascal/s795256678.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s795256678", "user_id": "u657913472"}, "prompt_components": {"gold_output": "SSSWWS\n", "input_to_evaluate": "var\n\tn,i:Longint;\n\ts:String;\n\ta:array[0..99999]of Boolean;\nfunction f(x,y:Boolean):Boolean;\nvar j:Longint;flag:Boolean;\nbegin\n\ta[0]:=x;\n\ta[1]:=y;\n\tfor j:=1 to n-2 do if(s[j+1]='x')xor a[j]then a[j+1]:=a[j-1]else a[j+1]:=not a[j-1];\n\tflag:=true;\n\tif(s[1]='x')xor a[0]then flag:=flag and(a[n-1]=a[1])else flag:=flag and(a[n-1]<>a[1]);\n\tif(s[n]='x')xor a[n-1]then flag:=flag and(a[n-2]=a[0])else flag:=flag and(a[n-2]<>a[0]);\n\tf:=flag;\nend;\nprocedure print();\nvar j:Longint;\nbegin\n\tfor j:=0 to n-1 do if a[j] then write('S')else write('W');\n\twriteln;\nend;\nbegin\n\treadln(n);\n\treadln(s);\n\tif f(true,true)then print()else if f(true,false)then print()else if f(false,true)then print()else if f(false,false)then print()else writeln(-1);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke, who loves animals, built a zoo.\n\nThere are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle.\nThe animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1.\n\nThere are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies.\n\nSnuke cannot tell the difference between these two species, and asked each animal the following question: \"Are your neighbors of the same species?\" The animal numbered i answered s_i. Here, if s_i is o, the animal said that the two neighboring animals are of the same species, and if s_i is x, the animal said that the two neighboring animals are of different species.\n\nMore formally, a sheep answered o if the two neighboring animals are both sheep or both wolves, and answered x otherwise.\nSimilarly, a wolf answered x if the two neighboring animals are both sheep or both wolves, and answered o otherwise.\n\nSnuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print -1.\n\nConstraints\n\n3 ≤ N ≤ 10^{5}\n\ns is a string of length N consisting of o and x.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there does not exist an valid assignment that is consistent with s, print -1.\nOtherwise, print an string t in the following format. The output is considered correct if the assignment described by t is consistent with s.\n\nt is a string of length N consisting of S and W.\n\nIf t_i is S, it indicates that the animal numbered i is a sheep. If t_i is W, it indicates that the animal numbered i is a wolf.\n\nSample Input 1\n\n6\nooxoox\n\nSample Output 1\n\nSSSWWS\n\nFor example, if the animals numbered 1, 2, 3, 4, 5 and 6 are respectively a sheep, sheep, sheep, wolf, wolf, and sheep, it is consistent with their responses. Besides, there is another valid assignment of species: a wolf, sheep, wolf, sheep, wolf and wolf.\n\nLet us remind you: if the neiboring animals are of the same species, a sheep answers o and a wolf answers x. If the neiboring animals are of different species, a sheep answers x and a wolf answers o.\n\nSample Input 2\n\n3\noox\n\nSample Output 2\n\n-1\n\nPrint -1 if there is no valid assignment of species.\n\nSample Input 3\n\n10\noxooxoxoox\n\nSample Output 3\n\nSSWWSSSWWS", "sample_input": "6\nooxoox\n"}, "reference_outputs": ["SSSWWS\n"], "source_document_id": "p03800", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke, who loves animals, built a zoo.\n\nThere are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle.\nThe animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1.\n\nThere are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies.\n\nSnuke cannot tell the difference between these two species, and asked each animal the following question: \"Are your neighbors of the same species?\" The animal numbered i answered s_i. Here, if s_i is o, the animal said that the two neighboring animals are of the same species, and if s_i is x, the animal said that the two neighboring animals are of different species.\n\nMore formally, a sheep answered o if the two neighboring animals are both sheep or both wolves, and answered x otherwise.\nSimilarly, a wolf answered x if the two neighboring animals are both sheep or both wolves, and answered o otherwise.\n\nSnuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print -1.\n\nConstraints\n\n3 ≤ N ≤ 10^{5}\n\ns is a string of length N consisting of o and x.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there does not exist an valid assignment that is consistent with s, print -1.\nOtherwise, print an string t in the following format. The output is considered correct if the assignment described by t is consistent with s.\n\nt is a string of length N consisting of S and W.\n\nIf t_i is S, it indicates that the animal numbered i is a sheep. If t_i is W, it indicates that the animal numbered i is a wolf.\n\nSample Input 1\n\n6\nooxoox\n\nSample Output 1\n\nSSSWWS\n\nFor example, if the animals numbered 1, 2, 3, 4, 5 and 6 are respectively a sheep, sheep, sheep, wolf, wolf, and sheep, it is consistent with their responses. Besides, there is another valid assignment of species: a wolf, sheep, wolf, sheep, wolf and wolf.\n\nLet us remind you: if the neiboring animals are of the same species, a sheep answers o and a wolf answers x. If the neiboring animals are of different species, a sheep answers x and a wolf answers o.\n\nSample Input 2\n\n3\noox\n\nSample Output 2\n\n-1\n\nPrint -1 if there is no valid assignment of species.\n\nSample Input 3\n\n10\noxooxoxoox\n\nSample Output 3\n\nSSWWSSSWWS", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 734, "cpu_time_ms": 6, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s396664607", "group_id": "codeNet:p03801", "input_text": "program project1;\ntype la=record\n sum,dist,le:longint;\n end;\nvar a:array[1..50000,0..1] of longint;\n layer:array[1..50000] of la;\n ans:array[1..50000]of longint;\n n,i,t,m,k,sum,min:longint;\n\nprocedure qs(l,r:longint);//假设被排序的数组是a,且快排后按升序排列)\nvar i,j,m,t,c:longint;\nbegin\n i:=l;\n j:=r;//(l(left),r(right)表示快排的左右区间)\n m:=a[(l+r) div 2,1];//注意:本句不能写成:m:=(l+r)div2;\n repeat\n while a[i,1]>m do inc(i);\n while a[j,1]'互换;\n if i<=j then\n begin\n t:=a[i,1];\n a[i,1]:=a[j,1];\n a[j,1]:=t;\n c:=a[i,0];\n a[i,0]:= a[j,0];\n a[j,0]:= c;\n inc(i);\n dec(j);\n end;\n until i>j;\n if lm do inc(i);\n while a[j,1]'互换;\n if i<=j then\n begin\n t:=a[i,1];\n a[i,1]:=a[j,1];\n a[j,1]:=t;\n c:=a[i,0];\n a[i,0]:= a[j,0];\n a[j,0]:= c;\n inc(i);\n dec(j);\n end;\n until i>j;\n if lb.w then exit(a.w>b.w) else exit(a.id>b.id);\nend;\n\nprocedure sort(l,r:longint);\nvar i,j:longint;x,y:xx;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while cmp(a[i],x) do inc(i);\n while cmp(x,a[j]) do dec(j);\n if i<=j then\n begin\n y:=a[i];a[i]:=a[j];a[j]:=y;\n inc(i);dec(j);\n end;\n until i>j;\n if ib.w then exit(a.w>b.w) else exit(a.id>b.id);\nend;\n\nprocedure sort(l,r:longint);\nvar i,j:longint;x,y:xx;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while cmp(a[i],x) do inc(i);\n while cmp(x,a[j]) do dec(j);\n if i<=j then\n begin\n y:=a[i];a[i]:=a[j];a[j]:=y;\n inc(i);dec(j);\n end;\n until i>j;\n if ic1[i+tx,j+ty]) then flagg:=false;\n\t if flagg then ans:=true;\n\tend;\n if ans then writeln('Yes') else writeln('No');\nend.\n ", "language": "Pascal", "metadata": {"date": 1486865170, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03804.html", "problem_id": "p03804", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03804/input.txt", "sample_output_relpath": "derived/input_output/data/p03804/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03804/Pascal/s757056275.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s757056275", "user_id": "u331121156"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var m,n,i,j,tx,ty:longint;\n flagg,ans:boolean;\n\tc1,c2:array[0..57,0..57] of char;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to n do\n\t\tread(c1[i,j]);\n\treadln;\n end;\n for i:=1 to m do\n begin\n for j:=1 to m do\n\t\tread(c2[i,j]);\n\treadln;\n end;\n ans:=false;\n for tx:=0 to n-m do\n\tfor ty:=0 to n-m do\n\tbegin\n\t flagg:=true;\n\t for i:=1 to m do\n\t\tfor j:=1 to m do\n\t\t if (c2[i,j]<>c1[i+tx,j+ty]) then flagg:=false;\n\t if flagg then ans:=true;\n\tend;\n if ans then writeln('Yes') else writeln('No');\nend.\n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "sample_input": "3 2\n#.#\n.#.\n#.#\n#.\n.#\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03804", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 528, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s606849051", "group_id": "codeNet:p03805", "input_text": "var\n\tn,m,i,a,b:Longint;\n\tused:array[1..8]of Boolean;\n\tc:array[1..8]of Longint;\n\tG:array[1..8,1..8]of Longint;\nfunction f(u,cnt:Longint):Longint;\nvar i,ret:Longint;\nbegin\n\tif cnt=n then begin\n\t\tf:=1;\n\t\texit;\n\tend;\n\tret:=0;\n\tfor i:=1 to c[u] do begin\n\t\tif not used[G[u,i]]then begin\n\t\t\tused[G[u,i]]:=True;\n\t\t\tinc(ret,f(G[u,i],cnt+1));\n\t\t\tused[G[u,i]]:=False;\n\t\tend;\n\tend;\n\tf:=ret;\nend;\nbegin\n\tread(n,m);\n\tfor i:=1 to m do begin\n\t\tread(a,b);\n\t\tif b<>1 then begin\n\t\t\tinc(c[a]);\n\t\t\tG[a,c[a]]:=b;\n\t\tend;\n\t\tif a<>1 then begin\n\t\t\tinc(c[b]);\n\t\t\tG[b,c[b]]:=a;\n\t\tend;\n\tend;\n\tused[1]:=True;\n\twriteln(f(1,1));\nend.", "language": "Pascal", "metadata": {"date": 1541922168, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03805.html", "problem_id": "p03805", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03805/input.txt", "sample_output_relpath": "derived/input_output/data/p03805/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03805/Pascal/s606849051.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s606849051", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,m,i,a,b:Longint;\n\tused:array[1..8]of Boolean;\n\tc:array[1..8]of Longint;\n\tG:array[1..8,1..8]of Longint;\nfunction f(u,cnt:Longint):Longint;\nvar i,ret:Longint;\nbegin\n\tif cnt=n then begin\n\t\tf:=1;\n\t\texit;\n\tend;\n\tret:=0;\n\tfor i:=1 to c[u] do begin\n\t\tif not used[G[u,i]]then begin\n\t\t\tused[G[u,i]]:=True;\n\t\t\tinc(ret,f(G[u,i],cnt+1));\n\t\t\tused[G[u,i]]:=False;\n\t\tend;\n\tend;\n\tf:=ret;\nend;\nbegin\n\tread(n,m);\n\tfor i:=1 to m do begin\n\t\tread(a,b);\n\t\tif b<>1 then begin\n\t\t\tinc(c[a]);\n\t\t\tG[a,c[a]]:=b;\n\t\tend;\n\t\tif a<>1 then begin\n\t\t\tinc(c[b]);\n\t\t\tG[b,c[b]]:=a;\n\t\tend;\n\tend;\n\tused[1]:=True;\n\twriteln(f(1,1));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i0) do\n\tbegin\n\t v:=other[q];\n\t if not(vis[v]) then\n\t begin\n\t vis[v]:=true;\n\t dfs(x+1,v);\n\t vis[v]:=false;\n\t end;\n\t q:=pre[q];\n\tend;\n end;\nend;\nbegin\n readln(n,m);\n tot:=0;\n fillchar(last,sizeof(last),0);\n fillchar(pre,sizeof(pre),0);\n fillchar(other,sizeof(other),0);\n for i:=1 to m do\n begin\n readln(u,v);\n insert(u,v);\n insert(v,u);\n end;\n ans:=0;\n fillchar(vis,sizeof(vis),false);\n vis[1]:=true;\n dfs(1,1);\n writeln(ans);\nend.\n ", "language": "Pascal", "metadata": {"date": 1486865468, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03805.html", "problem_id": "p03805", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03805/input.txt", "sample_output_relpath": "derived/input_output/data/p03805/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03805/Pascal/s090080902.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s090080902", "user_id": "u331121156"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var ans,n,m,i,j,tot,u,v:longint;\n last,pre,other:array[0..100007] of longint;\n\tvis:array[0..100007] of boolean;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure dfs(x,u:longint);\nvar q,v:longint;\nbegin\n if (x=n) then inc(ans) else\n begin\n q:=last[u];\n while (q>0) do\n\tbegin\n\t v:=other[q];\n\t if not(vis[v]) then\n\t begin\n\t vis[v]:=true;\n\t dfs(x+1,v);\n\t vis[v]:=false;\n\t end;\n\t q:=pre[q];\n\tend;\n end;\nend;\nbegin\n readln(n,m);\n tot:=0;\n fillchar(last,sizeof(last),0);\n fillchar(pre,sizeof(pre),0);\n fillchar(other,sizeof(other),0);\n for i:=1 to m do\n begin\n readln(u,v);\n insert(u,v);\n insert(v,u);\n end;\n ans:=0;\n fillchar(vis,sizeof(vis),false);\n vis[1]:=true;\n dfs(1,1);\n writeln(ans);\nend.\n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i0 then begin\n\t\t\tmp:=min(mp+x,200);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,200);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 100 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924279, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s275634410.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s275634410", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tmp:=min(mp+x,200);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,200);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 100 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 568, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s231252846", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tmp:=min(mp+x,200);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,200);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924217, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s231252846.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s231252846", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tmp:=min(mp+x,200);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,200);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 568, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s879072811", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tmp:=min(mp+x,200);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,200);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924194, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s879072811.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s879072811", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tmp:=min(mp+x,200);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,200);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 568, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s572259769", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..220]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924045, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s572259769.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s572259769", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..220]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s898821195", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..300]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541923959, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s898821195.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s898821195", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..300]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s719838460", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541923893, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s719838460.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s719838460", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s286574629", "group_id": "codeNet:p03806", "input_text": "var a,b,c:array[0..50] of integer;\n dp:array[0..50, 0..500, 0..500] of integer;\n n,ma,mb,i,ca,cb,ans:integer;\n\nFunction min(a,b:integer):integer;\n Begin\n if a < b then exit(a)\n else exit(b);\n End;\n\nBEGIN\n readln(n,ma,mb);\n for i:=0 to n-1 do\n readln(a[i],b[i],c[i]);\n\n for i:=0 to n do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n dp[i,ca,cb] := maxint;\n\n dp[0,0,0] := 0;\n for i:=0 to n-1 do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n if dp[i,ca,cb] <> maxint then\n Begin\n dp[i+1, ca, cb] := min(dp[i,ca,cb], dp[i+1, ca, cb]);\n dp[i+1, ca+a[i], cb+b[i]] := dp[i,ca,cb] + c[i];\n End;\n\n ans := maxint;\n for ca:=1 to 400 do\n for cb:=1 to 400 do\n if ma * cb = mb * ca then\n ans := min(ans, dp[n,ca,cb]);\n \n if ans = maxint then writeln(-1)\n else writeln(ans);\nEND.", "language": "Pascal", "metadata": {"date": 1489896829, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s286574629.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s286574629", "user_id": "u889725830"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var a,b,c:array[0..50] of integer;\n dp:array[0..50, 0..500, 0..500] of integer;\n n,ma,mb,i,ca,cb,ans:integer;\n\nFunction min(a,b:integer):integer;\n Begin\n if a < b then exit(a)\n else exit(b);\n End;\n\nBEGIN\n readln(n,ma,mb);\n for i:=0 to n-1 do\n readln(a[i],b[i],c[i]);\n\n for i:=0 to n do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n dp[i,ca,cb] := maxint;\n\n dp[0,0,0] := 0;\n for i:=0 to n-1 do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n if dp[i,ca,cb] <> maxint then\n Begin\n dp[i+1, ca, cb] := min(dp[i,ca,cb], dp[i+1, ca, cb]);\n dp[i+1, ca+a[i], cb+b[i]] := dp[i,ca,cb] + c[i];\n End;\n\n ans := maxint;\n for ca:=1 to 400 do\n for cb:=1 to 400 do\n if ma * cb = mb * ca then\n ans := min(ans, dp[n,ca,cb]);\n \n if ans = maxint then writeln(-1)\n else writeln(ans);\nEND.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1004, "cpu_time_ms": 43, "memory_kb": 40576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s818444807", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar n,x,y,i,j:longint;\n a,b,c:array[0..107] of longint;\n\tf:array[0..57,-10007..10007] of longint;\nbegin\n readln(n,x,y);\n fillchar(a,sizeof(a),0);\n fillchar(b,sizeof(b),0);\n fillchar(c,sizeof(c),0);\n for i:=1 to n do\n begin\n readln(a[i],b[i],c[i]);\n a[i]:=a[i]*y;\n b[i]:=b[i]*x;\n end;\n for i:=0 to n do\n\tfor j:=-10000 to 10000 do\n\t f[i,j]:=maxlongint div 2;\n for i:=1 to n do\n f[i,a[i]-b[i]]:=c[i];\n for i:=2 to n do\n\tfor j:=-10000 to 10000 do\n\t f[i,j]:=min(f[i,j],min(f[i-1,j],f[i-1,j-a[i]+b[i]]+c[i]));\n if (f[n,0]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if il then kp(l,j);\n end;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n kp(1,n);\n for i:=2 to n do if a[i]=a[i-1] then inc(s);\n if odd(s) then inc(s);\n writeln(n-s);\nend.", "language": "Pascal", "metadata": {"date": 1582858085, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03816.html", "problem_id": "p03816", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03816/input.txt", "sample_output_relpath": "derived/input_output/data/p03816/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03816/Pascal/s184217696.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s184217696", "user_id": "u247366051"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,i,j,s:longint;\n a:array[0..100000] of longint;\n procedure kp(l,r:longint);\n var\n i,j,t,mid:longint;\n begin\n i:=l; j:=r; mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if il then kp(l,j);\n end;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n kp(1,n);\n for i:=2 to n do if a[i]=a[i-1] then inc(s);\n if odd(s) then inc(s);\n writeln(n-s);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "sample_input": "5\n1 2 1 3 7\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03816", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 570, "cpu_time_ms": 19, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s786847690", "group_id": "codeNet:p03816", "input_text": "var\n n,i,j,s:longint;\n a:array[0..100000] of longint;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if a[i]>a[j] then\n begin\n a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];\n end;\n for i:=2 to n do if a[i]=a[i-1] then inc(s);\n if odd(s) then inc(s);\n writeln(n-s);\nend.", "language": "Pascal", "metadata": {"date": 1582857940, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03816.html", "problem_id": "p03816", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03816/input.txt", "sample_output_relpath": "derived/input_output/data/p03816/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03816/Pascal/s786847690.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s786847690", "user_id": "u476418095"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,i,j,s:longint;\n a:array[0..100000] of longint;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if a[i]>a[j] then\n begin\n a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];\n end;\n for i:=2 to n do if a[i]=a[i-1] then inc(s);\n if odd(s) then inc(s);\n writeln(n-s);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "sample_input": "5\n1 2 1 3 7\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03816", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 337, "cpu_time_ms": 2103, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s526589254", "group_id": "codeNet:p03816", "input_text": "var e:array[1..100000] of boolean;\n ans,i,a,n:longint;\n\nbegin\n readln(n);\n for i:=1 to n do begin\n read(a);\n e[a]:=true\n end;\n ans:=0;\n for i:=1 to 100000 do if e[i] then ans:=ans+1;\n if ans mod 2 = 0 then ans:=ans-1;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1565750928, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03816.html", "problem_id": "p03816", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03816/input.txt", "sample_output_relpath": "derived/input_output/data/p03816/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03816/Pascal/s526589254.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s526589254", "user_id": "u492212770"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var e:array[1..100000] of boolean;\n ans,i,a,n:longint;\n\nbegin\n readln(n);\n for i:=1 to n do begin\n read(a);\n e[a]:=true\n end;\n ans:=0;\n for i:=1 to 100000 do if e[i] then ans:=ans+1;\n if ans mod 2 = 0 then ans:=ans-1;\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "sample_input": "5\n1 2 1 3 7\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03816", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 11, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s288012497", "group_id": "codeNet:p03816", "input_text": "var n,i,j,tot,ans:longint;\n a:array[0..100007] of longint;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=a[random(rx-lx+1)+lx];\n repeat\n\twhile (a[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=a[i];a[i]:=a[j];a[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n for i:=1 to n do\n\tread(a[i]);\n readln;\n qsort(1,n);\n tot:=0;\n for i:=2 to n do\n\tif (a[i]=a[i-1]) then inc(tot);\n ans:=n-tot;\n tot:=tot mod 2;\n if (tot=1) then dec(ans);\n writeln(ans);\nend.\n\t", "language": "Pascal", "metadata": {"date": 1485656525, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03816.html", "problem_id": "p03816", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03816/input.txt", "sample_output_relpath": "derived/input_output/data/p03816/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03816/Pascal/s288012497.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s288012497", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,j,tot,ans:longint;\n a:array[0..100007] of longint;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=a[random(rx-lx+1)+lx];\n repeat\n\twhile (a[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=a[i];a[i]:=a[j];a[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n for i:=1 to n do\n\tread(a[i]);\n readln;\n qsort(1,n);\n tot:=0;\n for i:=2 to n do\n\tif (a[i]=a[i-1]) then inc(tot);\n ans:=n-tot;\n tot:=tot mod 2;\n if (tot=1) then dec(ans);\n writeln(ans);\nend.\n\t", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "sample_input": "5\n1 2 1 3 7\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03816", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has decided to play a game using cards.\nHe has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.\n\nOperation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.\n\nConstraints\n\n3 ≦ N ≦ 10^{5}\n\nN is odd.\n\n1 ≦ A_i ≦ 10^{5}\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n1 2 1 3 7\n\nSample Output 1\n\n3\n\nOne optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.\n\nSample Input 2\n\n15\n1 3 5 2 1 3 2 8 8 6 2 6 11 1 1\n\nSample Output 2\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 641, "cpu_time_ms": 25, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s078679563", "group_id": "codeNet:p03821", "input_text": "var n,i,j:longint;\n ans,now:int64;\n\ta,b:array[0..100007] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n\treadln(a[i],b[i]);\n ans:=0;\n for i:=n downto 1 do\n begin\n now:=(b[i]-(a[i]+ans) mod b[i]) mod b[i];\n ans:=ans+now;\n end;\n writeln(ans);\nend.\n\t", "language": "Pascal", "metadata": {"date": 1485137136, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03821.html", "problem_id": "p03821", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03821/input.txt", "sample_output_relpath": "derived/input_output/data/p03821/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03821/Pascal/s078679563.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s078679563", "user_id": "u331121156"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var n,i,j:longint;\n ans,now:int64;\n\ta,b:array[0..100007] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n\treadln(a[i],b[i]);\n ans:=0;\n for i:=n downto 1 do\n begin\n now:=(b[i]-(a[i]+ans) mod b[i]) mod b[i];\n ans:=ans+now;\n end;\n writeln(ans);\nend.\n\t", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are an integer sequence A_1,...,A_N consisting of N terms, and N buttons.\nWhen the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1.\n\nThere is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i.\n\nFind the minimum number of times Takahashi will press the buttons.\n\nConstraints\n\nAll input values are integers.\n\n1 ≦ N ≦ 10^5\n\n0 ≦ A_i ≦ 10^9(1 ≦ i ≦ N)\n\n1 ≦ B_i ≦ 10^9(1 ≦ i ≦ N)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint an integer representing the minimum number of times Takahashi will press the buttons.\n\nSample Input 1\n\n3\n3 5\n2 7\n9 4\n\nSample Output 1\n\n7\n\nPress the first button twice, the second button twice and the third button three times.\n\nSample Input 2\n\n7\n3 1\n4 1\n5 9\n2 6\n5 3\n5 8\n9 7\n\nSample Output 2\n\n22", "sample_input": "3\n3 5\n2 7\n9 4\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03821", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are an integer sequence A_1,...,A_N consisting of N terms, and N buttons.\nWhen the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1.\n\nThere is also another integer sequence B_1,...,B_N. Takahashi will push the buttons some number of times so that for every i, A_i will be a multiple of B_i.\n\nFind the minimum number of times Takahashi will press the buttons.\n\nConstraints\n\nAll input values are integers.\n\n1 ≦ N ≦ 10^5\n\n0 ≦ A_i ≦ 10^9(1 ≦ i ≦ N)\n\n1 ≦ B_i ≦ 10^9(1 ≦ i ≦ N)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint an integer representing the minimum number of times Takahashi will press the buttons.\n\nSample Input 1\n\n3\n3 5\n2 7\n9 4\n\nSample Output 1\n\n7\n\nPress the first button twice, the second button twice and the third button three times.\n\nSample Input 2\n\n7\n3 1\n4 1\n5 9\n2 6\n5 3\n5 8\n9 7\n\nSample Output 2\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 264, "cpu_time_ms": 46, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s397753457", "group_id": "codeNet:p03822", "input_text": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,now:array[0..500007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[lx+random(rx-lx+1)];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..500007] of longint;\nbegin\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485143234, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s397753457.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s397753457", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,now:array[0..500007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[lx+random(rx-lx+1)];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..500007] of longint;\nbegin\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(jm) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..300007] of longint;\nbegin\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485142848, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s902120676.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s902120676", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,t,now:array[0..300007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[lx+random(rx-lx+1)];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..300007] of longint;\nbegin\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(jans) then ans:=depth[u]+t[u];\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then dfs(v,u);\n\tq:=pre[q];\n end;\nend;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n inc(tot);\n insert(i,a[i]);insert(a[i],i);\n end;\n ans:=0;\n dfs(1,0);\n writeln(ans-1);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485138361, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s048952293.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s048952293", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot,ans:longint;\n a,t,f:array[0..100007] of longint;\n\tlast,pre,other,depth:array[0..300007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure dfs(u,father:longint);\nvar q,v:longint;\nbegin\n depth[u]:=depth[father]+1;\n if (depth[u]+t[u]>ans) then ans:=depth[u]+t[u];\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then dfs(v,u);\n\tq:=pre[q];\n end;\nend;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n inc(tot);\n insert(i,a[i]);insert(a[i],i);\n end;\n ans:=0;\n dfs(1,0);\n writeln(ans-1);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(j1000 then \n\t\t\tbreak;\n\t\t\tvis[prime[j]*i]:=false;\n\t\t\tif i mod prime[j]=0 then \n\t\t\tbreak;\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif vis[i] then \n\t\tbegin \n\t\t\tfor j:=1 to tot do \n\t\t\tbegin \n\t\t\t\tif prime[j]=i then \n\t\t\t\tbreak;\n\t\t\tend;\n\t\t\tif prime[j]=i then\n\t\t\tinc(sum[j]);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tstep:=1;\n\t\t\tk:=i;\n\t\t\twhile k>=prime[step] do \n\t\t\tbegin \n\t\t\t\tif k mod prime[step]=0 then \n\t\t\t\tbegin \n\t\t\t\t\tinc(sum[step]);\n\t\t\t\t\tk:=k div prime[step];\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tinc(step);\n\t\t\tend;\n\t\tend;\n\tend;\n\tans:=1;\n\tfor i:=1 to tot do\n\tbegin \n\t\tif sum[i]>0 then \n\t\tans:=(ans*(sum[i]+1)) mod 1000000007;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509831032, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03830.html", "problem_id": "p03830", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03830/input.txt", "sample_output_relpath": "derived/input_output/data/p03830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03830/Pascal/s309704609.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309704609", "user_id": "u816631826"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j,k,step,tot:longint;\n\tans:int64;\n\tvis:array[1..1000] of boolean;\n\tprime,sum:array[1..500] of longint;\nbegin\n\tfillchar(sum,sizeof(sum),0);\n\tfillchar(vis,sizeof(vis),true);\n\treadln(n);\n\ttot:=0;\n\tfor i:=2 to n do \n\tbegin \n\t\tif vis[i] then \n\t\tbegin \n\t\t\tinc(tot);\n\t\t\tprime[tot]:=i;\n\t\tend;\n\t\tfor j:=1 to tot do \n\t\tbegin \n\t\t\tif prime[j]*i>1000 then \n\t\t\tbreak;\n\t\t\tvis[prime[j]*i]:=false;\n\t\t\tif i mod prime[j]=0 then \n\t\t\tbreak;\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif vis[i] then \n\t\tbegin \n\t\t\tfor j:=1 to tot do \n\t\t\tbegin \n\t\t\t\tif prime[j]=i then \n\t\t\t\tbreak;\n\t\t\tend;\n\t\t\tif prime[j]=i then\n\t\t\tinc(sum[j]);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tstep:=1;\n\t\t\tk:=i;\n\t\t\twhile k>=prime[step] do \n\t\t\tbegin \n\t\t\t\tif k mod prime[step]=0 then \n\t\t\t\tbegin \n\t\t\t\t\tinc(sum[step]);\n\t\t\t\t\tk:=k div prime[step];\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tinc(step);\n\t\t\tend;\n\t\tend;\n\tend;\n\tans:=1;\n\tfor i:=1 to tot do\n\tbegin \n\t\tif sum[i]>0 then \n\t\tans:=(ans*(sum[i]+1)) mod 1000000007;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\nFind the number of the positive divisors of N!, modulo 10^9+7.\n\nConstraints\n\n1≤N≤10^3\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the positive divisors of N!, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n4\n\nThere are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n30\n\nSample Input 3\n\n1000\n\nSample Output 3\n\n972926972", "sample_input": "3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03830", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\nFind the number of the positive divisors of N!, modulo 10^9+7.\n\nConstraints\n\n1≤N≤10^3\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the positive divisors of N!, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n4\n\nThere are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n30\n\nSample Input 3\n\n1000\n\nSample Output 3\n\n972926972", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 977, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s983264056", "group_id": "codeNet:p03831", "input_text": "var n,a,b,x,i,p,t,s:integer;\nbegin\n read(n,a,b,t);\n s:=0;\n for i:=2 to n do begin\n read(x);\n\tp:=(x-t)*a;\n\tif b

0 then my:=d else my:=0;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(s[i]);\n\ta[1]:=s[1];\n\tb[1]:=my(s[1]);\n\tfor i:=2 to N do begin\n\t\ta[i]:=s[i]+a[i-1];\n\t\tb[i]:=my(s[i])+b[i-1];\n\tend;\n\tans:=0;\n\tfor i:=0 to N-K do begin\n\t\tsum:=my(a[i+K]-a[i]);\n\t\tinc(sum,b[i]-b[0]+b[N]-b[i+K]);\n\t\tif ans0 then my:=d else my:=0;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(s[i]);\n\ta[1]:=s[1];\n\tb[1]:=my(s[1]);\n\tfor i:=2 to N do begin\n\t\ta[i]:=s[i]+a[i-1];\n\t\tb[i]:=my(s[i])+b[i-1];\n\tend;\n\tans:=0;\n\tfor i:=0 to N-K do begin\n\t\tsum:=my(a[i+K]-a[i]);\n\t\tinc(sum,b[i]-b[0]+b[N]-b[i+K]);\n\t\tif ans=n then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\t\tinc(vis[a[i]]);\n\t\tif (a[i]=0) and (vis[0]>=2) then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\tend; \n\tans:=1;\n\tfor i:=0 to n-1 do \n\tbegin \n\t\tif vis[i]=2 then \n\t\tans:=(ans*2) mod 1000000007\n\t\telse\n\t\tbegin \n\t\t\tif (vis[i]=1) and (i>0) then \n\t\t\tbegin \n\t\t\t\twriteln(0);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509835976, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03846.html", "problem_id": "p03846", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03846/input.txt", "sample_output_relpath": "derived/input_output/data/p03846/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03846/Pascal/s321416391.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s321416391", "user_id": "u018679195"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j:longint;\n\tans:int64;\n\ta:array[1..100001] of longint;\n\tvis:array[0..100001] of longint;\nbegin \n\tfillchar(vis,sizeof(vis),0);\n\treadln(n);\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\tif a[i]>=n then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\t\tinc(vis[a[i]]);\n\t\tif (a[i]=0) and (vis[0]>=2) then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\tend; \n\tans:=1;\n\tfor i:=0 to n-1 do \n\tbegin \n\t\tif vis[i]=2 then \n\t\tans:=(ans*2) mod 1000000007\n\t\telse\n\t\tbegin \n\t\t\tif (vis[i]=1) and (i>0) then \n\t\t\tbegin \n\t\t\t\twriteln(0);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "sample_input": "5\n2 4 4 0 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03846", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 580, "cpu_time_ms": 12, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s720251260", "group_id": "codeNet:p03846", "input_text": "program ec12;\nvar \n\tn,m,i,j:longint;\n\tans:int64;\n\ta:array[1..100001] of longint;\n\tvis:array[0..100001] of longint;\nbegin \n\tfillchar(vis,sizeof(vis),0);\n\treadln(n);\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\tif a[i]>=n then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\t\tinc(vis[a[i]]);\n\t\tif (a[i]=0) and (vis[0]>=2) then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\tend; \n\tans:=1;\n\tfor i:=0 to n-1 do \n\tbegin \n\t\tif vis[i]=2 then \n\t\tans:=(ans*2) mod 1000000007\n\t\telse\n\t\tbegin \n\t\t\tif (vis[i]=1) and (i>0) then \n\t\t\tbegin \n\t\t\t\twriteln(0);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509835956, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03846.html", "problem_id": "p03846", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03846/input.txt", "sample_output_relpath": "derived/input_output/data/p03846/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03846/Pascal/s720251260.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s720251260", "user_id": "u662099472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j:longint;\n\tans:int64;\n\ta:array[1..100001] of longint;\n\tvis:array[0..100001] of longint;\nbegin \n\tfillchar(vis,sizeof(vis),0);\n\treadln(n);\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\tif a[i]>=n then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\t\tinc(vis[a[i]]);\n\t\tif (a[i]=0) and (vis[0]>=2) then \n\t\tbegin \n\t\t\twriteln(0);\n\t\t\thalt;\n\t\tend;\n\tend; \n\tans:=1;\n\tfor i:=0 to n-1 do \n\tbegin \n\t\tif vis[i]=2 then \n\t\tans:=(ans*2) mod 1000000007\n\t\telse\n\t\tbegin \n\t\t\tif (vis[i]=1) and (i>0) then \n\t\t\tbegin \n\t\t\t\twriteln(0);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "sample_input": "5\n2 4 4 0 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03846", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 580, "cpu_time_ms": 12, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s979173695", "group_id": "codeNet:p03848", "input_text": "var\ni,N,x,T:Longint;\nA:Array[0..100000]of Longint;\nbegin\nread(N);\nfor i:=1 to N do begin read(x);inc(A[x]);end;\nif N mod 2=1 then if A[0]=1 then T:=1 else T:=0 else T:=1;\ni:=N mod 2+1;\nwhile iy then\n if size[x]y then\n if size[x]y then\n if size[x]y then\n if size[x]y then\n if size[x]y then\n if size[x]x then\n begin\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+2]-(z-a[i+1]);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=a[i+1]+a[i]-x;\n if a[i+1]-y<=0 then\n begin\n a[i]:=a[i]-(y-a[i+1]);\n a[i+1]:=0;\n end\n else\n a[i+1]:=a[i+1]-y;\n ans:=ans+y;\n end;\n end;\n end;\n // for i:=1 to n do\n // write(a[i],' ');\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1502317476, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s447234899.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s447234899", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,x,y,z,i,j,k,ans:longint;\na:array[1..1000000]of longint;\nbegin\n readln(n,x);\n for i:=1 to n do\n begin\n read(a[i]);\n end;\n for i:=1 to n-1 do\n begin\n // writeln(i);\n if a[i]+a[i+1]>x then\n begin\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+2]-(z-a[i+1]);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=a[i+1]+a[i]-x;\n if a[i+1]-y<=0 then\n begin\n a[i]:=a[i]-(y-a[i+1]);\n a[i+1]:=0;\n end\n else\n a[i+1]:=a[i+1]-y;\n ans:=ans+y;\n end;\n end;\n end;\n // for i:=1 to n do\n // write(a[i],' ');\n writeln(ans);\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1622, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s586829169", "group_id": "codeNet:p03862", "input_text": "var n,x,y,z,i,j,k,ans:longint;\na:array[1..1000000]of longint;\nbegin\n readln(n,x);\n for i:=1 to n do\n begin\n read(a[i]);\n end;\n for i:=1 to n-1 do\n begin\n // writeln(i);\n if a[i]+a[i+1]>x then\n begin\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(z-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=a[i+1]+a[i]-x;\n if a[i+1]-y<=0 then\n a[i]:=a[i]-(a[i+1]-y);\n\n a[i+1]:=a[i+1]-y;\n ans:=ans+y;\n end;\n end;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1502316564, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s586829169.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s586829169", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,x,y,z,i,j,k,ans:longint;\na:array[1..1000000]of longint;\nbegin\n readln(n,x);\n for i:=1 to n do\n begin\n read(a[i]);\n end;\n for i:=1 to n-1 do\n begin\n // writeln(i);\n if a[i]+a[i+1]>x then\n begin\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(z-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=a[i+1]+a[i]-x;\n if a[i+1]-y<=0 then\n a[i]:=a[i]-(a[i+1]-y);\n\n a[i+1]:=a[i+1]-y;\n ans:=ans+y;\n end;\n end;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1474, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s540806060", "group_id": "codeNet:p03862", "input_text": "var n,x,i,j,sum,sum2:longint;\n o:array[1..100000]of longint;\n o2:array[1..100000]of longint;\nbegin\nreadln(n,x);\nread(o[1]);\no2[1]:=o[1];\nfor i:=2 to n do\nbegin\n read(o[i]);\n o2[i]:=o[i];\n if o[i]+o[i-1]>x then\n begin\n sum:=sum+o[i]+o[i-1]-x;\n o[i]:=o[i]-(o[i]+o[i-1]-x);\n if o[i]<0 then\n begin\n o[i-1]:=o[i-1]+o[i];\n o[i]:=0;\n end;\n end;\nend;\nfor j:=n downto 2 do\nbegin\n if o2[j]+o2[j-1]>x then\n begin\n sum2:=sum2+o2[j]+o2[j-1]-x;\n o2[j-1]:=o2[j-1]-(o2[j]+o2[j-1]-x);\n if o2[j-1]<0 then\n begin\n o2[j]:=o2[j]+o2[j-1];\n o2[j-1]:=0;\n end;\n end;\nend;\nif sumx then\n begin\n sum:=sum+o[i]+o[i-1]-x;\n o[i]:=o[i]-(o[i]+o[i-1]-x);\n if o[i]<0 then\n begin\n o[i-1]:=o[i-1]+o[i];\n o[i]:=0;\n end;\n end;\nend;\nfor j:=n downto 2 do\nbegin\n if o2[j]+o2[j-1]>x then\n begin\n sum2:=sum2+o2[j]+o2[j-1]-x;\n o2[j-1]:=o2[j-1]-(o2[j]+o2[j-1]-x);\n if o2[j-1]<0 then\n begin\n o2[j]:=o2[j]+o2[j-1];\n o2[j-1]:=0;\n end;\n end;\nend;\nif sumx then\n begin\n sum:=sum+o[i]+o[i-1]-x;\n o[i]:=o[i]-(o[i]+o[i-1]-x);\n if o[i]<0 then\n begin\n o[i-1]:=o[i-1]+o[i];\n o[i]:=0;\n end;\n end;\nend;\nfor j:=n downto 2 do\nbegin\n if o2[j]+o2[j-1]>x then\n begin\n sum2:=sum2+o2[j]+o2[j-1]-x;\n o2[j-1]:=o2[j-1]-(o2[j]+o2[j-1]-x);\n if o2[j-1]<0 then\n begin\n o2[j]:=o2[j]+o2[j-1];\n o2[j-1]:=0;\n end;\n end;\nend;\nfor i:=1 to n do\nwrite(o[i],' ');\nwriteln();\nfor j:=1 to n do\nwrite(o2[i],' ');\nwriteln();\nif sumx then\n begin\n sum:=sum+o[i]+o[i-1]-x;\n o[i]:=o[i]-(o[i]+o[i-1]-x);\n if o[i]<0 then\n begin\n o[i-1]:=o[i-1]+o[i];\n o[i]:=0;\n end;\n end;\nend;\nfor j:=n downto 2 do\nbegin\n if o2[j]+o2[j-1]>x then\n begin\n sum2:=sum2+o2[j]+o2[j-1]-x;\n o2[j-1]:=o2[j-1]-(o2[j]+o2[j-1]-x);\n if o2[j-1]<0 then\n begin\n o2[j]:=o2[j]+o2[j-1];\n o2[j-1]:=0;\n end;\n end;\nend;\nfor i:=1 to n do\nwrite(o[i],' ');\nwriteln();\nfor j:=1 to n do\nwrite(o2[i],' ');\nwriteln();\nif sumj then\n begin\n if cc[b]>j then\n begin\n sum:=sum+(cc[b]-j);\n cc[b]:=cc[b]-(cc[b]-j) ;\n end;\n if cc[b]+cc[b+1]>j then\n begin\n k:=cc[b]+cc[b+1];\n if k-cc[b+1]<=j then\n begin\n sum:=sum+(k-j);\n cc[b+1]:=cc[b+1]-(k-j);\n end\n else if k-cc[b+1]>j then\n begin\n sum:=sum+cc[b+1];\n k:=k-cc[b+1];\n cc[b+1]:=0;\n sum:=sum+(k-j);\n end;\n{ if cc[b+1]-j>=0 then\n begin\n sum:=sum+(cc[b+1]-j);\n writeln('hey',sum);\n cc[b+1]:=j;\n end\n else\n begin\n\n sum:=sum+cc[b+1];\n j:=j-cc[b+1];\n cc[b+1]:=0;\n sum:=sum+j;\n cc[b]:=cc[b]-j;\n\n end; }\n end;\n// writeln(sum);\n end;\n end;\n writeln(sum);\nend.\n", "language": "Pascal", "metadata": {"date": 1502315504, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s179752204.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s179752204", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var cc : array [0..100000] of int64 ;\n n,a,b,c,d,e,f,g : longint;\n h,i,j,k,x,sum : int64 ;\nbegin\n readln(n,x);\n// writeln(sum,cc[1]:2,cc[2]:2,cc[3]:2);\n for a:=1 to n do\n read(cc[a]);\n// writeln(sum,cc[1]:2,cc[2]:2,cc[3]:2);\n for b:=1 to n-1 do\n begin\n// writeln(j,sum:2,cc[1]:2,cc[2]:2,cc[3]:2);\n j:=x;\n if cc[b]+cc[b+1]>j then\n begin\n if cc[b]>j then\n begin\n sum:=sum+(cc[b]-j);\n cc[b]:=cc[b]-(cc[b]-j) ;\n end;\n if cc[b]+cc[b+1]>j then\n begin\n k:=cc[b]+cc[b+1];\n if k-cc[b+1]<=j then\n begin\n sum:=sum+(k-j);\n cc[b+1]:=cc[b+1]-(k-j);\n end\n else if k-cc[b+1]>j then\n begin\n sum:=sum+cc[b+1];\n k:=k-cc[b+1];\n cc[b+1]:=0;\n sum:=sum+(k-j);\n end;\n{ if cc[b+1]-j>=0 then\n begin\n sum:=sum+(cc[b+1]-j);\n writeln('hey',sum);\n cc[b+1]:=j;\n end\n else\n begin\n\n sum:=sum+cc[b+1];\n j:=j-cc[b+1];\n cc[b+1]:=0;\n sum:=sum+j;\n cc[b]:=cc[b]-j;\n\n end; }\n end;\n// writeln(sum);\n end;\n end;\n writeln(sum);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1071, "cpu_time_ms": 17, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s886094986", "group_id": "codeNet:p03862", "input_text": "var\nn,i:longint;\nx,o:int64;\na:array [0..100001] of int64;\nbegin\nreadln(n,x);\nfor i := 1 to n do\nbegin\nread(a[i]);\nif a[i]>x then\nbegin\no:=o+(a[i]-x);\na[i]:=x;\nend;\nend;\nfor i := 1 to n-1 do\nbegin\nif a[i]+a[i+1]>x then\nbegin\no:=o+(a[i]+a[i+1]-x);\na[i+1]:=x-a[i];\nend;\nend;\nwriteln(o);\nend.\n", "language": "Pascal", "metadata": {"date": 1502311278, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s886094986.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s886094986", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\nn,i:longint;\nx,o:int64;\na:array [0..100001] of int64;\nbegin\nreadln(n,x);\nfor i := 1 to n do\nbegin\nread(a[i]);\nif a[i]>x then\nbegin\no:=o+(a[i]-x);\na[i]:=x;\nend;\nend;\nfor i := 1 to n-1 do\nbegin\nif a[i]+a[i+1]>x then\nbegin\no:=o+(a[i]+a[i+1]-x);\na[i+1]:=x-a[i];\nend;\nend;\nwriteln(o);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 289, "cpu_time_ms": 17, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s143813204", "group_id": "codeNet:p03863", "input_text": "var\n n:string;\nbegin\n readln(n);\n if n[1]=n[length(n)] then\n begin\n if odd(length(n)) then writeln('Second')\n else writeln('First');\n end\n else\n begin\n if odd(length(n)) then writeln('First')\n else writeln('Second');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1588816770, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s143813204.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s143813204", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n n:string;\nbegin\n readln(n);\n if n[1]=n[length(n)] then\n begin\n if odd(length(n)) then writeln('Second')\n else writeln('First');\n end\n else\n begin\n if odd(length(n)) then writeln('First')\n else writeln('Second');\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 276, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s233480761", "group_id": "codeNet:p03863", "input_text": "var\n s:string;\nbegin\n if s[1]=s[length(s)] then\n begin\n if length(s) mod 2=1 then writeln('Second')\n else writeln('First');\n end\n else\n begin\n if length(s) mod 2=0 then writeln('Second')\n else writeln('First');\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1552353050, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s233480761.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s233480761", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n s:string;\nbegin\n if s[1]=s[length(s)] then\n begin\n if length(s) mod 2=1 then writeln('Second')\n else writeln('First');\n end\n else\n begin\n if length(s) mod 2=0 then writeln('Second')\n else writeln('First');\n end;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 331, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s339792325", "group_id": "codeNet:p03863", "input_text": "var\n st:string;\nbegin\n readln(st);\n if st[1]=st[length(st)] then\n begin\n if odd(length(st)) then writeln('Second')\n else writeln('First');\n end\n else \n begin\n if not(odd(length(st))) then writeln('Second')\n else writeln('First');\n end\nend.", "language": "Pascal", "metadata": {"date": 1551037865, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s339792325.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s339792325", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n st:string;\nbegin\n readln(st);\n if st[1]=st[length(st)] then\n begin\n if odd(length(st)) then writeln('Second')\n else writeln('First');\n end\n else \n begin\n if not(odd(length(st))) then writeln('Second')\n else writeln('First');\n end\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s922386425", "group_id": "codeNet:p03863", "input_text": "var\n st:string;\nbegin\n readln(st);\n if st[1]=st[length(st)] then\n begin\n if odd(length(st)) then writeln('Second')\n else writeln('first');\n end\n else \n begin\n if not(odd(length(st))) then writeln('Second')\n else writeln('first');\n end\nend.", "language": "Pascal", "metadata": {"date": 1551037208, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s922386425.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s922386425", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n st:string;\nbegin\n readln(st);\n if st[1]=st[length(st)] then\n begin\n if odd(length(st)) then writeln('Second')\n else writeln('first');\n end\n else \n begin\n if not(odd(length(st))) then writeln('Second')\n else writeln('first');\n end\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s465696245", "group_id": "codeNet:p03863", "input_text": "var\n st:string;\nbegin\n readln(st);\n if st[1]=st[length(st)] then\n begin\n if odd(length(st)) then writeln('Second')\n else writeln('first');\n end\n else \n begin\n if not(odd(length(st))) then writeln('Second')\n else writeln('first');\n end\nend.", "language": "Pascal", "metadata": {"date": 1551037058, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s465696245.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s465696245", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n st:string;\nbegin\n readln(st);\n if st[1]=st[length(st)] then\n begin\n if odd(length(st)) then writeln('Second')\n else writeln('first');\n end\n else \n begin\n if not(odd(length(st))) then writeln('Second')\n else writeln('first');\n end\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s696738239", "group_id": "codeNet:p03863", "input_text": "var\n s:ansistring;\nbegin\n read(s);\n if (s[1]='a') or (s[length(s)]='a') then writeln('First')\n else writeln('Second');\n end.", "language": "Pascal", "metadata": {"date": 1539214470, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s696738239.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s696738239", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n s:ansistring;\nbegin\n read(s);\n if (s[1]='a') or (s[length(s)]='a') then writeln('First')\n else writeln('Second');\n end.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 124, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s682389151", "group_id": "codeNet:p03864", "input_text": "var\n\tn,i,x:Longint;\n\tans,a,b:int64;\nbegin\n\tread(n,x,a);\n\tif a>x then begin\n\t\tans:=a-x;\n\t\ta:=x;\n\tend;\n\tfor i:=2 to n do begin\n\t\tread(b);\n\t\tif a+b>x then begin\n\t\t\tinc(ans,a+b-x);\n\t\t\tdec(b,a+b-x);\n\t\tend;\n\t\ta:=b;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1538023242, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03864.html", "problem_id": "p03864", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03864/input.txt", "sample_output_relpath": "derived/input_output/data/p03864/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03864/Pascal/s682389151.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s682389151", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tn,i,x:Longint;\n\tans,a,b:int64;\nbegin\n\tread(n,x,a);\n\tif a>x then begin\n\t\tans:=a-x;\n\t\ta:=x;\n\tend;\n\tfor i:=2 to n do begin\n\t\tread(b);\n\t\tif a+b>x then begin\n\t\t\tinc(ans,a+b-x);\n\t\t\tdec(b,a+b-x);\n\t\tend;\n\t\ta:=b;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03864", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 18, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s290976748", "group_id": "codeNet:p03864", "input_text": "var\n\tn,i,x:Longint;\n\tans,a,b:int64;\nbegin\n\tread(n,x,a);\n\tif a>x then begin\n\t\tans:=x-a;\n\t\ta:=x;\n\tend;\n\tfor i:=2 to n do begin\n\t\tread(b);\n\t\tif a+b>x then begin\n\t\t\tinc(ans,a+b-x);\n\t\t\tdec(b,a+b-x);\n\t\tend;\n\t\ta:=b;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1538023173, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03864.html", "problem_id": "p03864", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03864/input.txt", "sample_output_relpath": "derived/input_output/data/p03864/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03864/Pascal/s290976748.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s290976748", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tn,i,x:Longint;\n\tans,a,b:int64;\nbegin\n\tread(n,x,a);\n\tif a>x then begin\n\t\tans:=x-a;\n\t\ta:=x;\n\tend;\n\tfor i:=2 to n do begin\n\t\tread(b);\n\t\tif a+b>x then begin\n\t\t\tinc(ans,a+b-x);\n\t\t\tdec(b,a+b-x);\n\t\tend;\n\t\ta:=b;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03864", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 17, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s572574437", "group_id": "codeNet:p03864", "input_text": "program C;\n var N,x,i:longint;\n var a:array [1..120000] of longint;\n var u,v,ans:longint;\nbegin\n readln(N,x);ans:=0;\n for i:=1 to N do read(a[i]);\n for i:=2 to N do\n begin\n u:=a[i-1];v:=a[i];\n if u+v>x then\n begin\n if v>=u+v-x then a[i]:=x-u\n else\n begin\n a[i]:=0;\n a[i-1]:=x;\n end; \n ans:=ans+u+v-x;\n end; \n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1480905137, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03864.html", "problem_id": "p03864", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03864/input.txt", "sample_output_relpath": "derived/input_output/data/p03864/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03864/Pascal/s572574437.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s572574437", "user_id": "u566971318"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program C;\n var N,x,i:longint;\n var a:array [1..120000] of longint;\n var u,v,ans:longint;\nbegin\n readln(N,x);ans:=0;\n for i:=1 to N do read(a[i]);\n for i:=2 to N do\n begin\n u:=a[i-1];v:=a[i];\n if u+v>x then\n begin\n if v>=u+v-x then a[i]:=x-u\n else\n begin\n a[i]:=0;\n a[i-1]:=x;\n end; \n ans:=ans+u+v-x;\n end; \n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03864", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 476, "cpu_time_ms": 23, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s222640928", "group_id": "codeNet:p03865", "input_text": "var s:string;n:Longint;\nbegin\nreadln(s);\nn:=length(s);\nif(n mod 2=1)xor(s[1]=s[n])then writeln('Second')else writeln('First');\nend.", "language": "Pascal", "metadata": {"date": 1572482119, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03865.html", "problem_id": "p03865", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03865/input.txt", "sample_output_relpath": "derived/input_output/data/p03865/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03865/Pascal/s222640928.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s222640928", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var s:string;n:Longint;\nbegin\nreadln(s);\nn:=length(s);\nif(n mod 2=1)xor(s[1]=s[n])then writeln('Second')else writeln('First');\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03865", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s908038424", "group_id": "codeNet:p03889", "input_text": "var\n i:longint;\n s,c:ansistring;\n t:char;\nbegin\n readln(s);\n c:=s;\n for i:=1 to length(c) div 2 do\n begin\n t:=c[i];\n c[i]:=c[length(c)-i+1];\n c[length(c)-i+1]:=t;\n end;\n for i:=1 to length(c) do\n begin\n if c[i]='b' then begin c[i]:='d';continue; end;\n if c[i]='d' then begin c[i]:='b';continue; end;\n if c[i]='p' then begin c[i]:='q';continue; end;\n if c[i]='q' then begin c[i]:='p';continue; end;\n end;\n if s=c then writeln('Yes')\n else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1558663835, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s908038424.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s908038424", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n i:longint;\n s,c:ansistring;\n t:char;\nbegin\n readln(s);\n c:=s;\n for i:=1 to length(c) div 2 do\n begin\n t:=c[i];\n c[i]:=c[length(c)-i+1];\n c[length(c)-i+1]:=t;\n end;\n for i:=1 to length(c) do\n begin\n if c[i]='b' then begin c[i]:='d';continue; end;\n if c[i]='d' then begin c[i]:='b';continue; end;\n if c[i]='p' then begin c[i]:='q';continue; end;\n if c[i]='q' then begin c[i]:='p';continue; end;\n end;\n if s=c then writeln('Yes')\n else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 509, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s759496435", "group_id": "codeNet:p03889", "input_text": "var\n i:longint;\n s,c:ansistring;\n t:char;\nbegin\n readln(s);\n c:=s;\n for i:=1 to length(c) div 2 do\n begin\n t:=c[i];\n c[i]:=c[length(c)-i+1];\n c[length(c)-i+1]:=t;\n end;\n for i:=1 to length(c) do\n begin\n if c[i]='b' then begin c[i]:='d';continue; end;\n if c[i]='d' then begin c[i]:='b';continue; end;\n if c[i]='p' then begin c[i]:='q';continue; end;\n if c[i]='q' then begin c[i]:='p';continue; end;\n end;\n if s=c then writeln('Yes')\n else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1558398282, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s759496435.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s759496435", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n i:longint;\n s,c:ansistring;\n t:char;\nbegin\n readln(s);\n c:=s;\n for i:=1 to length(c) div 2 do\n begin\n t:=c[i];\n c[i]:=c[length(c)-i+1];\n c[length(c)-i+1]:=t;\n end;\n for i:=1 to length(c) do\n begin\n if c[i]='b' then begin c[i]:='d';continue; end;\n if c[i]='d' then begin c[i]:='b';continue; end;\n if c[i]='p' then begin c[i]:='q';continue; end;\n if c[i]='q' then begin c[i]:='p';continue; end;\n end;\n if s=c then writeln('Yes')\n else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 509, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s892670026", "group_id": "codeNet:p03889", "input_text": "var i,n:longint;\n a,b:ansistring;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do b:=a[i]+b;\n for i:=1 to n do\n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1553455318, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s892670026.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s892670026", "user_id": "u426964396"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,n:longint;\n a,b:ansistring;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do b:=a[i]+b;\n for i:=1 to n do\n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 276, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s676264940", "group_id": "codeNet:p03889", "input_text": "var i,n:longint;\n a,b:string;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do b[n-i+1]:=a[i];\n for i:=1 to n do\n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1553455013, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s676264940.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s676264940", "user_id": "u723721005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,n:longint;\n a,b:string;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do b[n-i+1]:=a[i];\n for i:=1 to n do\n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 293, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s416870110", "group_id": "codeNet:p03889", "input_text": "var s,s1:string;\n i,len:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n case s[i] of\n 'b':s1:='d'+s1;\n 'd':s1:='b'+s1;\n 'p':s1:='q'+s1;\n 'q':s1:='p'+s1;\n end;\n if (s=s1) then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1553449816, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s416870110.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s416870110", "user_id": "u723721005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s,s1:string;\n i,len:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n case s[i] of\n 'b':s1:='d'+s1;\n 'd':s1:='b'+s1;\n 'p':s1:='q'+s1;\n 'q':s1:='p'+s1;\n end;\n if (s=s1) then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 270, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s681177026", "group_id": "codeNet:p03889", "input_text": "var s,st:ansistring;\n len,i:longint;\n t:char;\nbegin\n readln(s); st:=s;\n len:=length(s);\n if (len mod 2=1) then begin writeln('No');exit;end;\n for i:=1 to len div 2 do\n begin\n t:=s[i];s[i]:=s[len-i+1];s[len-i+1]:=t;\n end;\n for i:=1 to len do\n begin\n if s[i]='b' then s[i]:='d' else\n if s[i]='d' then s[i]:='b' else\n if s[i]='p' then s[i]:='q' else\n s[i]:='p';\n end;\n if s=st then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1552158708, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s681177026.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s681177026", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s,st:ansistring;\n len,i:longint;\n t:char;\nbegin\n readln(s); st:=s;\n len:=length(s);\n if (len mod 2=1) then begin writeln('No');exit;end;\n for i:=1 to len div 2 do\n begin\n t:=s[i];s[i]:=s[len-i+1];s[len-i+1]:=t;\n end;\n for i:=1 to len do\n begin\n if s[i]='b' then s[i]:='d' else\n if s[i]='d' then s[i]:='b' else\n if s[i]='p' then s[i]:='q' else\n s[i]:='p';\n end;\n if s=st then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 448, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s409231523", "group_id": "codeNet:p03889", "input_text": "var s,st:ansistring;\n len,i:longint;\n t:char;\nbegin\n readln(s); st:=s;\n len:=length(s);\n if (len mod 2=1) then begin writeln(1);exit;end;\n for i:=1 to len div 2 do\n begin\n t:=s[i];s[i]:=s[len-i+1];s[len-i+1]:=t;\n end;\n for i:=1 to len do\n begin\n if s[i]='b' then s[i]:='d' else\n if s[i]='d' then s[i]:='b' else\n if s[i]='p' then s[i]:='q' else\n s[i]:='p';\n end;\n if s=st then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1552158626, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s409231523.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s409231523", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s,st:ansistring;\n len,i:longint;\n t:char;\nbegin\n readln(s); st:=s;\n len:=length(s);\n if (len mod 2=1) then begin writeln(1);exit;end;\n for i:=1 to len div 2 do\n begin\n t:=s[i];s[i]:=s[len-i+1];s[len-i+1]:=t;\n end;\n for i:=1 to len do\n begin\n if s[i]='b' then s[i]:='d' else\n if s[i]='d' then s[i]:='b' else\n if s[i]='p' then s[i]:='q' else\n s[i]:='p';\n end;\n if s=st then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 445, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s018158676", "group_id": "codeNet:p03889", "input_text": "var i,j,k:longint;\n first,last:string;\n ch:array[char]of char;\nbegin\n readln(first);\n last:=first;\n for i:=1 to length(last) do\n last[i]:=first[length(first)-i+1];\n ch['p']:='q';\n ch['q']:='p';\n ch['b']:='d';\n ch['d']:='b';\n for i:=1 to length(last) do\n last[i]:=ch[last[i]];\n if first=last then write('Yes') else write('No');\nend.", "language": "Pascal", "metadata": {"date": 1550084117, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s018158676.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s018158676", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,j,k:longint;\n first,last:string;\n ch:array[char]of char;\nbegin\n readln(first);\n last:=first;\n for i:=1 to length(last) do\n last[i]:=first[length(first)-i+1];\n ch['p']:='q';\n ch['q']:='p';\n ch['b']:='d';\n ch['d']:='b';\n for i:=1 to length(last) do\n last[i]:=ch[last[i]];\n if first=last then write('Yes') else write('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 348, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s384145216", "group_id": "codeNet:p03889", "input_text": "var\n s,s1,s2:ansistring;\n i,l:longint;\nbegin\n readln(s);\n s2:=s;\n l:=length(s);\n for i:=1 to l do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s2 then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1544070142, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s384145216.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s384145216", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,s1,s2:ansistring;\n i,l:longint;\nbegin\n readln(s);\n s2:=s;\n l:=length(s);\n for i:=1 to l do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s2 then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 778, "cpu_time_ms": 8, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s754802322", "group_id": "codeNet:p03889", "input_text": "var\n s,s1:ansistring;\n i,l:longint;\nbegin\n readln(s);\n l:=length(s);\n for i:=1 to l do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1544070112, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s754802322.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s754802322", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,s1:ansistring;\n i,l:longint;\nbegin\n readln(s);\n l:=length(s);\n for i:=1 to l do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 759, "cpu_time_ms": 8, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s134132354", "group_id": "codeNet:p03889", "input_text": "var\n s,s1:ansistring;\n i,l:longint;\nbegin\n readln(s);\n l:=length(s);\n for i:=1 to l div 2 do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1544070052, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s134132354.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s134132354", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,s1:ansistring;\n i,l:longint;\nbegin\n readln(s);\n l:=length(s);\n for i:=1 to l div 2 do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 765, "cpu_time_ms": 9, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s198793159", "group_id": "codeNet:p03889", "input_text": "var\n s,s1,s2:ansistring;\n i,l:longint;\nbegin\n readln(s);\n l:=length(s);\n for i:=1 to l div 2 do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=1 to l div 2 do s1:=s1+s[i];\n for i:=l downto l div 2+1 do s2:=s2+s[i];\n if s1=s2 then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1544069925, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s198793159.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s198793159", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,s1,s2:ansistring;\n i,l:longint;\nbegin\n readln(s);\n l:=length(s);\n for i:=1 to l div 2 do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='q';\n continue;\n end;\n end;\n for i:=1 to l div 2 do s1:=s1+s[i];\n for i:=l downto l div 2+1 do s2:=s2+s[i];\n if s1=s2 then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 821, "cpu_time_ms": 7, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s316648883", "group_id": "codeNet:p03889", "input_text": "var\n s:ansistring;\n i,j,n,k,m,t:longint;\nbegin\n readln(s);\n k:=length(s);\n if k mod 2<>0 then\n begin\n writeln('No');\n halt;\n end;\n for i:=1 to k div 2+1 do\n begin\n t:=abs(ord(s[i])-ord(s[k-i+1]));\n if (t<>1)and(t<>2) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1540263480, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s316648883.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s316648883", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s:ansistring;\n i,j,n,k,m,t:longint;\nbegin\n readln(s);\n k:=length(s);\n if k mod 2<>0 then\n begin\n writeln('No');\n halt;\n end;\n for i:=1 to k div 2+1 do\n begin\n t:=abs(ord(s[i])-ord(s[k-i+1]));\n if (t<>1)and(t<>2) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 325, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s254586332", "group_id": "codeNet:p03893", "input_text": "var\n n,i:longint;\n a:array[0..100] of qword;\nbegin\n read(n);\n a[0]:=2;\n for i:=1 to n do a[i]:=a[i-1]*2+2;\n writeln(a[n]);\nend.", "language": "Pascal", "metadata": {"date": 1534358261, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03893.html", "problem_id": "p03893", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03893/input.txt", "sample_output_relpath": "derived/input_output/data/p03893/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03893/Pascal/s254586332.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s254586332", "user_id": "u723721005"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "var\n n,i:longint;\n a:array[0..100] of qword;\nbegin\n read(n);\n a[0]:=2;\n for i:=1 to n do a[i]:=a[i-1]*2+2;\n writeln(a[n]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a cord whose length is a positive integer. We will perform the following condition until the length of the cord becomes at most 2:\n\nOperation:\nCut the rope at two positions to obtain three cords, each with a length of a positive integer.\nAmong these, discard one with the longest length and one with the shortest length, and keep the remaining one.\n\nLet f(N) be the maximum possible number of times to perform this operation, starting with a cord with the length N.\n\nYou are given a positive integer X. Find the maximum integer N such that f(N)=X.\n\nConstraints\n\n1 \\leq X \\leq 40\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the value of the maximum integer N such that f(N)=X.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03893", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a cord whose length is a positive integer. We will perform the following condition until the length of the cord becomes at most 2:\n\nOperation:\nCut the rope at two positions to obtain three cords, each with a length of a positive integer.\nAmong these, discard one with the longest length and one with the shortest length, and keep the remaining one.\n\nLet f(N) be the maximum possible number of times to perform this operation, starting with a cord with the length N.\n\nYou are given a positive integer X. Find the maximum integer N such that f(N)=X.\n\nConstraints\n\n1 \\leq X \\leq 40\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the value of the maximum integer N such that f(N)=X.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 127, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s615970249", "group_id": "codeNet:p03893", "input_text": "var a:array[1..41]of qword;\n n,i:longint;\n begin\n readln(n);\n a[1]:=2;\n for i:=2 to n do\n a[i]:=a[i-1]*2+2;\n writeln(a[n+1]);\n end.", "language": "Pascal", "metadata": {"date": 1525185297, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03893.html", "problem_id": "p03893", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03893/input.txt", "sample_output_relpath": "derived/input_output/data/p03893/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03893/Pascal/s615970249.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s615970249", "user_id": "u247366051"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "var a:array[1..41]of qword;\n n,i:longint;\n begin\n readln(n);\n a[1]:=2;\n for i:=2 to n do\n a[i]:=a[i-1]*2+2;\n writeln(a[n+1]);\n end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a cord whose length is a positive integer. We will perform the following condition until the length of the cord becomes at most 2:\n\nOperation:\nCut the rope at two positions to obtain three cords, each with a length of a positive integer.\nAmong these, discard one with the longest length and one with the shortest length, and keep the remaining one.\n\nLet f(N) be the maximum possible number of times to perform this operation, starting with a cord with the length N.\n\nYou are given a positive integer X. Find the maximum integer N such that f(N)=X.\n\nConstraints\n\n1 \\leq X \\leq 40\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the value of the maximum integer N such that f(N)=X.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03893", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a cord whose length is a positive integer. We will perform the following condition until the length of the cord becomes at most 2:\n\nOperation:\nCut the rope at two positions to obtain three cords, each with a length of a positive integer.\nAmong these, discard one with the longest length and one with the shortest length, and keep the remaining one.\n\nLet f(N) be the maximum possible number of times to perform this operation, starting with a cord with the length N.\n\nYou are given a positive integer X. Find the maximum integer N such that f(N)=X.\n\nConstraints\n\n1 \\leq X \\leq 40\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the value of the maximum integer N such that f(N)=X.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s642107668", "group_id": "codeNet:p03896", "input_text": "var\n\tN,i,j:Longint;\n\tA:Array[1..100,1..99]of Longint;\nbegin\n\tread(N);\n\tif N=2 then begin\n\t\twriteln(-1);\n\t\texit;\n\tend;\n\tif N mod 2=1 then begin\n\t\tfor i:=1 to N-1 do A[N,i]:=i;\n\t\ti:=1;\n\t\twhile i<=N-1 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\tend else begin\n\t\ti:=1;\n\t\twhile i<=N-2 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\t\tfor j:=1 to N-3 do begin\n\t\t\tA[N-1,j]:=j;\n\t\t\tA[N,j]:=j;\n\t\tend;\n\t\tA[N-1,N-2]:=N;\n\t\tA[N,N-1]:=N-1;\n\t\tA[N-1,N-1]:=N-2;\n\t\tA[N,N-2]:=N-2;\n\tend;\n\tfor i:=1 to N do begin\n\t\tfor j:=1 to N-1 do begin\n\t\t\twriteln(A[i,j]);\n\t\tend;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1565765867, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03896.html", "problem_id": "p03896", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03896/input.txt", "sample_output_relpath": "derived/input_output/data/p03896/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03896/Pascal/s642107668.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s642107668", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n", "input_to_evaluate": "var\n\tN,i,j:Longint;\n\tA:Array[1..100,1..99]of Longint;\nbegin\n\tread(N);\n\tif N=2 then begin\n\t\twriteln(-1);\n\t\texit;\n\tend;\n\tif N mod 2=1 then begin\n\t\tfor i:=1 to N-1 do A[N,i]:=i;\n\t\ti:=1;\n\t\twhile i<=N-1 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\tend else begin\n\t\ti:=1;\n\t\twhile i<=N-2 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\t\tfor j:=1 to N-3 do begin\n\t\t\tA[N-1,j]:=j;\n\t\t\tA[N,j]:=j;\n\t\tend;\n\t\tA[N-1,N-2]:=N;\n\t\tA[N,N-1]:=N-1;\n\t\tA[N-1,N-1]:=N-2;\n\t\tA[N,N-2]:=N-2;\n\tend;\n\tfor i:=1 to N do begin\n\t\tfor j:=1 to N-1 do begin\n\t\t\twriteln(A[i,j]);\n\t\tend;\n\tend;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.\n\nDuring the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.\n\nIf any two persons look at each other during the challenge, the challenge ends in failure.\n\nFind the order in which each person looks at each of the N-1 other persons, to be successful in the challenge.\n\nConstraints\n\n2 \\leq N \\leq 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there exists no way to be successful in the challenge, print -1.\n\nIf there exists a way to be successful in the challenge, print any such way in the following format:\n\nA_{1,1} A_{1,2} ... A_{1, N-1}\nA_{2,1} A_{2,2} ... A_{2, N-1}\n:\nA_{N,1} A_{N,2} ... A_{N, N-1}\n\nwhere A_{i, j} is the index of the person that the person numbered i looks at during the j-th second.\n\nJudging\n\nThe output is considered correct only if all of the following conditions are satisfied:\n\n1 \\leq A_{i,j} \\leq N\n\nFor each i, A_{i,1}, A_{i,2}, ... , A_{i, N-1} are pairwise distinct.\n\nLet X = A_{i, j}, then A_{X, j} \\neq i always holds.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1", "sample_input": "7\n"}, "reference_outputs": ["2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n"], "source_document_id": "p03896", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.\n\nDuring the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.\n\nIf any two persons look at each other during the challenge, the challenge ends in failure.\n\nFind the order in which each person looks at each of the N-1 other persons, to be successful in the challenge.\n\nConstraints\n\n2 \\leq N \\leq 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there exists no way to be successful in the challenge, print -1.\n\nIf there exists a way to be successful in the challenge, print any such way in the following format:\n\nA_{1,1} A_{1,2} ... A_{1, N-1}\nA_{2,1} A_{2,2} ... A_{2, N-1}\n:\nA_{N,1} A_{N,2} ... A_{N, N-1}\n\nwhere A_{i, j} is the index of the person that the person numbered i looks at during the j-th second.\n\nJudging\n\nThe output is considered correct only if all of the following conditions are satisfied:\n\n1 \\leq A_{i,j} \\leq N\n\nFor each i, A_{i,1}, A_{i,2}, ... , A_{i, N-1} are pairwise distinct.\n\nLet X = A_{i, j}, then A_{X, j} \\neq i always holds.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 948, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s672776264", "group_id": "codeNet:p03909", "input_text": "var\n a,b,c,d,e,ch:char;\n n,m,i,j:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(a,b,c,d,e);\n read(ch);\n if c='u' then\n begin\n writeln(char(64+j),i);\n exit;\n end;\n end;\n readln;\n end;\n writeln('NO');\nend.", "language": "Pascal", "metadata": {"date": 1582218595, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03909.html", "problem_id": "p03909", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03909/input.txt", "sample_output_relpath": "derived/input_output/data/p03909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03909/Pascal/s672776264.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s672776264", "user_id": "u263933075"}, "prompt_components": {"gold_output": "H6\n", "input_to_evaluate": "var\n a,b,c,d,e,ch:char;\n n,m,i,j:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(a,b,c,d,e);\n read(ch);\n if c='u' then\n begin\n writeln(char(64+j),i);\n exit;\n end;\n end;\n readln;\n end;\n writeln('NO');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "sample_input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n"}, "reference_outputs": ["H6\n"], "source_document_id": "p03909", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 351, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s322273026", "group_id": "codeNet:p03909", "input_text": "var\n a,b,c,d,e,ch:char;\n n,m,i,j:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(a,b,c,d,e);\n read(ch);\n if (a='s') and (b='n') and (c='u') and (d='k') and (e='e') then\n begin\n writeln(char(64+j),i);\n exit;\n end;\n end;\n readln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1582218368, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03909.html", "problem_id": "p03909", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03909/input.txt", "sample_output_relpath": "derived/input_output/data/p03909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03909/Pascal/s322273026.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s322273026", "user_id": "u263933075"}, "prompt_components": {"gold_output": "H6\n", "input_to_evaluate": "var\n a,b,c,d,e,ch:char;\n n,m,i,j:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(a,b,c,d,e);\n read(ch);\n if (a='s') and (b='n') and (c='u') and (d='k') and (e='e') then\n begin\n writeln(char(64+j),i);\n exit;\n end;\n end;\n readln;\n end;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "sample_input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n"}, "reference_outputs": ["H6\n"], "source_document_id": "p03909", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 384, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s062907261", "group_id": "codeNet:p03909", "input_text": "var\n a,b,c,d,e,ch:char;\n n,m,i,j:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(a,b,c,d,e);\n read(ch);\n if (a='s') and (b='n') and (c='u') and (d='k') and (e='e') then\n begin\n writeln(char(64+j),i);\n exit;\n end;\n end;\n readln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1582218307, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03909.html", "problem_id": "p03909", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03909/input.txt", "sample_output_relpath": "derived/input_output/data/p03909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03909/Pascal/s062907261.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s062907261", "user_id": "u247366051"}, "prompt_components": {"gold_output": "H6\n", "input_to_evaluate": "var\n a,b,c,d,e,ch:char;\n n,m,i,j:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n read(a,b,c,d,e);\n read(ch);\n if (a='s') and (b='n') and (c='u') and (d='k') and (e='e') then\n begin\n writeln(char(64+j),i);\n exit;\n end;\n end;\n readln;\n end;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "sample_input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n"}, "reference_outputs": ["H6\n"], "source_document_id": "p03909", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 384, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s895745049", "group_id": "codeNet:p03910", "input_text": "var\n a:array[0..10000006] of int64;\n n,s:int64;\n i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n inc(s,i);\n a[i]:=i;\n if s>n then break;\n end;\n s:=s-n;\n for i:=1 to n do if (a[i]<>s) and (a[i]<>0) then writeln(a[i]);\nend.", "language": "Pascal", "metadata": {"date": 1582237748, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03910.html", "problem_id": "p03910", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03910/input.txt", "sample_output_relpath": "derived/input_output/data/p03910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03910/Pascal/s895745049.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s895745049", "user_id": "u263933075"}, "prompt_components": {"gold_output": "1\n3\n", "input_to_evaluate": "var\n a:array[0..10000006] of int64;\n n,s:int64;\n i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n inc(s,i);\n a[i]:=i;\n if s>n then break;\n end;\n s:=s-n;\n for i:=1 to n do if (a[i]<>s) and (a[i]<>0) then writeln(a[i]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "sample_input": "4\n"}, "reference_outputs": ["1\n3\n"], "source_document_id": "p03910", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 11, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s875469145", "group_id": "codeNet:p03920", "input_text": "var i,k,n:longint;\nbegin\nread(n);\nwhile n>0 do begin\ninc(k);\ndec(n,k);\nend;\nfor i:=1 to -n-1 do writeln(i);\nfor i:=1-n to k do writeln(i);\nend.", "language": "Pascal", "metadata": {"date": 1579345867, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03920.html", "problem_id": "p03920", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03920/input.txt", "sample_output_relpath": "derived/input_output/data/p03920/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03920/Pascal/s875469145.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s875469145", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n3\n", "input_to_evaluate": "var i,k,n:longint;\nbegin\nread(n);\nwhile n>0 do begin\ninc(k);\ndec(n,k);\nend;\nfor i:=1 to -n-1 do writeln(i);\nfor i:=1-n to k do writeln(i);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "sample_input": "4\n"}, "reference_outputs": ["1\n3\n"], "source_document_id": "p03920", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s475074453", "group_id": "codeNet:p03920", "input_text": "var i,k,n:longint;\nbegin\nread(n);\nwhile k*(k+1)=2*N do dec(k);\ndec(n,k*(k+1)div 2);\nfor i:=1 to k do if i<>-n then writeln(i);\nend.", "language": "Pascal", "metadata": {"date": 1579345728, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03920.html", "problem_id": "p03920", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03920/input.txt", "sample_output_relpath": "derived/input_output/data/p03920/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03920/Pascal/s624153950.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s624153950", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n3\n", "input_to_evaluate": "var i,k,n:longint;\nbegin\nread(n);\nk:=round(sqrt(2*n));\nwhile k*(k+1)=2*N do dec(k);\ndec(n,k*(k+1)div 2);\nfor i:=1 to k do if i<>-n then writeln(i);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "sample_input": "4\n"}, "reference_outputs": ["1\n3\n"], "source_document_id": "p03920", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 182, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s264096676", "group_id": "codeNet:p03938", "input_text": "var\n\tN,i,a:Longint;\n\tx:int64;\n\tp:Array[1..20000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\twriteln((N+1)*i);\n\t\tread(a);\n\t\tp[a]:=i;\n\tend;\n\tfor i:=1 to N do begin\n\t\tx:=N+1;\n\t\twriteln(x*(N-i)+p[i]);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1579579076, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03938.html", "problem_id": "p03938", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03938/input.txt", "sample_output_relpath": "derived/input_output/data/p03938/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03938/Pascal/s264096676.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s264096676", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 4\n5 4\n", "input_to_evaluate": "var\n\tN,i,a:Longint;\n\tx:int64;\n\tp:Array[1..20000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\twriteln((N+1)*i);\n\t\tread(a);\n\t\tp[a]:=i;\n\tend;\n\tfor i:=1 to N do begin\n\t\tx:=N+1;\n\t\twriteln(x*(N-i)+p[i]);\n\tend;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nYou are given a permutation p of the set {1, 2, ..., N}. Please construct two sequences of positive integers a_1, a_2, ..., a_N and b_1, b_2, ..., b_N satisfying the following conditions:\n\n1 \\leq a_i, b_i \\leq 10^9 for all i\n\na_1 < a_2 < ... < a_N\n\nb_1 > b_2 > ... > b_N\n\na_{p_1}+b_{p_1} < a_{p_2}+b_{p_2} < ... < a_{p_N}+b_{p_N}\n\nConstraints\n\n2 \\leq N \\leq 20,000\n\np is a permutation of the set {1, 2, ..., N}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nThe output consists of two lines. The first line contains a_1, a_2, ..., a_N seperated by a space. The second line contains b_1, b_2, ..., b_N seperated by a space.\n\nIt can be shown that there always exists a solution for any input satisfying the constraints.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n1 4\n5 4\n\na_1 + b_1 = 6 and a_2 + b_2 = 8. So this output satisfies all conditions.\n\nSample Input 2\n\n3\n3 2 1\n\nSample Output 2\n\n1 2 3\n5 3 1\n\nSample Input 3\n\n3\n2 3 1\n\nSample Output 3\n\n5 10 100\n100 10 1", "sample_input": "2\n1 2\n"}, "reference_outputs": ["1 4\n5 4\n"], "source_document_id": "p03938", "source_text": "Score : 400 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nYou are given a permutation p of the set {1, 2, ..., N}. Please construct two sequences of positive integers a_1, a_2, ..., a_N and b_1, b_2, ..., b_N satisfying the following conditions:\n\n1 \\leq a_i, b_i \\leq 10^9 for all i\n\na_1 < a_2 < ... < a_N\n\nb_1 > b_2 > ... > b_N\n\na_{p_1}+b_{p_1} < a_{p_2}+b_{p_2} < ... < a_{p_N}+b_{p_N}\n\nConstraints\n\n2 \\leq N \\leq 20,000\n\np is a permutation of the set {1, 2, ..., N}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nThe output consists of two lines. The first line contains a_1, a_2, ..., a_N seperated by a space. The second line contains b_1, b_2, ..., b_N seperated by a space.\n\nIt can be shown that there always exists a solution for any input satisfying the constraints.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n1 4\n5 4\n\na_1 + b_1 = 6 and a_2 + b_2 = 8. So this output satisfies all conditions.\n\nSample Input 2\n\n3\n3 2 1\n\nSample Output 2\n\n1 2 3\n5 3 1\n\nSample Input 3\n\n3\n2 3 1\n\nSample Output 3\n\n5 10 100\n100 10 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s376597260", "group_id": "codeNet:p03947", "input_text": "var s,t:ansistring;\n i,j,cnt,k:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n k:=1;\n for i:=1 to length(s) do begin\n if (s[i]<>s[i+1]) then delete(s,i,1);\n end;\n while (b=false) do begin\n b:=true;\n for i:=k to length(s) do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n for j:=2 to i do begin\n if s[j]='B' then s[j]:='W';\n end;\n end\n else begin\n insert('B',s,1);\n for j:=2 to i do begin\n if s[j]='W' then s[j]:='B';\n end;\n end;\n k:=i;\n inc(cnt);\n end\n else break;\n end;\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596674109, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s376597260.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s376597260", "user_id": "u018679195"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s,t:ansistring;\n i,j,cnt,k:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n k:=1;\n for i:=1 to length(s) do begin\n if (s[i]<>s[i+1]) then delete(s,i,1);\n end;\n while (b=false) do begin\n b:=true;\n for i:=k to length(s) do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n for j:=2 to i do begin\n if s[j]='B' then s[j]:='W';\n end;\n end\n else begin\n insert('B',s,1);\n for j:=2 to i do begin\n if s[j]='W' then s[j]:='B';\n end;\n end;\n k:=i;\n inc(cnt);\n end\n else break;\n end;\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 738, "cpu_time_ms": 2205, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s881613546", "group_id": "codeNet:p03947", "input_text": "var s:ansistring;\n i,j,cnt,k:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n k:=1;\n while (b=false) do begin\n b:=true;\n for i:=k to length(s) do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n inc(cnt);\n for j:=2 to i do begin\n if s[j]='B' then s[j]:='W';\n end;\n k:=i;\n end\n else begin\n insert('B',s,1);\n inc(cnt);\n for j:=2 to i do begin\n if s[j]='W' then s[j]:='B';\n end;\n k:=i;\n end;\n end\n else break;\n end;\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596664202, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s881613546.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s881613546", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s:ansistring;\n i,j,cnt,k:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n k:=1;\n while (b=false) do begin\n b:=true;\n for i:=k to length(s) do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n inc(cnt);\n for j:=2 to i do begin\n if s[j]='B' then s[j]:='W';\n end;\n k:=i;\n end\n else begin\n insert('B',s,1);\n inc(cnt);\n for j:=2 to i do begin\n if s[j]='W' then s[j]:='B';\n end;\n k:=i;\n end;\n end\n else break;\n end;\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 690, "cpu_time_ms": 2205, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s663037022", "group_id": "codeNet:p03947", "input_text": "var\n s:string;\n i,cnt:longint;\nbegin\n readln(s);\n cnt:=0;\n for i:=1 to length(s)-1 do\n if (s[i]<>s[i+1]) then\n inc(cnt);\n writeln(cnt);\nend.\n", "language": "Pascal", "metadata": {"date": 1596663755, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s663037022.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s663037022", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n s:string;\n i,cnt:longint;\nbegin\n readln(s);\n cnt:=0;\n for i:=1 to length(s)-1 do\n if (s[i]<>s[i+1]) then\n inc(cnt);\n writeln(cnt);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 155, "cpu_time_ms": 5, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s164991103", "group_id": "codeNet:p03947", "input_text": "var\n\n s : ansistring;\n i, cnt : longint;\n b : boolean;\n \nbegin\n\n readln(S);\n b := true;\n cnt := 0;\n \n for i := 1 to length(s)-1 do\n begin\n if s[i] <> s[i+1] then\n b := false;\n end;\n \n if b = true then\n begin\n writeln(0);\n halt;\n end\n else\n for i := 1 to length(s)-1 do\n if ((s[i] = 'B') and (s[i+1] = 'W')) or ((s[i] = 'W') and (s[i+1] = 'B')) then\n inc(cnt);\n \n writeln(cnt);\n \n\nend.", "language": "Pascal", "metadata": {"date": 1596663737, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s164991103.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s164991103", "user_id": "u018679195"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\n s : ansistring;\n i, cnt : longint;\n b : boolean;\n \nbegin\n\n readln(S);\n b := true;\n cnt := 0;\n \n for i := 1 to length(s)-1 do\n begin\n if s[i] <> s[i+1] then\n b := false;\n end;\n \n if b = true then\n begin\n writeln(0);\n halt;\n end\n else\n for i := 1 to length(s)-1 do\n if ((s[i] = 'B') and (s[i+1] = 'W')) or ((s[i] = 'W') and (s[i+1] = 'B')) then\n inc(cnt);\n \n writeln(cnt);\n \n\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 438, "cpu_time_ms": 6, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s135290679", "group_id": "codeNet:p03947", "input_text": "var\n\n s : ansistring;\n i, cntw, cntb : longint;\n b : boolean;\n \nbegin\n\n readln(S);\n b := true;\n cntw := 0;\n cntb := 0;\n \n for i := 1 to length(s)-1 do\n begin\n if s[i] <> s[i+1] then\n b := false;\n end;\n \n if b = true then\n writeln(0)\n else\n begin\n for i := 1 to length(s)-1 do\n begin\n if (s[i] = 'B') and (s[i+1] = 'W') then\n inc(cntw)\n else\n if (s[i] = 'W') and (s[i+1] = 'B') then\n inc(cntb);\n end;\n end;\n writeln(cntw + cntb);\n \n\nend.", "language": "Pascal", "metadata": {"date": 1596663611, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s135290679.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s135290679", "user_id": "u353919145"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\n s : ansistring;\n i, cntw, cntb : longint;\n b : boolean;\n \nbegin\n\n readln(S);\n b := true;\n cntw := 0;\n cntb := 0;\n \n for i := 1 to length(s)-1 do\n begin\n if s[i] <> s[i+1] then\n b := false;\n end;\n \n if b = true then\n writeln(0)\n else\n begin\n for i := 1 to length(s)-1 do\n begin\n if (s[i] = 'B') and (s[i+1] = 'W') then\n inc(cntw)\n else\n if (s[i] = 'W') and (s[i+1] = 'B') then\n inc(cntb);\n end;\n end;\n writeln(cntw + cntb);\n \n\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 508, "cpu_time_ms": 8, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s144908842", "group_id": "codeNet:p03947", "input_text": "var s,tmp:ansistring;\n i,count:longint;\nbegin\n readln(s);\n tmp:=s[1];\n for i:=2 to length(s) do\n begin\n if tmp<>s[i] then\n inc(count);\n tmp:=s[i];\n end;\n writeln(count);\nend.", "language": "Pascal", "metadata": {"date": 1596662818, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s144908842.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s144908842", "user_id": "u863370423"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s,tmp:ansistring;\n i,count:longint;\nbegin\n readln(s);\n tmp:=s[1];\n for i:=2 to length(s) do\n begin\n if tmp<>s[i] then\n inc(count);\n tmp:=s[i];\n end;\n writeln(count);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 25, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s540877499", "group_id": "codeNet:p03947", "input_text": "var i,lens:longint; s:ansistring;\n\nbegin\n readln(s);\n lens:=length(s);\n i:=1;\n while (pos('BB',s)<>0) or (pos('WW',s)<>0) do begin\n while s[i]=s[i+1] do begin\n\t delete(s,i+1,1);\n\t end;\n\t inc(i);\n\tend;\n\tlens:=length(s);\n\twriteln (lens-1);\nend.", "language": "Pascal", "metadata": {"date": 1596658128, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s540877499.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s540877499", "user_id": "u353919145"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var i,lens:longint; s:ansistring;\n\nbegin\n readln(s);\n lens:=length(s);\n i:=1;\n while (pos('BB',s)<>0) or (pos('WW',s)<>0) do begin\n while s[i]=s[i+1] do begin\n\t delete(s,i+1,1);\n\t end;\n\t inc(i);\n\tend;\n\tlens:=length(s);\n\twriteln (lens-1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 263, "cpu_time_ms": 2205, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s330032956", "group_id": "codeNet:p03947", "input_text": "var n,m,i,j,ans:longint;\n s:string;\nbegin\nreadln(s);\nfor i:=2 to length(s) do begin\n if s[i]<>s[i-1] then inc(ans);\nend;\nwriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1478484234, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s330032956.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s330032956", "user_id": "u245218607"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,m,i,j,ans:longint;\n s:string;\nbegin\nreadln(s);\nfor i:=2 to length(s) do begin\n if s[i]<>s[i-1] then inc(ans);\nend;\nwriteln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s342784407", "group_id": "codeNet:p03954", "input_text": "// luogu-judger-enable-o2\nvar\n\ti,l,r,mid,n:longint;\n\ta:array[1..1000001] of longint;\n\nfunction check(k:longint):longint;\nvar\ti:longint;\nbegin\n\tif ((a[n-1]<=k)and(a[n]<=k))or((a[n+1]<=k)and(a[n]<=k)) then exit(0);\n\tif ((a[n-1]>k)and(a[n]>k))or((a[n+1]>k)and(a[n]>k)) then exit(1);\n\tfor i:=1 to n-1 do begin\n\t\tif ((a[n-i-1]<=k)and(a[n-i]<=k))or((a[n+i+1]<=k)and(a[n+i]<=k)) then exit(0);\n\t\tif ((a[n-i-1]>k)and(a[n-i]>k))or((a[n+i+1]>k)and(a[n+i]>k)) then exit(1);\n\tend;\n\tif a[1]>k then exit(1) else exit(0);\nend;\n\nbegin\n\treadln(n);\n\tfor i:=1 to 2*n-1 do read(a[i]);\n\tl:=1;\n\tr:=2*n-1;\n\twhile lk)and(a[n]>k))or((a[n+1]>k)and(a[n]>k)) then exit(1);\n\tfor i:=1 to n-1 do begin\n\t\tif ((a[n-i-1]<=k)and(a[n-i]<=k))or((a[n+i+1]<=k)and(a[n+i]<=k)) then exit(0);\n\t\tif ((a[n-i-1]>k)and(a[n-i]>k))or((a[n+i+1]>k)and(a[n+i]>k)) then exit(1);\n\tend;\n\tif a[1]>k then exit(1) else exit(0);\nend;\n\nbegin\n\treadln(n);\n\tfor i:=1 to 2*n-1 do read(a[i]);\n\tl:=1;\n\tr:=2*n-1;\n\twhile lmax then max:=i;\n end;\n if max>min then writeln('Yes') else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1579976618, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Pascal/s202279204.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s202279204", "user_id": "u723721005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s:string;\n i,min,max:longint;\nbegin\n readln(s);\n min:=length(s);\n max:=1;\n for i:=1 to length(s) do\n begin\n if s[i]='C' then if imax then max:=i;\n end;\n if max>min then writeln('Yes') else writeln('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 269, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s050152170", "group_id": "codeNet:p03957", "input_text": "Var s,x:ansistring;\n n,i:longint;\nBegin\n readln(s);\n for i:=1 to length(s) do\n Begin\n if s[i] in ['C','F'] then\n Begin\n x:=x+s[i];\n end;\n\n if pos('CF',x)<>0 then\n Begin\n write('Yes');\n halt;\n end;\n end;\n write('No');\nend.", "language": "Pascal", "metadata": {"date": 1536709323, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Pascal/s050152170.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s050152170", "user_id": "u426964396"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "Var s,x:ansistring;\n n,i:longint;\nBegin\n readln(s);\n for i:=1 to length(s) do\n Begin\n if s[i] in ['C','F'] then\n Begin\n x:=x+s[i];\n end;\n\n if pos('CF',x)<>0 then\n Begin\n write('Yes');\n halt;\n end;\n end;\n write('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 418, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s417627922", "group_id": "codeNet:p03957", "input_text": "var s:string;\ni:integer;\nc,f:boolean;\nbegin\nc:=false;\nf:=false;\nread(s);\nfor i:=1 to length(s) do\nbegin\nif s[i]='C' then c:=true;\nif s[i]='F' then f:=true;\nif not(c) then f:=false;\nend;\nif c=f then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1524695441, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Pascal/s417627922.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s417627922", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s:string;\ni:integer;\nc,f:boolean;\nbegin\nc:=false;\nf:=false;\nread(s);\nfor i:=1 to length(s) do\nbegin\nif s[i]='C' then c:=true;\nif s[i]='F' then f:=true;\nif not(c) then f:=false;\nend;\nif c=f then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 237, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s561898254", "group_id": "codeNet:p03957", "input_text": "var\n\ts,s1 : ansistring;\n\ti : longint;\nbegin\n\treadln(s1);\n\ts := '';\n\tfor i := length(s1) downto 1 do s := s + s1[i];\n\t//writeln(s);\n\tif (pos('C',s) > pos('F',s)) and (pos('C',s) <> 0) and (pos('F',s) <> 0) then writeln('Yes')\n\telse writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1477285944, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Pascal/s561898254.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561898254", "user_id": "u927369338"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\ts,s1 : ansistring;\n\ti : longint;\nbegin\n\treadln(s1);\n\ts := '';\n\tfor i := length(s1) downto 1 do s := s + s1[i];\n\t//writeln(s);\n\tif (pos('C',s) > pos('F',s)) and (pos('C',s) <> 0) and (pos('F',s) <> 0) then writeln('Yes')\n\telse writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 250, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s705623049", "group_id": "codeNet:p03965", "input_text": "var s:string;\n i,len,x,y,ans:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n begin\n if (x>=y+1) then \n begin\n inc(y); \n if (s[i]='g') then inc(ans); \n end\n else begin inc(x); if (s[i]='p') then dec(ans); end;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1554596849, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s705623049.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705623049", "user_id": "u426964396"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var s:string;\n i,len,x,y,ans:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n begin\n if (x>=y+1) then \n begin\n inc(y); \n if (s[i]='g') then inc(ans); \n end\n else begin inc(x); if (s[i]='p') then dec(ans); end;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 322, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s199129415", "group_id": "codeNet:p03965", "input_text": "var\n i,x,y,t:longint;\n s:ansistring;\nbegin\n readln(s);\n x:=0;y:=0;t:=0;\n for i:=1 to length(s) do\n if x=y then\n begin\n x:=x+1;\n if s[i]='p' then t:=t-1;\n end\n else\n begin\n y:=y+1;\n if s[i]='g' then t:=t+1;\n end;\n writeln(t);\nend.", "language": "Pascal", "metadata": {"date": 1554251316, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s199129415.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s199129415", "user_id": "u263933075"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i,x,y,t:longint;\n s:ansistring;\nbegin\n readln(s);\n x:=0;y:=0;t:=0;\n for i:=1 to length(s) do\n if x=y then\n begin\n x:=x+1;\n if s[i]='p' then t:=t-1;\n end\n else\n begin\n y:=y+1;\n if s[i]='g' then t:=t+1;\n end;\n writeln(t);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s847091081", "group_id": "codeNet:p03965", "input_text": "var i,j,n,m,x,y,ans:longint;\n a:string;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do\n if x=y then\n begin\n inc(x);\n if a[i]='p' then dec(ans);\n end\n else\n begin\n inc(y);\n if a[i]='g' then inc(ans);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1553462992, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s847091081.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s847091081", "user_id": "u426964396"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var i,j,n,m,x,y,ans:longint;\n a:string;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do\n if x=y then\n begin\n inc(x);\n if a[i]='p' then dec(ans);\n end\n else\n begin\n inc(y);\n if a[i]='g' then inc(ans);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 253, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s632086879", "group_id": "codeNet:p03965", "input_text": "var s:string;\n i,len,x,y,ans:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n begin\n if (x>=y+1) then begin inc(y); if (s[i]='g') then inc(ans); end\n else begin inc(x); if (s[i]='p') then dec(ans); end;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1553461408, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s632086879.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s632086879", "user_id": "u476418095"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var s:string;\n i,len,x,y,ans:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n begin\n if (x>=y+1) then begin inc(y); if (s[i]='g') then inc(ans); end\n else begin inc(x); if (s[i]='p') then dec(ans); end;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 249, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s129773445", "group_id": "codeNet:p03965", "input_text": "var\n i,ss,s1,s2:longint;\n s:string;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if s1=s2 then begin if s[i]='p' then dec(ss); inc(s1); end\n else begin if s[i]='g' then inc(ss); inc(s2); end;\n writeln(ss);\nend.", "language": "Pascal", "metadata": {"date": 1539311932, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s129773445.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s129773445", "user_id": "u426964396"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i,ss,s1,s2:longint;\n s:string;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if s1=s2 then begin if s[i]='p' then dec(ss); inc(s1); end\n else begin if s[i]='g' then inc(ss); inc(s2); end;\n writeln(ss);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s433332779", "group_id": "codeNet:p03965", "input_text": "var\ns,s1:string;\ni,j,c,x,y:longint;\nbegin\nread(s);\nfor i:=1 to length(s) do\nbegin\nif x=y then begin inc(x); if s[i]='p' then dec(c);end\nelse\n begin\ninc(y);\nif s[i]='g' then inc(c);\nend;\nend;\nwriteln(c);\nend.\n", "language": "Pascal", "metadata": {"date": 1538935559, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s433332779.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s433332779", "user_id": "u247366051"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\ns,s1:string;\ni,j,c,x,y:longint;\nbegin\nread(s);\nfor i:=1 to length(s) do\nbegin\nif x=y then begin inc(x); if s[i]='p' then dec(c);end\nelse\n begin\ninc(y);\nif s[i]='g' then inc(c);\nend;\nend;\nwriteln(c);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s386239594", "group_id": "codeNet:p03966", "input_text": "Uses math;\nvar\n\tn,i,x,y:Longint;\n\ta,b,c:int64;\nbegin\n\treadln(n);\n\ta:=1;\n\tfor i:=1 to n do begin\n\t\treadln(x,y);\n c:=Max((a-1)div x,(b-1)div y)+1;\n\t\ta:=c*x;\n\t\tb:=c*y;\n\tend;\n\twriteln(a+b);\nend.\n", "language": "Pascal", "metadata": {"date": 1538022177, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03966.html", "problem_id": "p03966", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03966/input.txt", "sample_output_relpath": "derived/input_output/data/p03966/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03966/Pascal/s386239594.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s386239594", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "Uses math;\nvar\n\tn,i,x,y:Longint;\n\ta,b,c:int64;\nbegin\n\treadln(n);\n\ta:=1;\n\tfor i:=1 to n do begin\n\t\treadln(x,y);\n c:=Max((a-1)div x,(b-1)div y)+1;\n\t\ta:=c*x;\n\t\tb:=c*y;\n\tend;\n\twriteln(a+b);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "sample_input": "3\n2 3\n1 1\n3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03966", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 198, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s649232024", "group_id": "codeNet:p03966", "input_text": "Uses math;\nvar\n\tn,i,x,y:Longint;\n\ta,b,c,d:int64;\nbegin\n\tread(n);\n\ta:=1;\n\tb:=1;\n\tfor i:=1 to n do begin\n\t\tread(x,y);\n c:=Max((a-1)div x,(b-1)div y)+1;\n\t\ta:=c*x;\n\t\tb:=c*y;\n\tend;\n\twriteln(a+b);\nend.\n", "language": "Pascal", "metadata": {"date": 1538022126, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03966.html", "problem_id": "p03966", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03966/input.txt", "sample_output_relpath": "derived/input_output/data/p03966/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03966/Pascal/s649232024.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s649232024", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "Uses math;\nvar\n\tn,i,x,y:Longint;\n\ta,b,c,d:int64;\nbegin\n\tread(n);\n\ta:=1;\n\tb:=1;\n\tfor i:=1 to n do begin\n\t\tread(x,y);\n c:=Max((a-1)div x,(b-1)div y)+1;\n\t\ta:=c*x;\n\t\tb:=c*y;\n\tend;\n\twriteln(a+b);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "sample_input": "3\n2 3\n1 1\n3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03966", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s263000274", "group_id": "codeNet:p03966", "input_text": "var n,a,b,x,y,p,q,tmp,tmp1,tmp2,tmp3:int64;\nfunction gcd(a,b:int64):int64; begin if b=0 then exit(a); exit(gcd(b,a mod b)); end;\nprocedure exgcd(a,b:int64; var x,y:int64);\n var t:int64;\n begin\n if b=0 then begin\n x:=tmp; y:=0; exit;\n end;\n exgcd(b,a mod b,x,y);\n t:=x; x:=y; y:=t-a div b*y;\n //x:=x mod p; y:=y mod q;\n end;\nbegin\n //assign(input,'a.in'); reset(input);\n readln(n); a:=1; b:=1;\n while (n>0) do begin\n dec(n); readln(p,q); tmp:=-a*q+b*p;\n // writeln(a,' ',b);\n exgcd(q,p,x,y);\n tmp1:=(x mod p+p) mod p; tmp2:=y+(x-tmp1) div p*q;\n if (tmp2>0) then begin\n tmp3:=tmp2 mod q-q;\n x:=tmp1-(tmp3-tmp2) div q*p;\n y:=tmp3;\n end else begin x:=tmp1; y:=tmp2; end;\n a:=a+x; b:=b-y;\n end;\n writeln(a+b);\n //close(input);\nend.\n", "language": "Pascal", "metadata": {"date": 1476584344, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03966.html", "problem_id": "p03966", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03966/input.txt", "sample_output_relpath": "derived/input_output/data/p03966/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03966/Pascal/s263000274.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s263000274", "user_id": "u021294378"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var n,a,b,x,y,p,q,tmp,tmp1,tmp2,tmp3:int64;\nfunction gcd(a,b:int64):int64; begin if b=0 then exit(a); exit(gcd(b,a mod b)); end;\nprocedure exgcd(a,b:int64; var x,y:int64);\n var t:int64;\n begin\n if b=0 then begin\n x:=tmp; y:=0; exit;\n end;\n exgcd(b,a mod b,x,y);\n t:=x; x:=y; y:=t-a div b*y;\n //x:=x mod p; y:=y mod q;\n end;\nbegin\n //assign(input,'a.in'); reset(input);\n readln(n); a:=1; b:=1;\n while (n>0) do begin\n dec(n); readln(p,q); tmp:=-a*q+b*p;\n // writeln(a,' ',b);\n exgcd(q,p,x,y);\n tmp1:=(x mod p+p) mod p; tmp2:=y+(x-tmp1) div p*q;\n if (tmp2>0) then begin\n tmp3:=tmp2 mod q-q;\n x:=tmp1-(tmp3-tmp2) div q*p;\n y:=tmp3;\n end else begin x:=tmp1; y:=tmp2; end;\n a:=a+x; b:=b-y;\n end;\n writeln(a+b);\n //close(input);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "sample_input": "3\n2 3\n1 1\n3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03966", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 791, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s621172198", "group_id": "codeNet:p03970", "input_text": "var s:String;t:String='CODEFESTIVAL2016';\ni,c:Longint;\nbegin\nreadln(s);\nfor i:=1 to 16 do if s[i]<>t[i] then inc(c);\nwriteln(c);\nend.", "language": "Pascal", "metadata": {"date": 1581399149, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03970.html", "problem_id": "p03970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03970/input.txt", "sample_output_relpath": "derived/input_output/data/p03970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03970/Pascal/s621172198.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s621172198", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var s:String;t:String='CODEFESTIVAL2016';\ni,c:Longint;\nbegin\nreadln(s);\nfor i:=1 to 16 do if s[i]<>t[i] then inc(c);\nwriteln(c);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "sample_input": "C0DEFESTIVAL2O16\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03970", "source_text": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s395755863", "group_id": "codeNet:p03970", "input_text": " {$mode objfpc}\n {$coperators on}\nconst\n sz=round(1e5)+100;\ntype\n Tnode = ^node;\n node =\n record\n c:array['_'..'z'] of Tnode;\n cnt:longint;\n end;\nvar\n s:array[1..sz]of string;\n n,q,cur:longint;\n kth,ans:array[1..sz]of longint;\n a:array[1..sz]of ansistring;\n nod,root:Tnode;\n count:array[0..sz,'_'..'z','_'..'z']of longint;\n\n\nfunction min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;\nfunction max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;\nprocedure spaw(var nod:Tnode);\nvar i:char;\n begin\n new(nod);\n nod^.cnt:=0;\n for i:='_' to 'z' do nod^.c[i]:=nil;\n end;\n\nprocedure enter;\nvar i : integer;\n begin\n readln(n);\n for i:=1 to n do\n begin\n readln(a[i]);\n a[i]:=a[i]+'_';\n end;\n readln(q);\n for i:=1 to q do\n begin\n read(kth[i]);\n readln(s[i]);\n delete(s[i],1,1);\n end;\n end;\nprocedure update(const a:ansistring);\nvar ch,rr:char;\n i:longint;\n begin\n nod:=root;\n for i:=1 to length(a) do\n begin\n ch:=a[i];\n if nod^.c[ch]=nil then spaw(nod^.c[ch]);\n nod := nod^.c[ch];\n inc(nod^.cnt);\n end;\n end;\nprocedure updateElement(p:longint);\nvar i:longint;\n ch,rr:char;\n begin\n nod:=root;\n for i:=1 to length(a[p]) do\n begin\n ch:=a[p][i];\n for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then\n count[p][ch][rr] += nod^.c[rr]^.cnt;\n nod:=nod^.c[ch];\n end;\n end;\nprocedure Build();\nvar i:longint;\n begin\n spaw(root);\n for i:=1 to n do\n begin\n update(a[i]);\n end;\n for i:=1 to n do\n begin\n updateElement(i);\n end;\n end;\nprocedure doQuerry(const s:string; kth:longint);\nvar i,j:longint;\n begin\n for i:=1 to 26 do\n for j:=1 to i-1 do ans[cur] += count[kth,s[i],s[j]];\n for i:=1 to 26 do ans[cur] += count[kth,s[i],'_'];\n ans[cur]+=1;\n end;\nprocedure solve;\nvar i: integer;\n begin\n Build();\n for i:=1 to q do\n begin\n cur:=i;\n doQuerry(s[i], kth[i]);\n end;\n end;\nprocedure print();\nvar i:longint;\n begin\n for i:=1 to q do\n writeln(ans[i]);\n end;\nbegin\n enter(); solve(); print();\nend.\n", "language": "Pascal", "metadata": {"date": 1479871833, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03970.html", "problem_id": "p03970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03970/input.txt", "sample_output_relpath": "derived/input_output/data/p03970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03970/Pascal/s395755863.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s395755863", "user_id": "u196616044"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " {$mode objfpc}\n {$coperators on}\nconst\n sz=round(1e5)+100;\ntype\n Tnode = ^node;\n node =\n record\n c:array['_'..'z'] of Tnode;\n cnt:longint;\n end;\nvar\n s:array[1..sz]of string;\n n,q,cur:longint;\n kth,ans:array[1..sz]of longint;\n a:array[1..sz]of ansistring;\n nod,root:Tnode;\n count:array[0..sz,'_'..'z','_'..'z']of longint;\n\n\nfunction min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;\nfunction max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;\nprocedure spaw(var nod:Tnode);\nvar i:char;\n begin\n new(nod);\n nod^.cnt:=0;\n for i:='_' to 'z' do nod^.c[i]:=nil;\n end;\n\nprocedure enter;\nvar i : integer;\n begin\n readln(n);\n for i:=1 to n do\n begin\n readln(a[i]);\n a[i]:=a[i]+'_';\n end;\n readln(q);\n for i:=1 to q do\n begin\n read(kth[i]);\n readln(s[i]);\n delete(s[i],1,1);\n end;\n end;\nprocedure update(const a:ansistring);\nvar ch,rr:char;\n i:longint;\n begin\n nod:=root;\n for i:=1 to length(a) do\n begin\n ch:=a[i];\n if nod^.c[ch]=nil then spaw(nod^.c[ch]);\n nod := nod^.c[ch];\n inc(nod^.cnt);\n end;\n end;\nprocedure updateElement(p:longint);\nvar i:longint;\n ch,rr:char;\n begin\n nod:=root;\n for i:=1 to length(a[p]) do\n begin\n ch:=a[p][i];\n for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then\n count[p][ch][rr] += nod^.c[rr]^.cnt;\n nod:=nod^.c[ch];\n end;\n end;\nprocedure Build();\nvar i:longint;\n begin\n spaw(root);\n for i:=1 to n do\n begin\n update(a[i]);\n end;\n for i:=1 to n do\n begin\n updateElement(i);\n end;\n end;\nprocedure doQuerry(const s:string; kth:longint);\nvar i,j:longint;\n begin\n for i:=1 to 26 do\n for j:=1 to i-1 do ans[cur] += count[kth,s[i],s[j]];\n for i:=1 to 26 do ans[cur] += count[kth,s[i],'_'];\n ans[cur]+=1;\n end;\nprocedure solve;\nvar i: integer;\n begin\n Build();\n for i:=1 to q do\n begin\n cur:=i;\n doQuerry(s[i], kth[i]);\n end;\n end;\nprocedure print();\nvar i:longint;\n begin\n for i:=1 to q do\n writeln(ans[i]);\n end;\nbegin\n enter(); solve(); print();\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "sample_input": "C0DEFESTIVAL2O16\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03970", "source_text": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2648, "cpu_time_ms": 3, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s010950991", "group_id": "codeNet:p03970", "input_text": " {$mode objfpc}\n {$coperators on}\nprogram Lexicographical_disorder________________________CODE_FESTIVAL_2016_qual_B____________________________________________________________;\nconst\n {$ifdef online_judge}\n fi = '';\n fo = '';\n {$else}\n fi = 'lex.inp';\n fo = 'lex.out';\n {$endif}\n sz=round(1e5)+100;\ntype\n Tnode = ^node;\n node =\n record\n c:array['_'..'z'] of Tnode;\n cnt:longint;\n end;\nvar\n s:array[1..sz]of string;\n n,q,cur:longint;\n kth,ans:array[1..sz]of longint;\n a:array[1..sz]of ansistring;\n nod,root:Tnode;\n count:array[0..sz,'_'..'z','_'..'z']of longint;\n\n\nfunction min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;\nfunction max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;\nprocedure spaw(var nod:Tnode);\nvar i:char;\n begin\n new(nod);\n nod^.cnt:=0;\n for i:='_' to 'z' do nod^.c[i]:=nil;\n end;\n\nprocedure enter;\nvar i : integer;\n begin\n readln(n);\n for i:=1 to n do\n begin\n readln(a[i]);\n a[i]:=a[i]+'_';\n end;\n readln(q);\n for i:=1 to q do\n begin\n read(kth[i]);\n readln(s[i]);\n delete(s[i],1,1);\n end;\n end;\nprocedure update(const a:ansistring);\nvar ch,rr:char;\n i:longint;\n begin\n nod:=root;\n for i:=1 to length(a) do\n begin\n ch:=a[i];\n if nod^.c[ch]=nil then spaw(nod^.c[ch]);\n nod := nod^.c[ch];\n inc(nod^.cnt);\n end;\n end;\nprocedure updateElement(p:longint);\nvar i:longint;\n ch,rr:char;\n begin\n nod:=root;\n for i:=1 to length(a[p]) do\n begin\n ch:=a[p][i];\n for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then\n count[p][ch][rr] += nod^.c[rr]^.cnt;\n nod:=nod^.c[ch];\n end;\n end;\nprocedure Build();\nvar i:longint;\n begin\n spaw(root);\n for i:=1 to n do\n begin\n update(a[i]);\n end;\n for i:=1 to n do\n begin\n updateElement(i);\n end;\n end;\nprocedure doQuerry(const s:string; kth:longint);\nvar i,j:longint;\n begin\n for i:=1 to 26 do\n for j:=1 to i-1 do ans[cur] += count[kth,s[i],s[j]];\n for i:=1 to 26 do ans[cur] += count[kth,s[i],'_'];\n ans[cur]+=1;\n end;\nprocedure solve;\nvar i: integer;\n begin\n Build();\n for i:=1 to q do\n begin\n cur:=i;\n doQuerry(s[i], kth[i]);\n end;\n end;\nprocedure print();\nvar i:longint;\n begin\n for i:=1 to q do\n writeln(ans[i]);\n end;\nbegin\n enter(); solve(); print();\nend.\n", "language": "Pascal", "metadata": {"date": 1479871474, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03970.html", "problem_id": "p03970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03970/input.txt", "sample_output_relpath": "derived/input_output/data/p03970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03970/Pascal/s010950991.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s010950991", "user_id": "u196616044"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " {$mode objfpc}\n {$coperators on}\nprogram Lexicographical_disorder________________________CODE_FESTIVAL_2016_qual_B____________________________________________________________;\nconst\n {$ifdef online_judge}\n fi = '';\n fo = '';\n {$else}\n fi = 'lex.inp';\n fo = 'lex.out';\n {$endif}\n sz=round(1e5)+100;\ntype\n Tnode = ^node;\n node =\n record\n c:array['_'..'z'] of Tnode;\n cnt:longint;\n end;\nvar\n s:array[1..sz]of string;\n n,q,cur:longint;\n kth,ans:array[1..sz]of longint;\n a:array[1..sz]of ansistring;\n nod,root:Tnode;\n count:array[0..sz,'_'..'z','_'..'z']of longint;\n\n\nfunction min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;\nfunction max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;\nprocedure spaw(var nod:Tnode);\nvar i:char;\n begin\n new(nod);\n nod^.cnt:=0;\n for i:='_' to 'z' do nod^.c[i]:=nil;\n end;\n\nprocedure enter;\nvar i : integer;\n begin\n readln(n);\n for i:=1 to n do\n begin\n readln(a[i]);\n a[i]:=a[i]+'_';\n end;\n readln(q);\n for i:=1 to q do\n begin\n read(kth[i]);\n readln(s[i]);\n delete(s[i],1,1);\n end;\n end;\nprocedure update(const a:ansistring);\nvar ch,rr:char;\n i:longint;\n begin\n nod:=root;\n for i:=1 to length(a) do\n begin\n ch:=a[i];\n if nod^.c[ch]=nil then spaw(nod^.c[ch]);\n nod := nod^.c[ch];\n inc(nod^.cnt);\n end;\n end;\nprocedure updateElement(p:longint);\nvar i:longint;\n ch,rr:char;\n begin\n nod:=root;\n for i:=1 to length(a[p]) do\n begin\n ch:=a[p][i];\n for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then\n count[p][ch][rr] += nod^.c[rr]^.cnt;\n nod:=nod^.c[ch];\n end;\n end;\nprocedure Build();\nvar i:longint;\n begin\n spaw(root);\n for i:=1 to n do\n begin\n update(a[i]);\n end;\n for i:=1 to n do\n begin\n updateElement(i);\n end;\n end;\nprocedure doQuerry(const s:string; kth:longint);\nvar i,j:longint;\n begin\n for i:=1 to 26 do\n for j:=1 to i-1 do ans[cur] += count[kth,s[i],s[j]];\n for i:=1 to 26 do ans[cur] += count[kth,s[i],'_'];\n ans[cur]+=1;\n end;\nprocedure solve;\nvar i: integer;\n begin\n Build();\n for i:=1 to q do\n begin\n cur:=i;\n doQuerry(s[i], kth[i]);\n end;\n end;\nprocedure print();\nvar i:longint;\n begin\n for i:=1 to q do\n writeln(ans[i]);\n end;\nbegin\n enter(); solve(); print();\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "sample_input": "C0DEFESTIVAL2O16\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03970", "source_text": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2952, "cpu_time_ms": 12, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s744448308", "group_id": "codeNet:p03977", "input_text": "var\ni,n,x,y:Longint;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(x,y);\nif x mod 2=1 then writeln(127*(x-1)+y)else writeln(127*x-y);\nend;\nend.", "language": "Pascal", "metadata": {"date": 1576138122, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03977.html", "problem_id": "p03977", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03977/input.txt", "sample_output_relpath": "derived/input_output/data/p03977/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03977/Pascal/s744448308.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s744448308", "user_id": "u657913472"}, "prompt_components": {"gold_output": "255\n400\n10\n", "input_to_evaluate": "var\ni,n,x,y:Longint;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(x,y);\nif x mod 2=1 then writeln(127*(x-1)+y)else writeln(127*x-y);\nend;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA professor invented Cookie Breeding Machine for his students who like cookies very much.\n\nWhen one cookie with the taste of x is put into the machine and a non-negative integer y less than or equal to 127 is input on the machine,\nit consumes the cookie and generates two cookies with the taste of y and (x XOR y).\n\nHere, XOR represents Bitwise Exclusive OR.\n\nAt first, there is only one cookie and the taste of it is D .\n\nFind the maximum value of the sum of the taste of the exactly N cookies generated after the following operation is conducted N-1 times.\n\nPut one of the cookies into the machine.\n\nInput a non-negative integer less than or equal to 127 on the machine.\n\nConstraints\n\n1 \\leq T \\leq 1000\n\n1 \\leq N_t \\leq 1000 (1 \\leq t \\leq T)\n\n1 \\leq D_t \\leq 127 (1 \\leq t \\leq T)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nT\nN_1 D_1\n:\nN_T D_T\n\nThe input consists of multiple test cases. An Integer T that represents the number of test cases is given on line 1.\n\nEach test case is given on the next T lines.\n\nIn the t-th test case ( 1 \\leq t \\leq T ),\nN_t that represents the number of cookies generated through the operations and D_t that represents the taste of the initial cookie are given separated by space.\n\nOutput\n\nFor each test case, print the maximum value of the sum of the taste of the N cookies generated through the operations on one line.\n\nSample Input 1\n\n3\n3 1\n4 108\n1 10\n\nSample Output 1\n\n255\n400\n10\n\nOn the 1st test case, if the machine is used as follows, three cookies with the taste of 61, 95 and 99 are generated.\nSince the sum of these values is maximum among all possible ways, the answer is 255.\n\nPut the cookie with the taste of 1 and input an integer 60 on the machine, lose the cookie and get two cookies with the taste of 60 and 61.\n\nPut the cookie with the taste of 60 and input an integer 99 on the machine, lose the cookie and get two cookies with the taste of 99 and 95.\n\nOn the 3rd test case, the machine may not be used.", "sample_input": "3\n3 1\n4 108\n1 10\n"}, "reference_outputs": ["255\n400\n10\n"], "source_document_id": "p03977", "source_text": "Score : 100 points\n\nProblem Statement\n\nA professor invented Cookie Breeding Machine for his students who like cookies very much.\n\nWhen one cookie with the taste of x is put into the machine and a non-negative integer y less than or equal to 127 is input on the machine,\nit consumes the cookie and generates two cookies with the taste of y and (x XOR y).\n\nHere, XOR represents Bitwise Exclusive OR.\n\nAt first, there is only one cookie and the taste of it is D .\n\nFind the maximum value of the sum of the taste of the exactly N cookies generated after the following operation is conducted N-1 times.\n\nPut one of the cookies into the machine.\n\nInput a non-negative integer less than or equal to 127 on the machine.\n\nConstraints\n\n1 \\leq T \\leq 1000\n\n1 \\leq N_t \\leq 1000 (1 \\leq t \\leq T)\n\n1 \\leq D_t \\leq 127 (1 \\leq t \\leq T)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nT\nN_1 D_1\n:\nN_T D_T\n\nThe input consists of multiple test cases. An Integer T that represents the number of test cases is given on line 1.\n\nEach test case is given on the next T lines.\n\nIn the t-th test case ( 1 \\leq t \\leq T ),\nN_t that represents the number of cookies generated through the operations and D_t that represents the taste of the initial cookie are given separated by space.\n\nOutput\n\nFor each test case, print the maximum value of the sum of the taste of the N cookies generated through the operations on one line.\n\nSample Input 1\n\n3\n3 1\n4 108\n1 10\n\nSample Output 1\n\n255\n400\n10\n\nOn the 1st test case, if the machine is used as follows, three cookies with the taste of 61, 95 and 99 are generated.\nSince the sum of these values is maximum among all possible ways, the answer is 255.\n\nPut the cookie with the taste of 1 and input an integer 60 on the machine, lose the cookie and get two cookies with the taste of 60 and 61.\n\nPut the cookie with the taste of 60 and input an integer 99 on the machine, lose the cookie and get two cookies with the taste of 99 and 95.\n\nOn the 3rd test case, the machine may not be used.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s158890195", "group_id": "codeNet:p03986", "input_text": "var s:ansistring; i,sum,cnt:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n begin \n if s[i]='S' then inc(sum);\n if s='T' then \n begin\n if (sum<>0)then begin dec(sum);inc(cnt);end;\n end;\n end;\n writeln(length(s)-cnt);\nend.", "language": "Pascal", "metadata": {"date": 1581219127, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s158890195.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s158890195", "user_id": "u519460719"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:ansistring; i,sum,cnt:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n begin \n if s[i]='S' then inc(sum);\n if s='T' then \n begin\n if (sum<>0)then begin dec(sum);inc(cnt);end;\n end;\n end;\n writeln(length(s)-cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 310, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s785060345", "group_id": "codeNet:p03986", "input_text": "var s:ansistring;\nbegin\n readln(s);\n while (s<>'')and(pos('ST',s)<>0)do delete(s,pos('ST',s),2);\n writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1581218792, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s785060345.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s785060345", "user_id": "u519460719"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:ansistring;\nbegin\n readln(s);\n while (s<>'')and(pos('ST',s)<>0)do delete(s,pos('ST',s),2);\n writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s415322102", "group_id": "codeNet:p03986", "input_text": "var s:ansistring;\nbegin\n readln(s);\n while (s<>'')and(pos('ST',s)<>0)do delete(s,pos('ST',s),2);\n writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1581218717, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s415322102.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s415322102", "user_id": "u519460719"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:ansistring;\nbegin\n readln(s);\n while (s<>'')and(pos('ST',s)<>0)do delete(s,pos('ST',s),2);\n writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s155399393", "group_id": "codeNet:p03986", "input_text": "var s:ansistring;\nbegin\n readln(s);\n while (s<>'')and(pos('ST',s)<>0)do delete(s,pos('ST',s),1);\n writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1581218534, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s155399393.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s155399393", "user_id": "u519460719"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:ansistring;\nbegin\n readln(s);\n while (s<>'')and(pos('ST',s)<>0)do delete(s,pos('ST',s),1);\n writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s534256971", "group_id": "codeNet:p03986", "input_text": "var i,t:Longint;\ns:String;\nbegin\nreadln(s);\nfor i:=1 to length(s)do begin\nif s[i]='S'then inc(t)else if t>0 then dec(t);\nend;\nwriteln(t*2);\nend.", "language": "Pascal", "metadata": {"date": 1579577092, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s534256971.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s534256971", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var i,t:Longint;\ns:String;\nbegin\nreadln(s);\nfor i:=1 to length(s)do begin\nif s[i]='S'then inc(t)else if t>0 then dec(t);\nend;\nwriteln(t*2);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 144, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s798908660", "group_id": "codeNet:p03986", "input_text": "var s:ansistring;\ni:longint;\nbegin\n//assign(input,'str.in');reset(input);\n//assign(output,'str.out');rewrite(output);\nreadln(s);\ni:=length(s);\nwhile i>=3 do\n begin\n if s[i-1]+s[i]='ST' then\n begin\n delete(s,i-1,2);\n i:=i-1;\n end;\n i:=i-1;\n end;\nif (s[1]+s[2]='ST') and (length(s)=2) then\n writeln(0)\nelse\n begin\n while pos('ST',s)>0 do\n delete(s,pos('ST',s),2);\n writeln(length(s));\n end;\nclose(input);close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1552165230, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s798908660.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s798908660", "user_id": "u880149461"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:ansistring;\ni:longint;\nbegin\n//assign(input,'str.in');reset(input);\n//assign(output,'str.out');rewrite(output);\nreadln(s);\ni:=length(s);\nwhile i>=3 do\n begin\n if s[i-1]+s[i]='ST' then\n begin\n delete(s,i-1,2);\n i:=i-1;\n end;\n i:=i-1;\n end;\nif (s[1]+s[2]='ST') and (length(s)=2) then\n writeln(0)\nelse\n begin\n while pos('ST',s)>0 do\n delete(s,pos('ST',s),2);\n writeln(length(s));\n end;\nclose(input);close(output);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 446, "cpu_time_ms": 1055, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s625717135", "group_id": "codeNet:p03986", "input_text": "var\n s:ansistring;\n k:longint;\nbegin\n readln(s);\n k:=pos('ST',s);\n while k<>0 do\n begin\n delete(s,k,2);\n k:=pos('ST',s);\n end;\n writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1538757909, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s625717135.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s625717135", "user_id": "u723721005"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n s:ansistring;\n k:longint;\nbegin\n readln(s);\n k:=pos('ST',s);\n while k<>0 do\n begin\n delete(s,k,2);\n k:=pos('ST',s);\n end;\n writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s528957289", "group_id": "codeNet:p03986", "input_text": " var\n s:ansistring;\n x:longint;\nbegin\n readln(s);\n while(true) do\n begin\n x:=pos('ST',s);\n if(x=0)then break;\n delete(s,x,2);\n\n end;\n writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1476984330, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s528957289.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s528957289", "user_id": "u041368761"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": " var\n s:ansistring;\n x:longint;\nbegin\n readln(s);\n while(true) do\n begin\n x:=pos('ST',s);\n if(x=0)then break;\n delete(s,x,2);\n\n end;\n writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 1054, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620166978", "group_id": "codeNet:p03993", "input_text": "var n,c,i:Longint;a:array[1..100000]of Longint;\nbegin\nread(n);\nfor i:=1 to n do read(a[i]);\nfor i:=1 to n do if i=a[a[i]]then inc(c);\nwriteln(c div 2);\nend.", "language": "Pascal", "metadata": {"date": 1581662368, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03993.html", "problem_id": "p03993", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03993/input.txt", "sample_output_relpath": "derived/input_output/data/p03993/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03993/Pascal/s620166978.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620166978", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,c,i:Longint;a:array[1..100000]of Longint;\nbegin\nread(n);\nfor i:=1 to n do read(a[i]);\nfor i:=1 to n do if i=a[a[i]]then inc(c);\nwriteln(c div 2);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rabbits, numbered 1 through N.\n\nThe i-th (1≤i≤N) rabbit likes rabbit a_i.\nNote that no rabbit can like itself, that is, a_i≠i.\n\nFor a pair of rabbits i and j (i<j), we call the pair (i,j) a friendly pair if the following condition is met.\n\nRabbit i likes rabbit j and rabbit j likes rabbit i.\n\nCalculate the number of the friendly pairs.\n\nConstraints\n\n2≤N≤10^5\n\n1≤a_i≤N\n\na_i≠i\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the friendly pairs.\n\nSample Input 1\n\n4\n2 1 4 3\n\nSample Output 1\n\n2\n\nThere are two friendly pairs: (1,2) and (3,4).\n\nSample Input 2\n\n3\n2 3 1\n\nSample Output 2\n\n0\n\nThere are no friendly pairs.\n\nSample Input 3\n\n5\n5 5 5 5 1\n\nSample Output 3\n\n1\n\nThere is one friendly pair: (1,5).", "sample_input": "4\n2 1 4 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03993", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rabbits, numbered 1 through N.\n\nThe i-th (1≤i≤N) rabbit likes rabbit a_i.\nNote that no rabbit can like itself, that is, a_i≠i.\n\nFor a pair of rabbits i and j (i<j), we call the pair (i,j) a friendly pair if the following condition is met.\n\nRabbit i likes rabbit j and rabbit j likes rabbit i.\n\nCalculate the number of the friendly pairs.\n\nConstraints\n\n2≤N≤10^5\n\n1≤a_i≤N\n\na_i≠i\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the friendly pairs.\n\nSample Input 1\n\n4\n2 1 4 3\n\nSample Output 1\n\n2\n\nThere are two friendly pairs: (1,2) and (3,4).\n\nSample Input 2\n\n3\n2 3 1\n\nSample Output 2\n\n0\n\nThere are no friendly pairs.\n\nSample Input 3\n\n5\n5 5 5 5 1\n\nSample Output 3\n\n1\n\nThere is one friendly pair: (1,5).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s825953170", "group_id": "codeNet:p03997", "input_text": "program abc045a;\nUses sysutils;\nvar a,b,h:String;\nbegin\n\treadLn(a);\n\treadLn(b);\n\treadLn(h);\n\twriteLn(((StrToInt(a)+StrToInt(b))*(StrToInt(h)))/2);\nend.", "language": "Pascal", "metadata": {"date": 1474856707, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03997.html", "problem_id": "p03997", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03997/input.txt", "sample_output_relpath": "derived/input_output/data/p03997/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03997/Pascal/s825953170.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s825953170", "user_id": "u678875535"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program abc045a;\nUses sysutils;\nvar a,b,h:String;\nbegin\n\treadLn(a);\n\treadLn(b);\n\treadLn(h);\n\twriteLn(((StrToInt(a)+StrToInt(b))*(StrToInt(h)))/2);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.\n\nAn example of a trapezoid\n\nFind the area of this trapezoid.\n\nConstraints\n\n1≦a≦100\n\n1≦b≦100\n\n1≦h≦100\n\nAll input values are integers.\n\nh is even.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na\nb\nh\n\nOutput\n\nPrint the area of the given trapezoid. It is guaranteed that the area is an integer.\n\nSample Input 1\n\n3\n4\n2\n\nSample Output 1\n\n7\n\nWhen the lengths of the upper base, lower base, and height are 3, 4, and 2, respectively, the area of the trapezoid is (3+4)×2/2 = 7.\n\nSample Input 2\n\n4\n4\n4\n\nSample Output 2\n\n16\n\nIn this case, a parallelogram is given, which is also a trapezoid.", "sample_input": "3\n4\n2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03997", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.\n\nAn example of a trapezoid\n\nFind the area of this trapezoid.\n\nConstraints\n\n1≦a≦100\n\n1≦b≦100\n\n1≦h≦100\n\nAll input values are integers.\n\nh is even.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na\nb\nh\n\nOutput\n\nPrint the area of the given trapezoid. It is guaranteed that the area is an integer.\n\nSample Input 1\n\n3\n4\n2\n\nSample Output 1\n\n7\n\nWhen the lengths of the upper base, lower base, and height are 3, 4, and 2, respectively, the area of the trapezoid is (3+4)×2/2 = 7.\n\nSample Input 2\n\n4\n4\n4\n\nSample Output 2\n\n16\n\nIn this case, a parallelogram is given, which is also a trapezoid.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s847853408", "group_id": "codeNet:p04006", "input_text": "var N,i,j:Longint;\nx,p,ans,now:int64;\nA:Array[1..2000]of int64;\nbegin\nread(N,x);\nfor i:=1 to N do read(A[i]);\nans:=10000000000000000;\nfor j:=0 to N do begin\np:=A[1];\nnow:=j*x;\nfor i:=1 to N do begin\ninc(now,A[i]);\nif(iA[i+1])then A[i]:=A[i+1];\nend;\nif ans>now then ans:=now;\nif A[N]>p then A[N]:=p;\nend;\nwriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1579576759, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04006.html", "problem_id": "p04006", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04006/input.txt", "sample_output_relpath": "derived/input_output/data/p04006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04006/Pascal/s847853408.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s847853408", "user_id": "u657913472"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var N,i,j:Longint;\nx,p,ans,now:int64;\nA:Array[1..2000]of int64;\nbegin\nread(N,x);\nfor i:=1 to N do read(A[i]);\nans:=10000000000000000;\nfor j:=0 to N do begin\np:=A[1];\nnow:=j*x;\nfor i:=1 to N do begin\ninc(now,A[i]);\nif(iA[i+1])then A[i]:=A[i+1];\nend;\nif ans>now then ans:=now;\nif A[N]>p then A[N]:=p;\nend;\nwriteln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\n\nx is an integer.\n\n1≤x≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "sample_input": "2 10\n1 100\n"}, "reference_outputs": ["12\n"], "source_document_id": "p04006", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\n\nx is an integer.\n\n1≤x≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 334, "cpu_time_ms": 7, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s803464948", "group_id": "codeNet:p04007", "input_text": "program ec12;\nvar\n\tn,m,i,j:longint;\n\ta:array[1..501,1..501] of longint;\n\tc:char;\nbegin\n\treadln(n,m);\n\tfor i:=1 to n do\n\tbegin \n\t\tif i mod 2=1 then \n\t\tbegin \n\t\t\tfor j:=1 to m do\n\t\t\ta[i,j]:=1;\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tfor j:=1 to m do\n\t\t\ta[i,j]:=2;\n\t\tend;\n\tend;\n\tfor i:=1 to n do \n\ta[i,1]:=1;\n\tfor i:=1 to n do\n\ta[i,m]:=2;\n\tfor i:=1 to n do\n\tbegin \n\t\tfor j:=1 to m do \n\t\tbegin \n\t\t\tread(c);\n\t\t\tif c='#' then \n\t\t\ta[i,j]:=3;\n\t\tend;\n\t\treadln;\n\tend;\n\tfor i:=1 to n do \n\tbegin \n\t\tfor j:=1 to m do \n\t\tbegin \n\t\t\tif (a[i,j]=1) or (a[i,j]=3) then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\n\twriteln;\n\tfor i:=1 to n do\n\tbegin \n\t\tfor j:=1 to m do\n\t\tbegin \n\t\t\tif (a[i,j]=2) or (a[i,j]=3) then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\nend. ", "language": "Pascal", "metadata": {"date": 1509390610, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04007.html", "problem_id": "p04007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04007/input.txt", "sample_output_relpath": "derived/input_output/data/p04007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04007/Pascal/s803464948.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s803464948", "user_id": "u353919145"}, "prompt_components": {"gold_output": ".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n", "input_to_evaluate": "program ec12;\nvar\n\tn,m,i,j:longint;\n\ta:array[1..501,1..501] of longint;\n\tc:char;\nbegin\n\treadln(n,m);\n\tfor i:=1 to n do\n\tbegin \n\t\tif i mod 2=1 then \n\t\tbegin \n\t\t\tfor j:=1 to m do\n\t\t\ta[i,j]:=1;\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tfor j:=1 to m do\n\t\t\ta[i,j]:=2;\n\t\tend;\n\tend;\n\tfor i:=1 to n do \n\ta[i,1]:=1;\n\tfor i:=1 to n do\n\ta[i,m]:=2;\n\tfor i:=1 to n do\n\tbegin \n\t\tfor j:=1 to m do \n\t\tbegin \n\t\t\tread(c);\n\t\t\tif c='#' then \n\t\t\ta[i,j]:=3;\n\t\tend;\n\t\treadln;\n\tend;\n\tfor i:=1 to n do \n\tbegin \n\t\tfor j:=1 to m do \n\t\tbegin \n\t\t\tif (a[i,j]=1) or (a[i,j]=3) then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\n\twriteln;\n\tfor i:=1 to n do\n\tbegin \n\t\tfor j:=1 to m do\n\t\tbegin \n\t\t\tif (a[i,j]=2) or (a[i,j]=3) then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "sample_input": "5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n"}, "reference_outputs": [".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n"], "source_document_id": "p04007", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 764, "cpu_time_ms": 22, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620846899", "group_id": "codeNet:p04012", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n i,j,min:Integer;\n w:string;\n sw:Char;\n beau:Boolean;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(w);\n\n for i := 1 to Length(w) do begin\n min := i;\n for j := i+1 to Length(w) do begin\n if w[j] < w[min] then\n min := j;\n end;\n sw:=w[i];\n w[i]:=w[min];\n w[min]:=sw;\n end;\n\n beau:=True;\n if Length(w) mod 2 = 1 then\n beau:=false\n else begin\n i:=1;\n while i=0)and(j-x+A<5000)then inc(dp[5000-i+j],dp[i+j-x+A]);\n\t\tend;\n\t\ti:=5000-i;\n\tend;\n\twriteln(dp[i+n*A]-1);\nend.\n", "language": "Pascal", "metadata": {"date": 1538016825, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04013.html", "problem_id": "p04013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04013/input.txt", "sample_output_relpath": "derived/input_output/data/p04013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04013/Pascal/s904069663.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s904069663", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n\tn,A,i,j,k,x:Longint;\n\tdp:array[0..9999]of int64;\nbegin\n\tread(n,A);\n\tdp[n*A]:=1;\n\tfor k:=1 to n do begin\n\t\tread(x);\n\t\tfor j:=0 to 4999 do begin\n\t\t\tdp[5000-i+j]:=dp[i+j];\n\t\t\tif(j-x+A>=0)and(j-x+A<5000)then inc(dp[5000-i+j],dp[i+j-x+A]);\n\t\tend;\n\t\ti:=5000-i;\n\tend;\n\twriteln(dp[i+n*A]-1);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTak has N cards. On the i-th (1 \\leq i \\leq N) card is written an integer x_i.\nHe is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A.\nIn how many ways can he make his selection?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq A \\leq 50\n\n1 \\leq x_i \\leq 50\n\nN,\\,A,\\,x_i are integers.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1 \\leq N \\leq 16.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the number of ways to select cards such that the average of the written integers is exactly A.\n\nSample Input 1\n\n4 8\n7 9 8 9\n\nSample Output 1\n\n5\n\nThe following are the 5 ways to select cards such that the average is 8:\n\nSelect the 3-rd card.\n\nSelect the 1-st and 2-nd cards.\n\nSelect the 1-st and 4-th cards.\n\nSelect the 1-st, 2-nd and 3-rd cards.\n\nSelect the 1-st, 3-rd and 4-th cards.\n\nSample Input 2\n\n3 8\n6 6 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n8 5\n3 6 2 8 7 6 5 9\n\nSample Output 3\n\n19\n\nSample Input 4\n\n33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n\nSample Output 4\n\n8589934591\n\nThe answer may not fit into a 32-bit integer.", "sample_input": "4 8\n7 9 8 9\n"}, "reference_outputs": ["5\n"], "source_document_id": "p04013", "source_text": "Score : 300 points\n\nProblem Statement\n\nTak has N cards. On the i-th (1 \\leq i \\leq N) card is written an integer x_i.\nHe is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A.\nIn how many ways can he make his selection?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq A \\leq 50\n\n1 \\leq x_i \\leq 50\n\nN,\\,A,\\,x_i are integers.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1 \\leq N \\leq 16.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the number of ways to select cards such that the average of the written integers is exactly A.\n\nSample Input 1\n\n4 8\n7 9 8 9\n\nSample Output 1\n\n5\n\nThe following are the 5 ways to select cards such that the average is 8:\n\nSelect the 3-rd card.\n\nSelect the 1-st and 2-nd cards.\n\nSelect the 1-st and 4-th cards.\n\nSelect the 1-st, 2-nd and 3-rd cards.\n\nSelect the 1-st, 3-rd and 4-th cards.\n\nSample Input 2\n\n3 8\n6 6 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n8 5\n3 6 2 8 7 6 5 9\n\nSample Output 3\n\n19\n\nSample Input 4\n\n33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n\nSample Output 4\n\n8589934591\n\nThe answer may not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 294, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s682904746", "group_id": "codeNet:p04016", "input_text": "var\n\tn,s,b,t,c,ans,i:int64;\nfunction f(b,n:int64):int64;\nvar t,c:int64;\nbegin\n\tt:=n;\n\tc:=0;\n\twhile t>0 do begin\n\t\tc:=c+t mod b;\n\t\tt:=t div b;\n\tend;\n\tf:=c;\nend;\nbegin\n\tread(n,s);\n\tif n=s then begin\n\t\twriteln(n+1);\n\t\texit;\n\tend;\n\ti:=1;\n\tans:=n+s;\n\twhile i*i<=n do begin\n\t\tif(i>1)and(f(i,n)=s)and(ans>i)then ans:=i;\n\t\tif n div i>1 then begin\n\t\t\tt:=f(n div i,n);\n\t\t\tif(t<=s)and((s-t)mod i=0)then begin\n\t\t\t\tb:=n div i-(s-t)div i;\n\t\t\t\tif(b>1)and(f(b,n)=s)and(ans>b)then ans:=b;\n\t\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif ans=n+s then writeln(-1)else writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1539070419, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04016.html", "problem_id": "p04016", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04016/input.txt", "sample_output_relpath": "derived/input_output/data/p04016/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04016/Pascal/s682904746.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s682904746", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var\n\tn,s,b,t,c,ans,i:int64;\nfunction f(b,n:int64):int64;\nvar t,c:int64;\nbegin\n\tt:=n;\n\tc:=0;\n\twhile t>0 do begin\n\t\tc:=c+t mod b;\n\t\tt:=t div b;\n\tend;\n\tf:=c;\nend;\nbegin\n\tread(n,s);\n\tif n=s then begin\n\t\twriteln(n+1);\n\t\texit;\n\tend;\n\ti:=1;\n\tans:=n+s;\n\twhile i*i<=n do begin\n\t\tif(i>1)and(f(i,n)=s)and(ans>i)then ans:=i;\n\t\tif n div i>1 then begin\n\t\t\tt:=f(n div i,n);\n\t\t\tif(t<=s)and((s-t)mod i=0)then begin\n\t\t\t\tb:=n div i-(s-t)div i;\n\t\t\t\tif(b>1)and(f(b,n)=s)and(ans>b)then ans:=b;\n\t\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif ans=n+s then writeln(-1)else writeln(ans);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n\nf(b,n) = n, when n < b\n\nf(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\n\nHere, {\\rm floor}(n / b) denotes the largest integer not exceeding n / b,\nand n \\ {\\rm mod} \\ b denotes the remainder of n divided by b.\n\nLess formally, f(b,n) is equal to the sum of the digits of n written in base b.\nFor example, the following hold:\n\nf(10,\\,87654)=8+7+6+5+4=30\n\nf(100,\\,87654)=8+76+54=138\n\nYou are given integers n and s.\nDetermine if there exists an integer b (b \\geq 2) such that f(b,n)=s.\nIf the answer is positive, also find the smallest such b.\n\nConstraints\n\n1 \\leq n \\leq 10^{11}\n\n1 \\leq s \\leq 10^{11}\n\nn,\\,s are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nn\ns\n\nOutput\n\nIf there exists an integer b (b \\geq 2) such that f(b,n)=s, print the smallest such b.\nIf such b does not exist, print -1 instead.\n\nSample Input 1\n\n87654\n30\n\nSample Output 1\n\n10\n\nSample Input 2\n\n87654\n138\n\nSample Output 2\n\n100\n\nSample Input 3\n\n87654\n45678\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n31415926535\n1\n\nSample Output 4\n\n31415926535\n\nSample Input 5\n\n1\n31415926535\n\nSample Output 5\n\n-1", "sample_input": "87654\n30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p04016", "source_text": "Score : 500 points\n\nProblem Statement\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n\nf(b,n) = n, when n < b\n\nf(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\n\nHere, {\\rm floor}(n / b) denotes the largest integer not exceeding n / b,\nand n \\ {\\rm mod} \\ b denotes the remainder of n divided by b.\n\nLess formally, f(b,n) is equal to the sum of the digits of n written in base b.\nFor example, the following hold:\n\nf(10,\\,87654)=8+7+6+5+4=30\n\nf(100,\\,87654)=8+76+54=138\n\nYou are given integers n and s.\nDetermine if there exists an integer b (b \\geq 2) such that f(b,n)=s.\nIf the answer is positive, also find the smallest such b.\n\nConstraints\n\n1 \\leq n \\leq 10^{11}\n\n1 \\leq s \\leq 10^{11}\n\nn,\\,s are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nn\ns\n\nOutput\n\nIf there exists an integer b (b \\geq 2) such that f(b,n)=s, print the smallest such b.\nIf such b does not exist, print -1 instead.\n\nSample Input 1\n\n87654\n30\n\nSample Output 1\n\n10\n\nSample Input 2\n\n87654\n138\n\nSample Output 2\n\n100\n\nSample Input 3\n\n87654\n45678\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n31415926535\n1\n\nSample Output 4\n\n31415926535\n\nSample Input 5\n\n1\n31415926535\n\nSample Output 5\n\n-1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 555, "cpu_time_ms": 41, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s208125249", "group_id": "codeNet:p04016", "input_text": "var\n\tn,s,b,t,c,ans,i:int64;\nfunction f(b,n:int64):int64;\nvar t,c:int64;\nbegin\n\tt:=n;\n\tc:=0;\n\twhile t>0 do begin\n\t\tc:=c+t mod b;\n\t\tt:=t div b;\n\tend;\n\tf:=c;\nend;\nbegin\n\tread(n,s);\n\ti:=1;\n\tans:=n+b;\n\twhile i*i<=n do begin\n\t\tif(i>1)and(f(i,n)=s)and(ans>i)then ans:=i;\n\t\tif n div i>1 then begin\n\t\t\tt:=f(n div i,n);\n\t\t\tif(t<=s)or((s-t)mod i=0)then begin\n\t\t\t\tb:=n div i+(s-t)div i;\n\t\t\t\tif(b>1)and(f(b,n)=s)and(ans>b)then ans:=b;\n\t\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif ans=n+b then writeln(-1)else writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1539069975, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04016.html", "problem_id": "p04016", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04016/input.txt", "sample_output_relpath": "derived/input_output/data/p04016/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04016/Pascal/s208125249.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s208125249", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var\n\tn,s,b,t,c,ans,i:int64;\nfunction f(b,n:int64):int64;\nvar t,c:int64;\nbegin\n\tt:=n;\n\tc:=0;\n\twhile t>0 do begin\n\t\tc:=c+t mod b;\n\t\tt:=t div b;\n\tend;\n\tf:=c;\nend;\nbegin\n\tread(n,s);\n\ti:=1;\n\tans:=n+b;\n\twhile i*i<=n do begin\n\t\tif(i>1)and(f(i,n)=s)and(ans>i)then ans:=i;\n\t\tif n div i>1 then begin\n\t\t\tt:=f(n div i,n);\n\t\t\tif(t<=s)or((s-t)mod i=0)then begin\n\t\t\t\tb:=n div i+(s-t)div i;\n\t\t\t\tif(b>1)and(f(b,n)=s)and(ans>b)then ans:=b;\n\t\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif ans=n+b then writeln(-1)else writeln(ans);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n\nf(b,n) = n, when n < b\n\nf(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\n\nHere, {\\rm floor}(n / b) denotes the largest integer not exceeding n / b,\nand n \\ {\\rm mod} \\ b denotes the remainder of n divided by b.\n\nLess formally, f(b,n) is equal to the sum of the digits of n written in base b.\nFor example, the following hold:\n\nf(10,\\,87654)=8+7+6+5+4=30\n\nf(100,\\,87654)=8+76+54=138\n\nYou are given integers n and s.\nDetermine if there exists an integer b (b \\geq 2) such that f(b,n)=s.\nIf the answer is positive, also find the smallest such b.\n\nConstraints\n\n1 \\leq n \\leq 10^{11}\n\n1 \\leq s \\leq 10^{11}\n\nn,\\,s are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nn\ns\n\nOutput\n\nIf there exists an integer b (b \\geq 2) such that f(b,n)=s, print the smallest such b.\nIf such b does not exist, print -1 instead.\n\nSample Input 1\n\n87654\n30\n\nSample Output 1\n\n10\n\nSample Input 2\n\n87654\n138\n\nSample Output 2\n\n100\n\nSample Input 3\n\n87654\n45678\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n31415926535\n1\n\nSample Output 4\n\n31415926535\n\nSample Input 5\n\n1\n31415926535\n\nSample Output 5\n\n-1", "sample_input": "87654\n30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p04016", "source_text": "Score : 500 points\n\nProblem Statement\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n\nf(b,n) = n, when n < b\n\nf(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\n\nHere, {\\rm floor}(n / b) denotes the largest integer not exceeding n / b,\nand n \\ {\\rm mod} \\ b denotes the remainder of n divided by b.\n\nLess formally, f(b,n) is equal to the sum of the digits of n written in base b.\nFor example, the following hold:\n\nf(10,\\,87654)=8+7+6+5+4=30\n\nf(100,\\,87654)=8+76+54=138\n\nYou are given integers n and s.\nDetermine if there exists an integer b (b \\geq 2) such that f(b,n)=s.\nIf the answer is positive, also find the smallest such b.\n\nConstraints\n\n1 \\leq n \\leq 10^{11}\n\n1 \\leq s \\leq 10^{11}\n\nn,\\,s are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nn\ns\n\nOutput\n\nIf there exists an integer b (b \\geq 2) such that f(b,n)=s, print the smallest such b.\nIf such b does not exist, print -1 instead.\n\nSample Input 1\n\n87654\n30\n\nSample Output 1\n\n10\n\nSample Input 2\n\n87654\n138\n\nSample Output 2\n\n100\n\nSample Input 3\n\n87654\n45678\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n31415926535\n1\n\nSample Output 4\n\n31415926535\n\nSample Input 5\n\n1\n31415926535\n\nSample Output 5\n\n-1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 505, "cpu_time_ms": 58, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s760261995", "group_id": "codeNet:p04021", "input_text": "var x:array[1..10000]of longint;\nn,i,j:longint;\ntemp,cnt:longint;\nbegin\n readln(n);\n cnt:=0;\n for i:=1 to n do\n begin\n readln(x[i]);\n end;\n for i:=1 to n-1 do\n begin\n if x[i]a[j+1] then\nbegin\ntmp:=a[j];\na[j]:=a[j+1];\na[j+1]:=tmp;\nend;\nend;\nend;\nfor i := 1 to n do\nbegin\nif (i mod 2 =0) <> c[a[i]] then o:=o+1;\nend;\nwriteln(o div 2);\nend.\n", "language": "Pascal", "metadata": {"date": 1502314427, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04021.html", "problem_id": "p04021", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04021/input.txt", "sample_output_relpath": "derived/input_output/data/p04021/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04021/Pascal/s551949293.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s551949293", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\nn,o,i,j,tmp:longint;\na:array [0..100001] of longint;\nc:array [0..1000000001] of boolean;\nbegin\nreadln(n);\nfor i := 1 to n do\nbegin\nreadln(a[i]);\nif i mod 2=0 then c[a[i]]:=true;\nend;\nfor i := 1 to n-1 do\nbegin\nfor j := 1 to n-i do\nbegin\nif a[j]>a[j+1] then\nbegin\ntmp:=a[j];\na[j]:=a[j+1];\na[j+1]:=tmp;\nend;\nend;\nend;\nfor i := 1 to n do\nbegin\nif (i mod 2 =0) <> c[a[i]] then o:=o+1;\nend;\nwriteln(o div 2);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke got an integer sequence of length N from his mother, as a birthday present. The i-th (1 ≦ i ≦ N) element of the sequence is a_i. The elements are pairwise distinct.\nHe is sorting this sequence in increasing order.\nWith supernatural power, he can perform the following two operations on the sequence in any order:\n\nOperation 1: choose 2 consecutive elements, then reverse the order of those elements.\n\nOperation 2: choose 3 consecutive elements, then reverse the order of those elements.\n\nSnuke likes Operation 2, but not Operation 1. Find the minimum number of Operation 1 that he has to perform in order to sort the sequence in increasing order.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n0 ≦ A_i ≦ 10^9\n\nIf i ≠ j, then A_i ≠ A_j.\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the minimum number of times Operation 1 that Snuke has to perform.\n\nSample Input 1\n\n4\n2\n4\n3\n1\n\nSample Output 1\n\n1\n\nThe given sequence can be sorted as follows:\n\nFirst, reverse the order of the last three elements. The sequence is now: 2,1,3,4.\n\nThen, reverse the order of the first two elements. The sequence is now: 1,2,3,4.\n\nIn this sequence of operations, Operation 1 is performed once. It is not possible to sort the sequence with less number of Operation 1, thus the answer is 1.\n\nSample Input 2\n\n5\n10\n8\n5\n3\n2\n\nSample Output 2\n\n0", "sample_input": "4\n2\n4\n3\n1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p04021", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke got an integer sequence of length N from his mother, as a birthday present. The i-th (1 ≦ i ≦ N) element of the sequence is a_i. The elements are pairwise distinct.\nHe is sorting this sequence in increasing order.\nWith supernatural power, he can perform the following two operations on the sequence in any order:\n\nOperation 1: choose 2 consecutive elements, then reverse the order of those elements.\n\nOperation 2: choose 3 consecutive elements, then reverse the order of those elements.\n\nSnuke likes Operation 2, but not Operation 1. Find the minimum number of Operation 1 that he has to perform in order to sort the sequence in increasing order.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n0 ≦ A_i ≦ 10^9\n\nIf i ≠ j, then A_i ≠ A_j.\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the minimum number of times Operation 1 that Snuke has to perform.\n\nSample Input 1\n\n4\n2\n4\n3\n1\n\nSample Output 1\n\n1\n\nThe given sequence can be sorted as follows:\n\nFirst, reverse the order of the last three elements. The sequence is now: 2,1,3,4.\n\nThen, reverse the order of the first two elements. The sequence is now: 1,2,3,4.\n\nIn this sequence of operations, Operation 1 is performed once. It is not possible to sort the sequence with less number of Operation 1, thus the answer is 1.\n\nSample Input 2\n\n5\n10\n8\n5\n3\n2\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 413, "cpu_time_ms": 2106, "memory_kb": 899584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s775028809", "group_id": "codeNet:p04026", "input_text": "program unbalanced;\nuses crt;\nvar\ns: String;\na,b,x,i: Integer ;\ncek: Boolean;\nbegin\ncek:= false;\n ReadLn(s);\n a:=Length(s);\n b:=3;\n for i:=1 to (a-2) do\n x:=1;\n begin\n if (s[i]=s[i+1]) or (s[i]=s[i+2])\n or (s[i+1]=s[i+2])\n then WriteLn(i,' ',i+2);\n cek:=true;\n end; \nif cek = false then WriteLn(-1,' ',-1); \nend.", "language": "Pascal", "metadata": {"date": 1561400560, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04026.html", "problem_id": "p04026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04026/input.txt", "sample_output_relpath": "derived/input_output/data/p04026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04026/Pascal/s775028809.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s775028809", "user_id": "u353919145"}, "prompt_components": {"gold_output": "2 5\n", "input_to_evaluate": "program unbalanced;\nuses crt;\nvar\ns: String;\na,b,x,i: Integer ;\ncek: Boolean;\nbegin\ncek:= false;\n ReadLn(s);\n a:=Length(s);\n b:=3;\n for i:=1 to (a-2) do\n x:=1;\n begin\n if (s[i]=s[i+1]) or (s[i]=s[i+2])\n or (s[i+1]=s[i+2])\n then WriteLn(i,' ',i+2);\n cek:=true;\n end; \nif cek = false then WriteLn(-1,' ',-1); \nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "sample_input": "needed\n"}, "reference_outputs": ["2 5\n"], "source_document_id": "p04026", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s544584126", "group_id": "codeNet:p04033", "input_text": "var\n a,b:longint;\nbegin\n readln(a,b);\n if (a>0) or ((abs(b)-abs(a)) mod 2<>0) then writeln('Positive')\n else if (a=0) or (b=0) or ((a<0) and (b>0)) then writeln('Zero')\n else writeln('Negative');\nend.", "language": "Pascal", "metadata": {"date": 1580422883, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04033.html", "problem_id": "p04033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04033/input.txt", "sample_output_relpath": "derived/input_output/data/p04033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04033/Pascal/s544584126.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s544584126", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Positive\n", "input_to_evaluate": "var\n a,b:longint;\nbegin\n readln(a,b);\n if (a>0) or ((abs(b)-abs(a)) mod 2<>0) then writeln('Positive')\n else if (a=0) or (b=0) or ((a<0) and (b>0)) then writeln('Zero')\n else writeln('Negative');\nend.", "problem_context": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "sample_input": "1 3\n"}, "reference_outputs": ["Positive\n"], "source_document_id": "p04033", "source_text": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 4, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s155129517", "group_id": "codeNet:p04033", "input_text": "uses math;\nvar\n i,j,k,n,m,a,b,c,x,y:longint;\nbegin\n read(a,b);\nif (a<=0) and (b>=0) then writeln('Zero')\n else if (a>=0)and(b>=0) then writeln('Positive')\n else if (a<0)and((b-a+1) mod 2=0) then writeln('Positive')\n else writeln('Negative');\n end.", "language": "Pascal", "metadata": {"date": 1541703810, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04033.html", "problem_id": "p04033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04033/input.txt", "sample_output_relpath": "derived/input_output/data/p04033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04033/Pascal/s155129517.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s155129517", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Positive\n", "input_to_evaluate": "uses math;\nvar\n i,j,k,n,m,a,b,c,x,y:longint;\nbegin\n read(a,b);\nif (a<=0) and (b>=0) then writeln('Zero')\n else if (a>=0)and(b>=0) then writeln('Positive')\n else if (a<0)and((b-a+1) mod 2=0) then writeln('Positive')\n else writeln('Negative');\n end.", "problem_context": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "sample_input": "1 3\n"}, "reference_outputs": ["Positive\n"], "source_document_id": "p04033", "source_text": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 260, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s278617498", "group_id": "codeNet:p04033", "input_text": "var\n a,b:int64;\nbegin\n readln(a,b);\n if (a<=0) and (b>=0) then writeln('Zero')\n else if (a<0) and (b<0) and (abs(a-b) mod 2=0) then writeln('Negative')\n else writeln('Positive');\nend.", "language": "Pascal", "metadata": {"date": 1538328248, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04033.html", "problem_id": "p04033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04033/input.txt", "sample_output_relpath": "derived/input_output/data/p04033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04033/Pascal/s278617498.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s278617498", "user_id": "u426964396"}, "prompt_components": {"gold_output": "Positive\n", "input_to_evaluate": "var\n a,b:int64;\nbegin\n readln(a,b);\n if (a<=0) and (b>=0) then writeln('Zero')\n else if (a<0) and (b<0) and (abs(a-b) mod 2=0) then writeln('Negative')\n else writeln('Positive');\nend.", "problem_context": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "sample_input": "1 3\n"}, "reference_outputs": ["Positive\n"], "source_document_id": "p04033", "source_text": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s772458434", "group_id": "codeNet:p04033", "input_text": "var\n n,a,b,i:longint;\nbegin\n read(a,b); n:=1;\n for i:=a to b do\n if i=0 then begin writeln('Zero'); halt; end\n else if i<0 then n:=-n;\n if n=1 then writeln('Positive')\n else writeln('Negative');\nend.", "language": "Pascal", "metadata": {"date": 1528162143, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04033.html", "problem_id": "p04033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04033/input.txt", "sample_output_relpath": "derived/input_output/data/p04033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04033/Pascal/s772458434.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s772458434", "user_id": "u723721005"}, "prompt_components": {"gold_output": "Positive\n", "input_to_evaluate": "var\n n,a,b,i:longint;\nbegin\n read(a,b); n:=1;\n for i:=a to b do\n if i=0 then begin writeln('Zero'); halt; end\n else if i<0 then n:=-n;\n if n=1 then writeln('Positive')\n else writeln('Negative');\nend.", "problem_context": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "sample_input": "1 3\n"}, "reference_outputs": ["Positive\n"], "source_document_id": "p04033", "source_text": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 973, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s511598206", "group_id": "codeNet:p04037", "input_text": "var n,i,tot,min:longint;\ns:array[1..100000] of longint;\nbegin\n readln(n);\n min:=maxlongint;\n for i:=1 to n do begin\n read(s[i]);\n if s[i]m do dec(j);\n if i<=j then begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if im do dec(j);\n if i<=j then begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if ia[j] then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n end;\n for i:=1 to n do\n inc(s,a[2*i-1]);\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1583471192, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04047.html", "problem_id": "p04047", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04047/input.txt", "sample_output_relpath": "derived/input_output/data/p04047/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04047/Pascal/s139828749.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s139828749", "user_id": "u743614777"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var a:array[0..100]of longint;\n n,i,j,t,s:longint;\nbegin\n readln(n);\n for i:=1 to 2*n do\n read(a[i]);\n for i:=1 to 2*n do\n for j:=i+1 to 2*n do\n if a[i]>a[j] then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n end;\n for i:=1 to n do\n inc(s,a[2*i-1]);\n writeln(s);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke is having a barbeque party.\n\nAt the party, he will make N servings of Skewer Meal.\n\nExample of a serving of Skewer Meal\n\nHe has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i.\nAlso, he has an infinite supply of ingredients.\n\nTo make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers.\nLet the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients.\n\nWhat is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?\n\nConstraints\n\n1≦N≦100\n\n1≦L_i≦100\n\nFor each i, L_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_{2N}\n\nOutput\n\nPrint the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold.\n\nSample Input 1\n\n2\n1 3 1 2\n\nSample Output 1\n\n3\n\nIf he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 1 and 2 ingredients, for the total of 3.\n\nSample Input 2\n\n5\n100 1 2 3 14 15 58 58 58 29\n\nSample Output 2\n\n135", "sample_input": "2\n1 3 1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p04047", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke is having a barbeque party.\n\nAt the party, he will make N servings of Skewer Meal.\n\nExample of a serving of Skewer Meal\n\nHe has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i.\nAlso, he has an infinite supply of ingredients.\n\nTo make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers.\nLet the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients.\n\nWhat is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?\n\nConstraints\n\n1≦N≦100\n\n1≦L_i≦100\n\nFor each i, L_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_{2N}\n\nOutput\n\nPrint the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold.\n\nSample Input 1\n\n2\n1 3 1 2\n\nSample Output 1\n\n3\n\nIf he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 1 and 2 ingredients, for the total of 3.\n\nSample Input 2\n\n5\n100 1 2 3 14 15 58 58 58 29\n\nSample Output 2\n\n135", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 297, "cpu_time_ms": 95, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s849879902", "group_id": "codeNet:p04047", "input_text": "var\n n,i,j,t,s,s1:longint;\n a:array[1..200] of longint;\nbegin\n readln(n);\n for i:=1 to n*2 do read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if a[i]>a[j] then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n end;\n for i:=1 to n*2 do if odd(n) then inc(s,a[i]) else inc(s1,a[i]);\n if sa[j] then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n end;\n for i:=1 to n*2 do if odd(n) then inc(s,a[i]) else inc(s1,a[i]);\n if s