max then begin\n max:=a[i]; rem2:=i;\n End;\n End;\n rem:=min;\n For i:=1 to n do \n If (i<>rem1) and (i<>rem2) then begin\n Inc(count);\n b[count]:=rem; c[count]:=a[i];\n rem:=rem-a[i];\n End;\n Writeln(max-rem);\n For i:=1 to count do writeln(b[count],' ',c[count]);\n Writeln(max,' ',rem);\nEnd.", "language": "Pascal", "metadata": {"date": 1560648860, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03007.html", "problem_id": "p03007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03007/input.txt", "sample_output_relpath": "derived/input_output/data/p03007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03007/Pascal/s830169483.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s830169483", "user_id": "u866155170"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "Var a,b,c:Array[1 .. 100000] of Int64;\n n,rem1,rem2,min,max,rem,count:Int64;\n i:Longint;\nBegin\n Readln(n); min:=10000; max:=-10000; count:=0;\n For i:=1 to n do begin\n Read(a[i]);\n If a[i]max then begin\n max:=a[i]; rem2:=i;\n End;\n End;\n rem:=min;\n For i:=1 to n do \n If (i<>rem1) and (i<>rem2) then begin\n Inc(count);\n b[count]:=rem; c[count]:=a[i];\n rem:=rem-a[i];\n End;\n Writeln(max-rem);\n For i:=1 to count do writeln(b[count],' ',c[count]);\n Writeln(max,' ',rem);\nEnd.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\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\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "sample_input": "3\n1 -1 2\n"}, "reference_outputs": ["4\n-1 1\n2 -2\n"], "source_document_id": "p03007", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\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\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 661, "cpu_time_ms": 48, "memory_kb": 4096}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s248955143", "group_id": "codeNet:p03012", "input_text": "Uses math;\nvar n, i, t : integer;\n w : array[1..100] of integer;\n s1, s2, ans : integer;\nbegin\n readln(n);\n for i := 1 to n do read(w[i]);\n ans := 10000;\n for t := 1 to n - 1 do begin\n s1 := 0; s2 := 0;\n for i := 1 to t do s1 := s1 + w[i];\n for i := t + 1 to n do s2 := s2 + w[i];\n ans := Min(ans, Abs(s1 - s2));\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1560137572, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03012.html", "problem_id": "p03012", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03012/input.txt", "sample_output_relpath": "derived/input_output/data/p03012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03012/Pascal/s248955143.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s248955143", "user_id": "u878615689"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "Uses math;\nvar n, i, t : integer;\n w : array[1..100] of integer;\n s1, s2, ans : integer;\nbegin\n readln(n);\n for i := 1 to n do read(w[i]);\n ans := 10000;\n for t := 1 to n - 1 do begin\n s1 := 0; s2 := 0;\n for i := 1 to t do s1 := s1 + w[i];\n for i := t + 1 to n do s2 := s2 + w[i];\n ans := Min(ans, Abs(s1 - s2));\n end;\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03012", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s931343490", "group_id": "codeNet:p03013", "input_text": "var\nN,MM,i,j:Longint;\nm:int64=1000000007;\na:Array[1..100000]of Longint;\ndp:Array[0..100002]of int64;\nbegin\nread(N,MM);\nfor i:=1 to MM do read(a[i]);\ndp[0]:=1;\nfor i:=1 to N do begin\nwhile(j<=MM)and(a[j]= 2 then \n begin\n for i := 2 to M do\n begin\n read(a); \n n1:= n1*G[a-b-1] mod p;\n b:=a;\n end;\n end;\n \n n1:=n1*G[N-a] mod p;\n\nwrite(n1)\nend.", "language": "Pascal", "metadata": {"date": 1560539681, "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/s002152049.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s002152049", "user_id": "u655683235"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var a,b,N,M,i,n1:int64; //a=a_i、b=a_(i-1)\n G:array[0..100000] of integer;\nconst p=1000000007;\nbegin \n read(N,M);\n\n G[0]:=0;G[1]:=1; //フィボナッチ数列を準備\n for i := 2 to N do\n G[i] :=( G[i-1] + G[i-2] ) mod p;\n \n n1:=1; read(a); \n n1:= n1*G[a] mod p; b:=a;\n \n if M >= 2 then \n begin\n for i := 2 to M do\n begin\n read(a); \n n1:= n1*G[a-b-1] mod p;\n b:=a;\n end;\n end;\n \n n1:=n1*G[N-a] mod p;\n\nwrite(n1)\nend.", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 14, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s815388476", "group_id": "codeNet:p03014", "input_text": "var s :array[1..2010]of array[1..2010]of char;\n u,d,l,r,t :array[1..2010]of array[1..2010]of integer;\n i,j,k,n,h,w,ans :integer;\n \nbegin\n readln(h,w);\n for i:=1 to h do begin\n for j:=1 to w do \n read(s[i][j]);\n readln;\n end;\n {up}\n for j:=1 to w do begin\n if s[1][j]='.' then u[1][j]:=1 else u[1][j]:=0;\n for i:=2 to h do begin\n if s[i][j]='.' then u[i][j]:=u[i-1][j]+1 else u[i][j]:=0;\n end;\n end;\n {down}\n for j:=1 to w do begin\n if s[h][j]='.' then d[h][j]:=1 else d[h][j]:=0;\n for i:=h-1 downto 1 do begin\n if s[i][j]='.' then d[i][j]:=d[i+1][j]+1 else d[i][j]:=0;\n end;\n end;\n {left}\n for i:=1 to h do begin\n if s[i][1]='.' then l[i][1]:=1 else l[i][1]:=0;\n for j:=2 to w do begin\n if s[i][j]='.' then l[i][j]:=l[i][j-1]+1 else l[i][j]:=0;\n end;\n end;\n {right}\n for i:=1 to h do begin\n if s[i][w]='.' then r[i][w]:=1 else r[i][w]:=0;\n for j:=w-1 downto 1 do begin\n if s[i][j]='.' then r[i][j]:=r[i][j+1]+1 else r[i][j]:=0;\n end;\n end;\n \n ans:=0;\n for i:=1 to h do\n for j:=1 to w do begin\n if ans<(u[i][j]+d[i][j]+l[i][j]+r[i][j]-3)\n then ans:=u[i][j]+d[i][j]+l[i][j]+r[i][j]-3;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1561541680, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03014.html", "problem_id": "p03014", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03014/input.txt", "sample_output_relpath": "derived/input_output/data/p03014/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03014/Pascal/s815388476.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s815388476", "user_id": "u805277811"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var s :array[1..2010]of array[1..2010]of char;\n u,d,l,r,t :array[1..2010]of array[1..2010]of integer;\n i,j,k,n,h,w,ans :integer;\n \nbegin\n readln(h,w);\n for i:=1 to h do begin\n for j:=1 to w do \n read(s[i][j]);\n readln;\n end;\n {up}\n for j:=1 to w do begin\n if s[1][j]='.' then u[1][j]:=1 else u[1][j]:=0;\n for i:=2 to h do begin\n if s[i][j]='.' then u[i][j]:=u[i-1][j]+1 else u[i][j]:=0;\n end;\n end;\n {down}\n for j:=1 to w do begin\n if s[h][j]='.' then d[h][j]:=1 else d[h][j]:=0;\n for i:=h-1 downto 1 do begin\n if s[i][j]='.' then d[i][j]:=d[i+1][j]+1 else d[i][j]:=0;\n end;\n end;\n {left}\n for i:=1 to h do begin\n if s[i][1]='.' then l[i][1]:=1 else l[i][1]:=0;\n for j:=2 to w do begin\n if s[i][j]='.' then l[i][j]:=l[i][j-1]+1 else l[i][j]:=0;\n end;\n end;\n {right}\n for i:=1 to h do begin\n if s[i][w]='.' then r[i][w]:=1 else r[i][w]:=0;\n for j:=w-1 downto 1 do begin\n if s[i][j]='.' then r[i][j]:=r[i][j+1]+1 else r[i][j]:=0;\n end;\n end;\n \n ans:=0;\n for i:=1 to h do\n for j:=1 to w do begin\n if ans<(u[i][j]+d[i][j]+l[i][j]+r[i][j]-3)\n then ans:=u[i][j]+d[i][j]+l[i][j]+r[i][j]-3;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "sample_input": "4 6\n#..#..\n.....#\n....#.\n#.#...\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03014", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1226, "cpu_time_ms": 214, "memory_kb": 67584}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s177456179", "group_id": "codeNet:p03014", "input_text": "Uses math;\nvar h, w, i, j, k, cnt, start, ans : int64;\n s : array[1..2001] of array[1..2001] of char;\n tate, yoko : array[1..2001] of array[1..2001] of int64;\n temp : char;\nbegin\n readln(h, w);\n for i := 1 to h do begin\n for j := 1 to w do read(s[i][j]);\n read(temp);\n s[i][w+1] := '#';\n end;\n for i := 1 to w+1 do s[h+1][i] := '#';\n \n for i := 1 to h do begin\n for j := 1 to w do begin\n tate[i][j] := 0; yoko[i][j] := 0;\n end;\n end;\n \n for i := 1 to h do begin\n cnt := 0;\n start := 1;\n \n for j := 1 to w+1 do begin\n if s[i][j] = '.' then inc(cnt) else begin\n for k := start to j-1 do yoko[i][k] := cnt;\n start := j+1;\n cnt := 0;\n end;\n end;\n end;\n \n for j := 1 to w do begin\n cnt := 0;\n start := 1;\n \n for i := 1 to h+1 do begin\n if s[i][j] = '.' then inc(cnt) else begin\n for k := start to i-1 do tate[k][j] := cnt;\n start := i+1;\n cnt := 0;\n end;\n end;\n end;\n \n ans := 0;\n for i := 1 to h do begin\n for j := 1 to w do begin\n if s[i][j] = '#' then Continue;\n ans := Max(ans, tate[i][j] + yoko[i][j] - 1);\n end;\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1560140960, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03014.html", "problem_id": "p03014", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03014/input.txt", "sample_output_relpath": "derived/input_output/data/p03014/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03014/Pascal/s177456179.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s177456179", "user_id": "u878615689"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "Uses math;\nvar h, w, i, j, k, cnt, start, ans : int64;\n s : array[1..2001] of array[1..2001] of char;\n tate, yoko : array[1..2001] of array[1..2001] of int64;\n temp : char;\nbegin\n readln(h, w);\n for i := 1 to h do begin\n for j := 1 to w do read(s[i][j]);\n read(temp);\n s[i][w+1] := '#';\n end;\n for i := 1 to w+1 do s[h+1][i] := '#';\n \n for i := 1 to h do begin\n for j := 1 to w do begin\n tate[i][j] := 0; yoko[i][j] := 0;\n end;\n end;\n \n for i := 1 to h do begin\n cnt := 0;\n start := 1;\n \n for j := 1 to w+1 do begin\n if s[i][j] = '.' then inc(cnt) else begin\n for k := start to j-1 do yoko[i][k] := cnt;\n start := j+1;\n cnt := 0;\n end;\n end;\n end;\n \n for j := 1 to w do begin\n cnt := 0;\n start := 1;\n \n for i := 1 to h+1 do begin\n if s[i][j] = '.' then inc(cnt) else begin\n for k := start to i-1 do tate[k][j] := cnt;\n start := i+1;\n cnt := 0;\n end;\n end;\n end;\n \n ans := 0;\n for i := 1 to h do begin\n for j := 1 to w do begin\n if s[i][j] = '#' then Continue;\n ans := Max(ans, tate[i][j] + yoko[i][j] - 1);\n end;\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "sample_input": "4 6\n#..#..\n.....#\n....#.\n#.#...\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03014", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 221, "memory_kb": 66688}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s461004799", "group_id": "codeNet:p03017", "input_text": "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 N-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('Yse');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1560883193, "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/s461004799.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s461004799", "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 N-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('Yse');\n end;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 566, "cpu_time_ms": 6, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s317164799", "group_id": "codeNet:p03030", "input_text": "var\n\tN,i,j,tmp:Longint;\n\tS:array[1..100]of String[10];\n\tP,id:array[1..100]of Longint;\n\tt:String;\nbegin\n\treadln(N);\n\tfor i:=1 to N do begin\n\t\tid[i]:=i;\n\t\treadln(t);\n\t\tj:=1;\n\t\twhile t[j]<>' ' do begin\n\t\t\tS[i]:=S[i]+t[j];\n\t\t\tinc(j);\n\t\tend;\n\t\tinc(j);\n\t\tfor j:=j to length(t)do begin\n\t\t\tP[i]:=P[i]*10+ord(t[j])-48;\n\t\tend;\n\t\tfor j:=i-1 downto 1 do begin\n\t\t\tif(S[id[j]]>S[id[j+1]])or((S[id[j]]=S[id[j+1]])and(P[id[j]]' ' do begin\n\t\t\tS[i]:=S[i]+t[j];\n\t\t\tinc(j);\n\t\tend;\n\t\tinc(j);\n\t\tfor j:=j to length(t)do begin\n\t\t\tP[i]:=P[i]*10+ord(t[j])-48;\n\t\tend;\n\t\tfor j:=i-1 downto 1 do begin\n\t\t\tif(S[id[j]]>S[id[j+1]])or((S[id[j]]=S[id[j+1]])and(P[id[j]]
>(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": 1558941410, "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/s807118689.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s807118689", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s013746243", "group_id": "codeNet:p03031", "input_text": "var\n\tr1,r2,ans,id,N,M,i,j,k,s:Longint;\n\tA:array[1..10,1..10]of Boolean;\n\tB:array[1..10,1..11]of Boolean;\n\ttmp: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\t\tB[i,s]:=True;\n\t\tend;\n\tend;\n\tfor i:=1 to M do begin\n\t\tread(s);\n\t\tif s=1 then B[i,N+1]:=True;\n\tend;\n\tfor i:=1 to M do begin\n\t\tif i>N then break;\n\t\tid:=i;\n\t\twhile(id<=M)and(not A[i,id])do inc(id);\n\t\tif id>N then continue;\n\t\tfor j:=i to N do begin\n\t\t\ttmp:=A[id,j];\n\t\t\tA[id,j]:=A[i,j];\n\t\t\tA[i,j]:=tmp;\n\t\tend;\n\t\tfor j:=i+1 to M do begin\n\t\t\tif A[j,i]then begin\n\t\t\t\tfor k:=i to N do begin\n\t\t\t\t\tA[j,k]:=A[j,k]xor A[i,k];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tr1:=0;\n\twhile True do begin\n\t\ttmp:=False;\n\t\tfor i:=1 to N do if A[r1+1,i]then begin\n\t\t\tinc(r1);\n\t\t\ttmp:=True;\n\t\t\tbreak;\n\t\tend;\n\t\tif(not tmp)or(r1=M)then break;\n\tend;\n\tfor i:=1 to M do begin\n\t\tif i>N+1 then break;\n\t\tid:=i;\n\t\twhile(id<=M)and(not B[i,id])do inc(id);\n\t\tif id>N+1 then continue;\n\t\tfor j:=i to N+1 do begin\n\t\t\ttmp:=B[id,j];\n\t\t\tB[id,j]:=B[i,j];\n\t\t\tB[i,j]:=tmp;\n\t\tend;\n\t\tfor j:=i+1 to M do begin\n\t\t\tif B[j,i]then begin\n\t\t\t\tfor k:=i to N+1 do begin\n\t\t\t\t\tB[j,k]:=B[j,k]xor B[i,k];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tr2:=0;\n\twhile True do begin\n\t\ttmp:=False;\n\t\tfor i:=1 to N+1 do if B[r2+1,i]then begin\n\t\t\tinc(r2);\n\t\t\ttmp:=True;\n\t\t\tbreak;\n\t\tend;\n\t\tif(not tmp)or(r2=M)then break;\n\tend;\n\tans:=1;\n\tif r1<>r2 then ans:=0;\n\tfor i:=1 to N-r1 do ans:=ans*2;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1558938873, "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/s013746243.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s013746243", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tr1,r2,ans,id,N,M,i,j,k,s:Longint;\n\tA:array[1..10,1..10]of Boolean;\n\tB:array[1..10,1..11]of Boolean;\n\ttmp: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\t\tB[i,s]:=True;\n\t\tend;\n\tend;\n\tfor i:=1 to M do begin\n\t\tread(s);\n\t\tif s=1 then B[i,N+1]:=True;\n\tend;\n\tfor i:=1 to M do begin\n\t\tif i>N then break;\n\t\tid:=i;\n\t\twhile(id<=M)and(not A[i,id])do inc(id);\n\t\tif id>N then continue;\n\t\tfor j:=i to N do begin\n\t\t\ttmp:=A[id,j];\n\t\t\tA[id,j]:=A[i,j];\n\t\t\tA[i,j]:=tmp;\n\t\tend;\n\t\tfor j:=i+1 to M do begin\n\t\t\tif A[j,i]then begin\n\t\t\t\tfor k:=i to N do begin\n\t\t\t\t\tA[j,k]:=A[j,k]xor A[i,k];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tr1:=0;\n\twhile True do begin\n\t\ttmp:=False;\n\t\tfor i:=1 to N do if A[r1+1,i]then begin\n\t\t\tinc(r1);\n\t\t\ttmp:=True;\n\t\t\tbreak;\n\t\tend;\n\t\tif(not tmp)or(r1=M)then break;\n\tend;\n\tfor i:=1 to M do begin\n\t\tif i>N+1 then break;\n\t\tid:=i;\n\t\twhile(id<=M)and(not B[i,id])do inc(id);\n\t\tif id>N+1 then continue;\n\t\tfor j:=i to N+1 do begin\n\t\t\ttmp:=B[id,j];\n\t\t\tB[id,j]:=B[i,j];\n\t\t\tB[i,j]:=tmp;\n\t\tend;\n\t\tfor j:=i+1 to M do begin\n\t\t\tif B[j,i]then begin\n\t\t\t\tfor k:=i to N+1 do begin\n\t\t\t\t\tB[j,k]:=B[j,k]xor B[i,k];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\tr2:=0;\n\twhile True do begin\n\t\ttmp:=False;\n\t\tfor i:=1 to N+1 do if B[r2+1,i]then begin\n\t\t\tinc(r2);\n\t\t\ttmp:=True;\n\t\t\tbreak;\n\t\tend;\n\t\tif(not tmp)or(r2=M)then break;\n\tend;\n\tans:=1;\n\tif r1<>r2 then ans:=0;\n\tfor i:=1 to N-r1 do ans:=ans*2;\n\twriteln(ans);\nend.\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 130, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s175616089", "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\tfor i:=1 to N do LRsorted[i]:=0;\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 ans= x then write(y-x+1);\nend.\n", "language": "Pascal", "metadata": {"date": 1559919205, "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/s174273867.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s174273867", "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:=100000;\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.\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 21, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s462358421", "group_id": "codeNet:p03037", "input_text": "const C=1000000; \nvar N,M,i,j,x,y:integer;\nG:array [1..C,1..2] of integer;\n begin\n read(N,M);\n y:=0;\n for i := 1 to M do begin\n read(G[i,1],G[i,2]) end;\n for i := G[1,1] to G[1,2] do \n begin x:=1;\n for j := 2 to M do \n begin \n if (G[j,1]<=i)and(i<=G[j,2]) then x:= x+1 end;\n if x >= M then y:=y+1 end;\n writeln(y);\nend.", "language": "Pascal", "metadata": {"date": 1559829528, "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/s462358421.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s462358421", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const C=1000000; \nvar N,M,i,j,x,y:integer;\nG:array [1..C,1..2] of integer;\n begin\n read(N,M);\n y:=0;\n for i := 1 to M do begin\n read(G[i,1],G[i,2]) end;\n for i := G[1,1] to G[1,2] do \n begin x:=1;\n for j := 2 to M do \n begin \n if (G[j,1]<=i)and(i<=G[j,2]) then x:= x+1 end;\n if x >= M then y:=y+1 end;\n writeln(y);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2107, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s002996961", "group_id": "codeNet:p03037", "input_text": "const C=1000000; \nvar N,M,i,j,x,y:integer;\nG:array [1..C,1..2] of integer;\n begin\n read(N,M);\n y:=0;\n for i := 1 to M do begin\n read(G[i,1],G[i,2]) end;\n for i := 1 to N do \n begin x:=0;\n for j := 1 to M do \n begin \n if (G[j,1]<=i)and(i<=G[j,2]) then x:= x+1 end;\n if x >= M then y:=y+1 end;\n writeln(y);\nend.", "language": "Pascal", "metadata": {"date": 1559829036, "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/s002996961.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s002996961", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const C=1000000; \nvar N,M,i,j,x,y:integer;\nG:array [1..C,1..2] of integer;\n begin\n read(N,M);\n y:=0;\n for i := 1 to M do begin\n read(G[i,1],G[i,2]) end;\n for i := 1 to N do \n begin x:=0;\n for j := 1 to M do \n begin \n if (G[j,1]<=i)and(i<=G[j,2]) then x:= x+1 end;\n if x >= M then y:=y+1 end;\n writeln(y);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2107, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s812295138", "group_id": "codeNet:p03038", "input_text": "type\n pair = record\n b : int64;\n c : integer;\n end;\n\tpairArray = array[1..200000] of pair;\n\nvar cur,i,n,m:longint;\n sum:int64;\n bc : pairArray;\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].c;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].ca[pos] then begin\n sum := sum + bc[cur].c;\n bc[cur].b := bc[cur].b - 1;\n if bc[cur].b=0 then cur := cur - 1\n end else begin\n sum := sum + a[pos];\n pos := pos - 1;\n end;\n writeln(sum)\nend.", "language": "Pascal", "metadata": {"date": 1558838256, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Pascal/s426412870.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s426412870", "user_id": "u492212770"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "type\n\tintArray = array[1..100000] of int64;\n pair = record\n b : int64;\n c : integer;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar cur,pos,i,n,m:longint;\n sum:int64;\n a:intArray;\n bc : pairArray;\n\nprocedure\tswap(var a,b:int64);\nvar tmp:int64;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure\tswapP(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n \nprocedure QuickSort(var a:intArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2];\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i]a[pos] then begin\n sum := sum + bc[cur].c;\n bc[cur].b := bc[cur].b - 1;\n if bc[cur].b=0 then cur := cur - 1\n end else begin\n sum := sum + a[pos];\n pos := pos - 1;\n end;\n writeln(sum)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\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, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\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, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1729, "cpu_time_ms": 61, "memory_kb": 2432}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s263907025", "group_id": "codeNet:p03041", "input_text": "var N,K:integer;\n S:string;\nbegin\nread(N,K,S);\nif S[K]='A' then S[K]:='a';\nif S[K]='B' then S[K]:='b';\nif S[K]='C' then S[K]:='c';\nwrite(S)\nend.", "language": "Pascal", "metadata": {"date": 1561610199, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03041.html", "problem_id": "p03041", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03041/input.txt", "sample_output_relpath": "derived/input_output/data/p03041/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03041/Pascal/s263907025.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s263907025", "user_id": "u655683235"}, "prompt_components": {"gold_output": "aBC\n", "input_to_evaluate": "var N,K:integer;\n S:string;\nbegin\nread(N,K,S);\nif S[K]='A' then S[K]:='a';\nif S[K]='B' then S[K]:='b';\nif S[K]='C' then S[K]:='c';\nwrite(S)\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "sample_input": "3 1\nABC\n"}, "reference_outputs": ["aBC\n"], "source_document_id": "p03041", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s094005722", "group_id": "codeNet:p03041", "input_text": "var str:array[1..52]of char;\n n,k,i:integer;\nbegin\n readln(n,k);\n for i:=1 to n do read(str[i]);\n if str[k]='A' then str[k]:='a';\n if str[k]='B' then str[k]:='b';\n if str[k]='C' then str[k]:='c';\n for i:=1 to n do writeln(str[i]);\nend.", "language": "Pascal", "metadata": {"date": 1558760412, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03041.html", "problem_id": "p03041", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03041/input.txt", "sample_output_relpath": "derived/input_output/data/p03041/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03041/Pascal/s094005722.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s094005722", "user_id": "u805277811"}, "prompt_components": {"gold_output": "aBC\n", "input_to_evaluate": "var str:array[1..52]of char;\n n,k,i:integer;\nbegin\n readln(n,k);\n for i:=1 to n do read(str[i]);\n if str[k]='A' then str[k]:='a';\n if str[k]='B' then str[k]:='b';\n if str[k]='C' then str[k]:='c';\n for i:=1 to n do writeln(str[i]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "sample_input": "3 1\nABC\n"}, "reference_outputs": ["aBC\n"], "source_document_id": "p03041", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 244, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s452403023", "group_id": "codeNet:p03042", "input_text": "uses crt;\nvar n,a,b:longint;\nbegin\n readln(n);\n a:=n div 100;\n b:=n mod 100;\n if(a<12)and(a<>0)and(b<>0)then write('AMBIGUOUS')else\n if(a=12)and(b=12)then write('AMBIGUOUS')else\n if(a>12)and(b>12)then write('NA')else\n if(a>12)and(b=0)then write('NA') else\n if(a=0)and(b=0)then write('NA')else\n if(a=0)and(b<>0)then write('NA')else \n if (a<12)and(a>1)and(b>12)then write('MMYY') else\n if (a=12)and(b>12)then write('MMYY') else\n if (a=1)and(b>12)then write('MMYY') else\n if (a=12)and(b<=12)then write('MMYY') else\n if(a<>0)and(b<=1) then write('MMYY')else\n if (a=1)and(b>=1)then write('MMYY') else\n if (a>12)and(b<>0)and(b<=12)then write('YYMM');\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577746557, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03042.html", "problem_id": "p03042", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03042/input.txt", "sample_output_relpath": "derived/input_output/data/p03042/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03042/Pascal/s452403023.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s452403023", "user_id": "u684763923"}, "prompt_components": {"gold_output": "YYMM\n", "input_to_evaluate": "uses crt;\nvar n,a,b:longint;\nbegin\n readln(n);\n a:=n div 100;\n b:=n mod 100;\n if(a<12)and(a<>0)and(b<>0)then write('AMBIGUOUS')else\n if(a=12)and(b=12)then write('AMBIGUOUS')else\n if(a>12)and(b>12)then write('NA')else\n if(a>12)and(b=0)then write('NA') else\n if(a=0)and(b=0)then write('NA')else\n if(a=0)and(b<>0)then write('NA')else \n if (a<12)and(a>1)and(b>12)then write('MMYY') else\n if (a=12)and(b>12)then write('MMYY') else\n if (a=1)and(b>12)then write('MMYY') else\n if (a=12)and(b<=12)then write('MMYY') else\n if(a<>0)and(b<=1) then write('MMYY')else\n if (a=1)and(b>=1)then write('MMYY') else\n if (a>12)and(b<>0)and(b<=12)then write('YYMM');\n readln\nend.\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have a digit sequence S of length 4. You are wondering which of the following formats S is in:\n\nYYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order\n\nMMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order\n\nIf S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.\n\nConstraints\n\nS is a digit sequence of length 4.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the specified string: YYMM, MMYY, AMBIGUOUS or NA.\n\nSample Input 1\n\n1905\n\nSample Output 1\n\nYYMM\n\nMay XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.\n\nSample Input 2\n\n0112\n\nSample Output 2\n\nAMBIGUOUS\n\nBoth December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.\n\nSample Input 3\n\n1700\n\nSample Output 3\n\nNA\n\nNeither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.", "sample_input": "1905\n"}, "reference_outputs": ["YYMM\n"], "source_document_id": "p03042", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have a digit sequence S of length 4. You are wondering which of the following formats S is in:\n\nYYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order\n\nMMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order\n\nIf S is valid in only YYMM format, print YYMM; if S is valid in only MMYY format, print MMYY; if S is valid in both formats, print AMBIGUOUS; if S is valid in neither format, print NA.\n\nConstraints\n\nS is a digit sequence of length 4.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the specified string: YYMM, MMYY, AMBIGUOUS or NA.\n\nSample Input 1\n\n1905\n\nSample Output 1\n\nYYMM\n\nMay XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.\n\nSample Input 2\n\n0112\n\nSample Output 2\n\nAMBIGUOUS\n\nBoth December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.\n\nSample Input 3\n\n1700\n\nSample Output 3\n\nNA\n\nNeither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s941981383", "group_id": "codeNet:p03043", "input_text": "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 2 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": 1558332224, "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/s941981383.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s941981383", "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 2 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s931944736", "group_id": "codeNet:p03043", "input_text": "var\n\tN,K,i,p,q,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 else q:=N;\n\tmake:=1;\n\tget:=1;\n\tfor i:=1 to 0 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 p1 do begin\n\t\t\tnow:=now*0.5;\n\t\t\ttmp:=tmp div 2;\n\t\tend;\n\t\tans:=ans+now;\n\tend;\n\twriteln(ans:0:9);\nend.\n", "language": "Pascal", "metadata": {"date": 1558331779, "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/s931944736.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s931944736", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0.145833333333\n", "input_to_evaluate": "var\n\tN,K,i,p,q,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 else q:=N;\n\tmake:=1;\n\tget:=1;\n\tfor i:=1 to 0 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 p1 do begin\n\t\t\tnow:=now*0.5;\n\t\t\ttmp:=tmp div 2;\n\t\tend;\n\t\tans:=ans+now;\n\tend;\n\twriteln(ans:0:9);\nend.\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s791422157", "group_id": "codeNet:p03048", "input_text": "var s,r,g,b,n,t:Longint;\nbegin\nread(r,g,b,n);\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": 1576748960, "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/s791422157.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s791422157", "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);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 49, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s000627344", "group_id": "codeNet:p03048", "input_text": "var ir,ig,r,g,b,n,ans,temp: longint;\n\nbegin\n read(r,g,b,n);\n ans := 0;\n for ir := 0 to 3000 do begin\n for ig := 0 to 3000 do begin\n temp:=n - ir * r - ig * g;\n if temp<0 then break;\n if temp mod b = 0 then ans := ans + 1;\n end;\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1557624868, "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/s000627344.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s000627344", "user_id": "u492212770"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var ir,ig,r,g,b,n,ans,temp: longint;\n\nbegin\n read(r,g,b,n);\n ans := 0;\n for ir := 0 to 3000 do begin\n for ig := 0 to 3000 do begin\n temp:=n - ir * r - ig * g;\n if temp<0 then break;\n if temp mod b = 0 then ans := ans + 1;\n end;\n end;\n writeln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 67, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s103393993", "group_id": "codeNet:p03049", "input_text": "var t,i,n,ans : longint;\n b : array[1..3] of longint;\n p,c : char;\n\n\nfunction min(a,b:int64):int64;\nbegin\n if a < b then min := a else min := b\nend;\n\nbegin\n read(n);\n ans := 0;\n for t := 1 to 3 do b[t] := 0;\n for i := 0 to n do begin\n read(p);\n if p = 'B' then t := 1 else t := 0;\n while not eoln do begin\n read(c);\n if (p = 'A') and (c = 'B') then ans := ans + 1;\n p := c\n end;\n readln;\n if c = 'A' then t := t + 2;\n if t > 0 then b[t] := b[t] + 1\n end;\n if (b[1] = 0) and (b[2] = 0) and (b[3] > 0) then ans := ans + b[3] - 1\n else ans := ans + min(b[1],b[2]) + b[3];\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1557632305, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03049.html", "problem_id": "p03049", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03049/input.txt", "sample_output_relpath": "derived/input_output/data/p03049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03049/Pascal/s103393993.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s103393993", "user_id": "u492212770"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var t,i,n,ans : longint;\n b : array[1..3] of longint;\n p,c : char;\n\n\nfunction min(a,b:int64):int64;\nbegin\n if a < b then min := a else min := b\nend;\n\nbegin\n read(n);\n ans := 0;\n for t := 1 to 3 do b[t] := 0;\n for i := 0 to n do begin\n read(p);\n if p = 'B' then t := 1 else t := 0;\n while not eoln do begin\n read(c);\n if (p = 'A') and (c = 'B') then ans := ans + 1;\n p := c\n end;\n readln;\n if c = 'A' then t := t + 2;\n if t > 0 then b[t] := b[t] + 1\n end;\n if (b[1] = 0) and (b[2] = 0) and (b[3] > 0) then ans := ans + b[3] - 1\n else ans := ans + min(b[1],b[2]) + b[3];\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "sample_input": "3\nABCA\nXBAZ\nBAD\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03049", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 640, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s839748913", "group_id": "codeNet:p03049", "input_text": "var t,i,n,ans : integer;\n b : array[1..3] of integer;\n p,c : char;\n\n\nfunction min(a,b:int64):int64;\nbegin\n if a < b then min := a else min := b\nend;\n\nbegin\n read(n);\n ans := 0;\n for t := 1 to 3 do b[t] := 0;\n for i := 0 to n do begin\n read(p);\n if p = 'B' then t := 1 else t := 0;\n while not eoln do begin\n read(c);\n if (p = 'A') and (c = 'B') then ans := ans + 1;\n p := c\n end;\n readln;\n if c = 'A' then t := t + 2;\n if t > 0 then b[t] := b[t] + 1\n end;\n if (b[1] = 0) and (b[2] = 0) then ans := ans + b[3] - 1\n else ans := ans + min(b[1],b[2]) + b[3];\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1557625918, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03049.html", "problem_id": "p03049", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03049/input.txt", "sample_output_relpath": "derived/input_output/data/p03049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03049/Pascal/s839748913.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s839748913", "user_id": "u492212770"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var t,i,n,ans : integer;\n b : array[1..3] of integer;\n p,c : char;\n\n\nfunction min(a,b:int64):int64;\nbegin\n if a < b then min := a else min := b\nend;\n\nbegin\n read(n);\n ans := 0;\n for t := 1 to 3 do b[t] := 0;\n for i := 0 to n do begin\n read(p);\n if p = 'B' then t := 1 else t := 0;\n while not eoln do begin\n read(c);\n if (p = 'A') and (c = 'B') then ans := ans + 1;\n p := c\n end;\n readln;\n if c = 'A' then t := t + 2;\n if t > 0 then b[t] := b[t] + 1\n end;\n if (b[1] = 0) and (b[2] = 0) then ans := ans + b[3] - 1\n else ans := ans + min(b[1],b[2]) + b[3];\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "sample_input": "3\nABCA\nXBAZ\nBAD\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03049", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 625, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s093481800", "group_id": "codeNet:p03050", "input_text": "var i : longint;\n n,ans:int64;\n\nbegin\n read(n);\n ans := 0;\n for i := 1 to 999999 do begin\n if (i+1)*(i+1)>n then break;\n if n mod i = 0 then\n if n div i - 1 > i then ans := ans + n div i - 1\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1557626734, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03050.html", "problem_id": "p03050", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03050/input.txt", "sample_output_relpath": "derived/input_output/data/p03050/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03050/Pascal/s093481800.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s093481800", "user_id": "u492212770"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var i : longint;\n n,ans:int64;\n\nbegin\n read(n);\n ans := 0;\n for i := 1 to 999999 do begin\n if (i+1)*(i+1)>n then break;\n if n mod i = 0 then\n if n div i - 1 > i then ans := ans + n div i - 1\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke received a positive integer N from Takahashi.\nA positive integer m is called a favorite number when the following condition is satisfied:\n\nThe quotient and remainder of N divided by m are equal, that is, \\lfloor \\frac{N}{m} \\rfloor = N \\bmod m holds.\n\nFind all favorite numbers and print the sum of those.\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 answer.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n10\n\nThere are two favorite numbers: 3 and 7. Print the sum of these, 10.\n\nSample Input 2\n\n1000000000000\n\nSample Output 2\n\n2499686339916\n\nWatch out for overflow.", "sample_input": "8\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03050", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke received a positive integer N from Takahashi.\nA positive integer m is called a favorite number when the following condition is satisfied:\n\nThe quotient and remainder of N divided by m are equal, that is, \\lfloor \\frac{N}{m} \\rfloor = N \\bmod m holds.\n\nFind all favorite numbers and print the sum of those.\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 answer.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n10\n\nThere are two favorite numbers: 3 and 7. Print the sum of these, 10.\n\nSample Input 2\n\n1000000000000\n\nSample Output 2\n\n2499686339916\n\nWatch out for overflow.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 12, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s911595927", "group_id": "codeNet:p03062", "input_text": "var a:array[1..100010]of integer;\n n,i,j,m,mabs:integer;\n ans:int64;\n zero:boolean;\nbegin\n readln(n);\n m:=0;\n zero:=false;\n mabs:=100000010;\n for i:=1 to n do begin\n read(a[i]);\n if mabs>abs(a[i]) then \n mabs:=abs(a[i]);\n if a[i]<0 then inc(m);\n if a[i]=0 then zero:=true\n end;\n ans:=0;\n for i:=1 to n do \n if a[i]>0 then inc(ans,a[i])\n else inc(ans,-a[i]);\n if (m mod 2<>0) and not zero then\n ans:=ans-2*mabs;\n write(ans)\nend.", "language": "Pascal", "metadata": {"date": 1556454069, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Pascal/s911595927.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s911595927", "user_id": "u805277811"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "var a:array[1..100010]of integer;\n n,i,j,m,mabs:integer;\n ans:int64;\n zero:boolean;\nbegin\n readln(n);\n m:=0;\n zero:=false;\n mabs:=100000010;\n for i:=1 to n do begin\n read(a[i]);\n if mabs>abs(a[i]) then \n mabs:=abs(a[i]);\n if a[i]<0 then inc(m);\n if a[i]=0 then zero:=true\n end;\n ans:=0;\n for i:=1 to n do \n if a[i]>0 then inc(ans,a[i])\n else inc(ans,-a[i]);\n if (m mod 2<>0) and not zero then\n ans:=ans-2*mabs;\n write(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\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 value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\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 value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s738979803", "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 maxm0) and not zero then\n ans:=ans-maxm;\n write(ans)\nend.\n", "language": "Pascal", "metadata": {"date": 1556451454, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Pascal/s738979803.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s738979803", "user_id": "u805277811"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "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 maxm0) and not zero then\n ans:=ans-maxm;\n write(ans)\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\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 value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\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 value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 433, "cpu_time_ms": 18, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s390893517", "group_id": "codeNet:p03067", "input_text": "var a,b,c:integer;\n\nbegin\n read(a,b,c);\n if (a-c)*(b-c)<0 Then writeln('Yes') else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1555808675, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03067.html", "problem_id": "p03067", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03067/input.txt", "sample_output_relpath": "derived/input_output/data/p03067/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03067/Pascal/s390893517.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s390893517", "user_id": "u492212770"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var a,b,c:integer;\n\nbegin\n read(a,b,c);\n if (a-c)*(b-c)<0 Then writeln('Yes') else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "sample_input": "3 8 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03067", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s629447477", "group_id": "codeNet:p03068", "input_text": "var s:array[1..11] of char;\n n,k,i:integer;\nbegin\n read(n);\n for i:=1 to n do read(s[i]);\n read(k);\n for i:=1 to n do \n if s[i]=s[k] then write(s[k])\n else write('*');\nend.\n", "language": "Pascal", "metadata": {"date": 1555809639, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03068.html", "problem_id": "p03068", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03068/input.txt", "sample_output_relpath": "derived/input_output/data/p03068/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03068/Pascal/s629447477.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s629447477", "user_id": "u805277811"}, "prompt_components": {"gold_output": "*rr*r\n", "input_to_evaluate": "var s:array[1..11] of char;\n n,k,i:integer;\nbegin\n read(n);\n for i:=1 to n do read(s[i]);\n read(k);\n for i:=1 to n do \n if s[i]=s[k] then write(s[k])\n else write('*');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters, and an integer K.\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nConstraints\n\n1 \\leq K \\leq N\\leq 10\n\nS is a string of length N consisting of lowercase English letters.\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nK\n\nOutput\n\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nSample Input 1\n\n5\nerror\n2\n\nSample Output 1\n\n*rr*r\n\nThe second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.\n\nSample Input 2\n\n6\neleven\n5\n\nSample Output 2\n\ne*e*e*\n\nSample Input 3\n\n9\neducation\n7\n\nSample Output 3\n\n******i**", "sample_input": "5\nerror\n2\n"}, "reference_outputs": ["*rr*r\n"], "source_document_id": "p03068", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters, and an integer K.\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nConstraints\n\n1 \\leq K \\leq N\\leq 10\n\nS is a string of length N consisting of lowercase English letters.\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nK\n\nOutput\n\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nSample Input 1\n\n5\nerror\n2\n\nSample Output 1\n\n*rr*r\n\nThe second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.\n\nSample Input 2\n\n6\neleven\n5\n\nSample Output 2\n\ne*e*e*\n\nSample Input 3\n\n9\neducation\n7\n\nSample Output 3\n\n******i**", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 7, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s596125781", "group_id": "codeNet:p03069", "input_text": "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:=0 to n do t[i]:=s[i]+n+s[i]-i-s[n];\n for i:=0 to n do ans:=min(ans,t[i]);\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1555868950, "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/s596125781.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s596125781", "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:=0 to n do t[i]:=s[i]+n+s[i]-i-s[n];\n for i:=0 to n do ans:=min(ans,t[i]);\n writeln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 7, "memory_kb": 1664}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s656462022", "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:=1 to n do begin\n if s[i]=s[i-1] then begin\n j:=min(s[i],n+s[i]-i-s[n]);\n ans:=min(ans,j)\n end\n end;\n write(ans)\nend.", "language": "Pascal", "metadata": {"date": 1555867059, "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/s656462022.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s656462022", "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:=1 to n do begin\n if s[i]=s[i-1] then begin\n j:=min(s[i],n+s[i]-i-s[n]);\n ans:=min(ans,j)\n end\n end;\n write(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 463, "cpu_time_ms": 7, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s084093954", "group_id": "codeNet:p03071", "input_text": "type ary=array[1..100001]of char;\nvar a,b,i,j :integer;\n c:char;\n l :ary;\n \nbegin\n j:=1; a:=0; b:=0;\n for i:=1 to 100001 do \n if i mod 2 = 0 then l[i]:='0'\n else l[i]:='1';\n repeat\n read(c);\n if c=l[j] then inc(a)\n else inc(b);\n inc(j)\n until eoln ;\n if aord(S[i])-48 then inc(now);\n\tans:=now;\n\tnow:=0;\n\tfor i:=1 to n do if(i+1)mod 2<>ord(S[i])-48 then inc(now);\n\tif ans>now then ans:=now;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1581731860, "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/s979416982.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s979416982", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tS:String;\n\tans,now,i,n:Longint;\nbegin\n\treadln(S);\n\tn:=length(S);\n\tfor i:=1 to n do if i mod 2<>ord(S[i])-48 then inc(now);\n\tans:=now;\n\tnow:=0;\n\tfor i:=1 to n do if(i+1)mod 2<>ord(S[i])-48 then inc(now);\n\tif ans>now then ans:=now;\n\twriteln(ans);\nend.\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 4, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s040923466", "group_id": "codeNet:p03073", "input_text": "Uses math;\nvar i,count1,count2:integer;\n S:string; //count1:010101.._count2:101010\nbegin\nread(S);i:=1;\nwhile ord(S[i]) > 40 do\n begin\n if i mod 2 = 1 then begin\n if S[i]='0' then inc(count1) else inc(count2) end \n else begin if S[i]='1' then inc(count1) else inc(count2) end;\n inc(i);\nend;\nwrite(min(count1,count2))\nend.", "language": "Pascal", "metadata": {"date": 1561590864, "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/s040923466.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s040923466", "user_id": "u655683235"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "Uses math;\nvar i,count1,count2:integer;\n S:string; //count1:010101.._count2:101010\nbegin\nread(S);i:=1;\nwhile ord(S[i]) > 40 do\n begin\n if i mod 2 = 1 then begin\n if S[i]='0' then inc(count1) else inc(count2) end \n else begin if S[i]='1' then inc(count1) else inc(count2) end;\n inc(i);\nend;\nwrite(min(count1,count2))\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 329, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s758019593", "group_id": "codeNet:p03080", "input_text": "var n,i,a,b:integer;\n c:char;\nbegin\n read(n);a:=0;b:=0;\n for i:=1 to n do\n begin\n read(c);\n if c='R' then inc(a)\n else inc(b);\n end;\n if a>b then write('Yes')\n else write('No')\nend.\n", "language": "Pascal", "metadata": {"date": 1553982056, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03080.html", "problem_id": "p03080", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03080/input.txt", "sample_output_relpath": "derived/input_output/data/p03080/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03080/Pascal/s758019593.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s758019593", "user_id": "u805277811"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var n,i,a,b:integer;\n c:char;\nbegin\n read(n);a:=0;b:=0;\n for i:=1 to n do\n begin\n read(c);\n if c='R' then inc(a)\n else inc(b);\n end;\n if a>b then write('Yes')\n else write('No')\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each person wears a red hat or a blue hat.\n\nYou are given a string s representing the colors of the people. Person i wears a red hat if s_i is R, and a blue hat if s_i is B.\n\nDetermine if there are more people wearing a red hat than people wearing a blue hat.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|s| = N\n\ns_i is R or B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there are more people wearing a red hat than there are people wearing a blue hat, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nRRBR\n\nSample Output 1\n\nYes\n\nThere are three people wearing a red hat, and one person wearing a blue hat.\n\nSince there are more people wearing a red hat than people wearing a blue hat, the answer is Yes.\n\nSample Input 2\n\n4\nBRBR\n\nSample Output 2\n\nNo\n\nThere are two people wearing a red hat, and two people wearing a blue hat.\n\nSince there are as many people wearing a red hat as people wearing a blue hat, the answer is No.", "sample_input": "4\nRRBR\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03080", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each person wears a red hat or a blue hat.\n\nYou are given a string s representing the colors of the people. Person i wears a red hat if s_i is R, and a blue hat if s_i is B.\n\nDetermine if there are more people wearing a red hat than people wearing a blue hat.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|s| = N\n\ns_i is R or B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there are more people wearing a red hat than there are people wearing a blue hat, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nRRBR\n\nSample Output 1\n\nYes\n\nThere are three people wearing a red hat, and one person wearing a blue hat.\n\nSince there are more people wearing a red hat than people wearing a blue hat, the answer is Yes.\n\nSample Input 2\n\n4\nBRBR\n\nSample Output 2\n\nNo\n\nThere are two people wearing a red hat, and two people wearing a blue hat.\n\nSince there are as many people wearing a red hat as people wearing a blue hat, the answer is No.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s863475825", "group_id": "codeNet:p03087", "input_text": "var\n\tS:String;\n\tN,Q,l,r,i:Longint;\n\tsum:Array[1..100000]of Longint;\nbegin\n\treadln(N,Q);\n\treadln(S);\n\tfor i:=2 to length(S)do begin\n\t\tsum[i]:=sum[i-1];\n\t\tif(S[i-1]='A')and(S[i]='C')then inc(sum[i]);\n\tend;\n\tfor i:=1 to Q do begin\n\t\tread(l,r);\n\t\twriteln(sum[r]-sum[l]);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1581731999, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Pascal/s863475825.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s863475825", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "var\n\tS:String;\n\tN,Q,l,r,i:Longint;\n\tsum:Array[1..100000]of Longint;\nbegin\n\treadln(N,Q);\n\treadln(S);\n\tfor i:=2 to length(S)do begin\n\t\tsum[i]:=sum[i-1];\n\t\tif(S[i-1]='A')and(S[i]='C')then inc(sum[i]);\n\tend;\n\tfor i:=1 to Q do begin\n\t\tread(l,r);\n\t\twriteln(sum[r]-sum[l]);\n\tend;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 40, "memory_kb": 1152}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620991063", "group_id": "codeNet:p03090", "input_text": "var n:integer;i:integer;j:integer;\nbegin\n read(n);\n if n mod 2=1 then begin\n writeln(Trunc(n*(n-1)/2-n/2+1));\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if i+j<>N+1 then begin\n\t writeln(i);\n\t\t writeln(j);\n\t end;\n end else begin\n writeln(n*(n-1)/2-n/2);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if i+j<>N then begin\n\t writeln(i);\n\t\t writeln(j);\n\t end;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1565063170, "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/s620991063.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s620991063", "user_id": "u656771711"}, "prompt_components": {"gold_output": "2\n1 3\n2 3\n", "input_to_evaluate": "var n:integer;i:integer;j:integer;\nbegin\n read(n);\n if n mod 2=1 then begin\n writeln(Trunc(n*(n-1)/2-n/2+1));\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if i+j<>N+1 then begin\n\t writeln(i);\n\t\t writeln(j);\n\t end;\n end else begin\n writeln(n*(n-1)/2-n/2);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if i+j<>N then begin\n\t writeln(i);\n\t\t writeln(j);\n\t end;\n end;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s758069443", "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;\nwriteln(n*(n-1)div 2-n div 2);\nfor i:=1 to n do begin\nfor j:=i+1 to t-i-1 do writeln(i,' ',j);\nif(j=t-i-1)or(j=t-i)then j:=t-i+1;\nfor j:=j to n do writeln(i,' ',j);\nend;\nend.", "language": "Pascal", "metadata": {"date": 1553383891, "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/s758069443.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758069443", "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;\nwriteln(n*(n-1)div 2-n div 2);\nfor i:=1 to n do begin\nfor j:=i+1 to t-i-1 do writeln(i,' ',j);\nif(j=t-i-1)or(j=t-i)then j:=t-i+1;\nfor j:=j to n do writeln(i,' ',j);\nend;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 258, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s881564613", "group_id": "codeNet:p03096", "input_text": "var\n i,n:longint;\n a,ys,xg,f:array[0..200010] of longint;\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];\n if xg[i]>i+1 then f[xg[i]]:=f[xg[i]]+f[i];\n end;\n writeln(f[n]);\nend.", "language": "Pascal", "metadata": {"date": 1569840570, "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/s881564613.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s881564613", "user_id": "u005813231"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n i,n:longint;\n a,ys,xg,f:array[0..200010] of longint;\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];\n if xg[i]>i+1 then f[xg[i]]:=f[xg[i]]+f[i];\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 358, "cpu_time_ms": 28, "memory_kb": 3200}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s619054208", "group_id": "codeNet:p03101", "input_text": "var n,m,c,i,j,sum,a,ans :integer;\n b:array[1..30] of integer;\nbegin\n readln(n,m,c);\n ans:=0;\n for i:=1 to m do read(b[i]);\n readln;\n for i:=1 to n do begin\n sum:=c;\n for j:=1 to m do begin\n read(a);\n sum:=sum+a*b[j];\n end;\n readln;\n if sum>0 then ans:=ans+1\n end;\n write(ans);\n end.", "language": "Pascal", "metadata": {"date": 1552165128, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03101.html", "problem_id": "p03101", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03101/input.txt", "sample_output_relpath": "derived/input_output/data/p03101/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03101/Pascal/s619054208.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s619054208", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,m,c,i,j,sum,a,ans :integer;\n b:array[1..30] of integer;\nbegin\n readln(n,m,c);\n ans:=0;\n for i:=1 to m do read(b[i]);\n readln;\n for i:=1 to n do begin\n sum:=c;\n for j:=1 to m do begin\n read(a);\n sum:=sum+a*b[j];\n end;\n readln;\n if sum>0 then ans:=ans+1\n end;\n write(ans);\n end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are H rows and W columns of white square cells.\n\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\n\nHow many white cells will remain?\n\nIt can be proved that this count does not depend on what rows and columns are chosen.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 20\n\n1 \\leq h \\leq H\n\n1 \\leq w \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nh w\n\nOutput\n\nPrint the number of white cells that will remain.\n\nSample Input 1\n\n3 2\n2 1\n\nSample Output 1\n\n1\n\nThere are 3 rows and 2 columns of cells. When two rows and one column are chosen and painted in black, there is always one white cell that remains.\n\nSample Input 2\n\n5 5\n2 3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2 4\n2 4\n\nSample Output 3\n\n0", "sample_input": "3 2\n2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03101", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are H rows and W columns of white square cells.\n\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\n\nHow many white cells will remain?\n\nIt can be proved that this count does not depend on what rows and columns are chosen.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 20\n\n1 \\leq h \\leq H\n\n1 \\leq w \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nh w\n\nOutput\n\nPrint the number of white cells that will remain.\n\nSample Input 1\n\n3 2\n2 1\n\nSample Output 1\n\n1\n\nThere are 3 rows and 2 columns of cells. When two rows and one column are chosen and painted in black, there is always one white cell that remains.\n\nSample Input 2\n\n5 5\n2 3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2 4\n2 4\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s201978440", "group_id": "codeNet:p03102", "input_text": "var n,m,c,i,j,sum,a,ans :integer;\n b:array[1..30] of integer;\nbegin\n readln(n,m,c);\n ans:=0;\n for i:=1 to m do read(b[i]);\n for i:=1 to n do begin\n sum:=c;\n for j:=1 to m do begin\n read(a);\n sum:=sum+a*b[i];\n end;\n readln;\n if sum>0 then ans:=ans+1\n end;\n write(ans);\n end.\n", "language": "Pascal", "metadata": {"date": 1552163578, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Pascal/s201978440.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s201978440", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,m,c,i,j,sum,a,ans :integer;\n b:array[1..30] of integer;\nbegin\n readln(n,m,c);\n ans:=0;\n for i:=1 to m do read(b[i]);\n for i:=1 to n do begin\n sum:=c;\n for j:=1 to m do begin\n read(a);\n sum:=sum+a*b[i];\n end;\n readln;\n if sum>0 then ans:=ans+1\n end;\n write(ans);\n end.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s186293826", "group_id": "codeNet:p03103", "input_text": "var\n\ta,b:array[0..100010] of longint;\n\tans:int64;\n\tn,m,i:longint;\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\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 l0 do\n\tbegin\n\t\tif m<=b[i] then\n\t\tbegin\n\t\t\tans:=ans+m*a[i];\n\t\t\tbreak;\n\t\tend;\n\t\tm:=m-b[i];\n\t\tans:=ans+a[i]*b[i];\n\t\tinc(i);\n\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1552162516, "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/s186293826.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s186293826", "user_id": "u957998623"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var\n\ta,b:array[0..100010] of longint;\n\tans:int64;\n\tn,m,i:longint;\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\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 l0 do\n\tbegin\n\t\tif m<=b[i] then\n\t\tbegin\n\t\t\tans:=ans+m*a[i];\n\t\t\tbreak;\n\t\tend;\n\t\tm:=m-b[i];\n\t\tans:=ans+a[i]*b[i];\n\t\tinc(i);\n\tend;\n\twriteln(ans);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 643, "cpu_time_ms": 34, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s993214794", "group_id": "codeNet:p03107", "input_text": "type itemp = ^item;\n item = record\n cont : char;\n next : itemp;\n end;\nvar s : itemp;\n n : integer;\n\nprocedure readitem(var p:itemp);{頭から追加}\nvar q : itemp;\nbegin\n q := p;\n new(p);\n read(p^.cont);\n p^.next := q\nend;\n\nprocedure delitem(var p : itemp);{頭から消す}\nbegin\n p := p^.next\nend;\n\nbegin\n n:= 0;\n s:=nil;\n while not eoln do begin\n readitem(s);\n if s^.next <> nil then\n if Ord(s^.cont)+Ord(s^.next^.cont) = 97 then begin\n n := n + 2;\n delitem(s); delitem(s)\n end\n end;\n writeln(n)\nend.", "language": "Pascal", "metadata": {"date": 1551645339, "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/s993214794.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s993214794", "user_id": "u492212770"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "type itemp = ^item;\n item = record\n cont : char;\n next : itemp;\n end;\nvar s : itemp;\n n : integer;\n\nprocedure readitem(var p:itemp);{頭から追加}\nvar q : itemp;\nbegin\n q := p;\n new(p);\n read(p^.cont);\n p^.next := q\nend;\n\nprocedure delitem(var p : itemp);{頭から消す}\nbegin\n p := p^.next\nend;\n\nbegin\n n:= 0;\n s:=nil;\n while not eoln do begin\n readitem(s);\n if s^.next <> nil then\n if Ord(s^.cont)+Ord(s^.next^.cont) = 97 then begin\n n := n + 2;\n delitem(s); delitem(s)\n end\n end;\n writeln(n)\nend.", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 6, "memory_kb": 3200}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s872157089", "group_id": "codeNet:p03112", "input_text": "const\n\ttmax=10000;\n\tinf=tmax*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,tt,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 l=a[len] then\n\tbegin\n\t\tans.t1:=a[len];\n\t\tans.t2:=a[len];\n\t\tans.tans:=a[len];\n\t\texit(ans);\n\tend;\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 l=a[len] then\n\tbegin\n\t\tans.t1:=a[len];\n\t\tans.t2:=a[len];\n\t\tans.tans:=a[len];\n\t\texit(ans);\n\tend;\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 l=a[len] then\n\tbegin\n\t\tans.t1:=a[len];\n\t\tans.t2:=a[len];\n\t\tans.tans:=a[len];\n\t\texit(ans);\n\tend;\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 l=a[len] then\n\tbegin\n\t\tans.t1:=a[len];\n\t\tans.t2:=a[len];\n\t\tans.tans:=a[len];\n\t\texit(ans);\n\tend;\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])0) then\n\t\t\tbegin \n\t\t\t\tmin:=a[i];\n\t\t\t\tt:=i;\n\t\t\tend;\n\t\tfor i:=1 to n do\n\t\t\tif i<>t then \n\t\t\t\tif a[i]>0 then \n\t\t\t\tbegin\n\t\t\t\t\ta[i]:=a[i] mod min;\n\t\t\t\t\tif a[i]=0 then inc(sum);\n\t\t\t\tend;\n\tend;\n\twriteln(min)\nend.", "language": "Pascal", "metadata": {"date": 1550370385, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Pascal/s978602756.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978602756", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const\n\tinf=1000000000;\nvar\n\ta:array[0..100010] of longint;\n\tn,min,sum,i,t:longint;\nbegin\n\treadln(n);\n\tmin:=inf;\n\tfor i:=1 to n do read(a[i]);\n\tsum:=0;\n\twhile sum0) then\n\t\t\tbegin \n\t\t\t\tmin:=a[i];\n\t\t\t\tt:=i;\n\t\t\tend;\n\t\tfor i:=1 to n do\n\t\t\tif i<>t then \n\t\t\t\tif a[i]>0 then \n\t\t\t\tbegin\n\t\t\t\t\ta[i]:=a[i] mod min;\n\t\t\t\t\tif a[i]=0 then inc(sum);\n\t\t\t\tend;\n\tend;\n\twriteln(min)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\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 possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\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 possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 18, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s984659389", "group_id": "codeNet:p03128", "input_text": "const\n\tnum:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\ta:array[-10..10] of longint;\n\tf:array[-1110..10010] of longint;\n\ti,j,n,m,t:longint;\nbegin\n\treadln(n,m);\n\tfor i:=1 to m do read(a[i]);\n\tfor i:=1 to m-1 do\n\t\tfor j:=1 to m-i do\n\t\t\tif a[j]f[j] then\n\t\t\t\tf[j]:=f[j-num[a[i]]]+1;\n\tfor i:=1 to m do\n\t\twhile (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do\n\t\tbegin\n\t\t\tn:=n-num[a[i]];\n\t\t\twrite(a[i]);\n\t\tend;\n\twriteln;\nend.", "language": "Pascal", "metadata": {"date": 1550376301, "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/s984659389.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s984659389", "user_id": "u957998623"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "const\n\tnum:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\ta:array[-10..10] of longint;\n\tf:array[-1110..10010] of longint;\n\ti,j,n,m,t:longint;\nbegin\n\treadln(n,m);\n\tfor i:=1 to m do read(a[i]);\n\tfor i:=1 to m-1 do\n\t\tfor j:=1 to m-i do\n\t\t\tif a[j]f[j] then\n\t\t\t\tf[j]:=f[j-num[a[i]]]+1;\n\tfor i:=1 to m do\n\t\twhile (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do\n\t\tbegin\n\t\t\tn:=n-num[a[i]];\n\t\t\twrite(a[i]);\n\t\tend;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 604, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s919847341", "group_id": "codeNet:p03128", "input_text": "const\n\tnum:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\ta:array[-10..10] of longint;\n\tf:array[-1110..10010] of longint;\n\ti,j,n,m,t:longint;\nbegin\n\treadln(n,m);\n\tfor i:=1 to m do read(a[i]);\n\tfor i:=1 to m-1 do\n\t\tfor j:=1 to m-i do\n\t\t\tif a[j]f[j] then\n\t\t\t\tf[j]:=f[j-num[a[i]]]+1;\n\tfor i:=1 to m do\n\t\twhile (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do\n\t\tbegin\n\t\t\tif (f[n]=1) and (n<>num[a[i]]) then break;\n\t\t\tn:=n-num[a[i]];\n\t\t\twrite(a[i]);\n\t\tend;\n\twriteln;\nend.", "language": "Pascal", "metadata": {"date": 1550374737, "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/s919847341.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s919847341", "user_id": "u957998623"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "const\n\tnum:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\ta:array[-10..10] of longint;\n\tf:array[-1110..10010] of longint;\n\ti,j,n,m,t:longint;\nbegin\n\treadln(n,m);\n\tfor i:=1 to m do read(a[i]);\n\tfor i:=1 to m-1 do\n\t\tfor j:=1 to m-i do\n\t\t\tif a[j]f[j] then\n\t\t\t\tf[j]:=f[j-num[a[i]]]+1;\n\tfor i:=1 to m do\n\t\twhile (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do\n\t\tbegin\n\t\t\tif (f[n]=1) and (n<>num[a[i]]) then break;\n\t\t\tn:=n-num[a[i]];\n\t\t\twrite(a[i]);\n\t\tend;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 627, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s570911579", "group_id": "codeNet:p03128", "input_text": "const\n\tnum:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\ta:array[-10..10] of longint;\n\tf:array[-1110..10010] of longint;\n\ti,j,n,m,t:longint;\nbegin\n\treadln(n,m);\n\tfor i:=1 to m do read(a[i]);\n\tfor i:=1 to m-1 do\n\t\tfor j:=1 to m-i do\n\t\t\tif a[j]f[j] then\n\t\t\t\tf[j]:=f[j-num[a[i]]]+1;\n\tfor i:=1 to m do\n\tbegin\n\t\tif f[n]=1 then\n\t\t\tif num[a[i]]=n then\n\t\t\tbegin\n\t\t\t\twrite(a[i]);\n\t\t\t\tbreak;\n\t\t\tend\n\t\t\telse continue;\n\t\twhile (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do\n\t\tbegin\n\t\t\tn:=n-num[a[i]];\n\t\t\twrite(a[i]);\n\t\t\tif (f[n]=1) and (n<>num[a[i]]) then break;\n\t\tend;\n\tend;\n\twriteln;\nend.", "language": "Pascal", "metadata": {"date": 1550374599, "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/s570911579.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s570911579", "user_id": "u957998623"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "const\n\tnum:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\ta:array[-10..10] of longint;\n\tf:array[-1110..10010] of longint;\n\ti,j,n,m,t:longint;\nbegin\n\treadln(n,m);\n\tfor i:=1 to m do read(a[i]);\n\tfor i:=1 to m-1 do\n\t\tfor j:=1 to m-i do\n\t\t\tif a[j]f[j] then\n\t\t\t\tf[j]:=f[j-num[a[i]]]+1;\n\tfor i:=1 to m do\n\tbegin\n\t\tif f[n]=1 then\n\t\t\tif num[a[i]]=n then\n\t\t\tbegin\n\t\t\t\twrite(a[i]);\n\t\t\t\tbreak;\n\t\t\tend\n\t\t\telse continue;\n\t\twhile (f[n-num[a[i]]]+1=f[n]) and (n>=num[a[i]]) do\n\t\tbegin\n\t\t\tn:=n-num[a[i]];\n\t\t\twrite(a[i]);\n\t\t\tif (f[n]=1) and (n<>num[a[i]]) then break;\n\t\tend;\n\tend;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 742, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s021799583", "group_id": "codeNet:p03129", "input_text": "var n,k:integer;begin readln(n,k);if(n>=2*k-1)then writeln('YES') else writeln('NO');end.", "language": "Pascal", "metadata": {"date": 1597552157, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03129.html", "problem_id": "p03129", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03129/input.txt", "sample_output_relpath": "derived/input_output/data/p03129/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03129/Pascal/s021799583.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s021799583", "user_id": "u984276646"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var n,k:integer;begin readln(n,k);if(n>=2*k-1)then writeln('YES') else writeln('NO');end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.\n\nConstraints\n\n1\\leq N,K\\leq 100\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\nIf we can choose K integers as above, print YES; otherwise, print NO.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\nYES\n\nWe can choose 1 and 3.\n\nSample Input 2\n\n5 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n31 10\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n10 90\n\nSample Output 4\n\nNO", "sample_input": "3 2\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03129", "source_text": "Score : 100 points\n\nProblem Statement\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.\n\nConstraints\n\n1\\leq N,K\\leq 100\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\nIf we can choose K integers as above, print YES; otherwise, print NO.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\nYES\n\nWe can choose 1 and 3.\n\nSample Input 2\n\n5 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n31 10\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n10 90\n\nSample Output 4\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 1348}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s915930676", "group_id": "codeNet:p03132", "input_text": "var\n\tn,i,e,m,fz,fe,fo,se,sz:longint;\n\nbegin\n\treadln(n);\n\tfz := 0;\n\tfe := 0;\n\tfo := 0;\n\tse := 0;\n\tfz := 0;\n\tfor i := 1 to n do\n\tbegin\n\t\treadln(e);\n\t\tm := fz;\n\t\tfz := m + e;\n\t\t\n\t\tif fe < m then\n\t\t\tm := fe;\n\t\tif e = 0 then\n\t\t\tfe := m + 2\n\t\telse\n\t\t\tfe := m + (e and 1);\n\t\t\n\t\tif fo < m then\n\t\t\tm := fo;\n\t\tfo := m + ((e + 1) and 1);\n\t\t\n\t\tif se < m then\n\t\t\tm := se;\n\t\tif e = 0 then\n\t\t\tse := m + 2\n\t\telse\n\t\t\tse := m + (e and 1);\n\t\t\n\t\tif sz < m then\n\t\t\tm := sz;\n\t\tsz := m + e;\n\tend;\n\tm := fz;\n\tif fe < m then\n\t\tm := fe;\n\tif fo < m then\n\t\tm := fo;\n\tif se < m then\n\t\tm := se;\t\n\tif sz < m then\n\t\tm := sz;\n\twriteln(m);\nend.\n", "language": "Pascal", "metadata": {"date": 1550137679, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03132.html", "problem_id": "p03132", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03132/input.txt", "sample_output_relpath": "derived/input_output/data/p03132/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03132/Pascal/s915930676.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s915930676", "user_id": "u564847900"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tn,i,e,m,fz,fe,fo,se,sz:longint;\n\nbegin\n\treadln(n);\n\tfz := 0;\n\tfe := 0;\n\tfo := 0;\n\tse := 0;\n\tfz := 0;\n\tfor i := 1 to n do\n\tbegin\n\t\treadln(e);\n\t\tm := fz;\n\t\tfz := m + e;\n\t\t\n\t\tif fe < m then\n\t\t\tm := fe;\n\t\tif e = 0 then\n\t\t\tfe := m + 2\n\t\telse\n\t\t\tfe := m + (e and 1);\n\t\t\n\t\tif fo < m then\n\t\t\tm := fo;\n\t\tfo := m + ((e + 1) and 1);\n\t\t\n\t\tif se < m then\n\t\t\tm := se;\n\t\tif e = 0 then\n\t\t\tse := m + 2\n\t\telse\n\t\t\tse := m + (e and 1);\n\t\t\n\t\tif sz < m then\n\t\t\tm := sz;\n\t\tsz := m + e;\n\tend;\n\tm := fz;\n\tif fe < m then\n\t\tm := fe;\n\tif fo < m then\n\t\tm := fo;\n\tif se < m then\n\t\tm := se;\t\n\tif sz < m then\n\t\tm := sz;\n\twriteln(m);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions:\n\nHe never visits a point with coordinate less than 0, or a point with coordinate greater than L.\n\nHe starts walking at a point with integer coordinate, and also finishes walking at a point with integer coordinate.\n\nHe only changes direction at a point with integer coordinate.\n\nEach time when Snuke passes a point with coordinate i-0.5, where i is an integer, he put a stone in his i-th ear.\n\nAfter Snuke finishes walking, Ringo will repeat the following operations in some order so that, for each i, Snuke's i-th ear contains A_i stones:\n\nPut a stone in one of Snuke's ears.\n\nRemove a stone from one of Snuke's ears.\n\nFind the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nConstraints\n\n1 \\leq L \\leq 2\\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq L)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\nA_1\n:\nA_L\n\nOutput\n\nPrint the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nSample Input 1\n\n4\n1\n0\n2\n3\n\nSample Output 1\n\n1\n\nAssume that Snuke walks as follows:\n\nHe starts walking at coordinate 3 and finishes walking at coordinate 4, visiting coordinates 3,4,3,2,3,4 in this order.\n\nThen, Snuke's four ears will contain 0,0,2,3 stones, respectively.\nRingo can satisfy the requirement by putting one stone in the first ear.\n\nSample Input 2\n\n8\n2\n0\n0\n2\n1\n3\n4\n1\n\nSample Output 2\n\n3\n\nSample Input 3\n\n7\n314159265\n358979323\n846264338\n327950288\n419716939\n937510582\n0\n\nSample Output 3\n\n1", "sample_input": "4\n1\n0\n2\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03132", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions:\n\nHe never visits a point with coordinate less than 0, or a point with coordinate greater than L.\n\nHe starts walking at a point with integer coordinate, and also finishes walking at a point with integer coordinate.\n\nHe only changes direction at a point with integer coordinate.\n\nEach time when Snuke passes a point with coordinate i-0.5, where i is an integer, he put a stone in his i-th ear.\n\nAfter Snuke finishes walking, Ringo will repeat the following operations in some order so that, for each i, Snuke's i-th ear contains A_i stones:\n\nPut a stone in one of Snuke's ears.\n\nRemove a stone from one of Snuke's ears.\n\nFind the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nConstraints\n\n1 \\leq L \\leq 2\\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq L)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\nA_1\n:\nA_L\n\nOutput\n\nPrint the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nSample Input 1\n\n4\n1\n0\n2\n3\n\nSample Output 1\n\n1\n\nAssume that Snuke walks as follows:\n\nHe starts walking at coordinate 3 and finishes walking at coordinate 4, visiting coordinates 3,4,3,2,3,4 in this order.\n\nThen, Snuke's four ears will contain 0,0,2,3 stones, respectively.\nRingo can satisfy the requirement by putting one stone in the first ear.\n\nSample Input 2\n\n8\n2\n0\n0\n2\n1\n3\n4\n1\n\nSample Output 2\n\n3\n\nSample Input 3\n\n7\n314159265\n358979323\n846264338\n327950288\n419716939\n937510582\n0\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 611, "cpu_time_ms": 33, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s549921672", "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(right,' ',left);\nend.", "language": "Pascal", "metadata": {"date": 1599235617, "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/s549921672.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549921672", "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(right,' ',left);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1348}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s765401131", "group_id": "codeNet:p03149", "input_text": "var a:array[1..4] of integer;n1,n2,n3,n4,s,tmp,i,j:integer;\nbegin\nfor i:=1 to 4 do begin\nread(a[i]);\nend;\nfor i:=1 to 3 do begin\nif(a[i]>a[i+1])then begin\nj:=i+1;\nwhile(j>1)do begin\nif(a[j-1]>a[j])then begin\ntmp:=a[j];\na[j]:=a[j-1];\na[j-1]:=tmp;\nend;\nj:=j-1;\nend;\nend;\nend;\ns:=1000*a[1]+100*a[2]+10*a[3]+a[4];\nif(s=1479)then writeln('YES') else writeln('NO');\nend.", "language": "Pascal", "metadata": {"date": 1599951017, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03149.html", "problem_id": "p03149", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03149/input.txt", "sample_output_relpath": "derived/input_output/data/p03149/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03149/Pascal/s765401131.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s765401131", "user_id": "u984276646"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var a:array[1..4] of integer;n1,n2,n3,n4,s,tmp,i,j:integer;\nbegin\nfor i:=1 to 4 do begin\nread(a[i]);\nend;\nfor i:=1 to 3 do begin\nif(a[i]>a[i+1])then begin\nj:=i+1;\nwhile(j>1)do begin\nif(a[j-1]>a[j])then begin\ntmp:=a[j];\na[j]:=a[j-1];\na[j-1]:=tmp;\nend;\nj:=j-1;\nend;\nend;\nend;\ns:=1000*a[1]+100*a[2]+10*a[3]+a[4];\nif(s=1479)then writeln('YES') else writeln('NO');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n\nN_1, N_2, N_3 and N_4 are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN_1 N_2 N_3 N_4\n\nOutput\n\nIf N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits \"1974\", print YES; if they cannot, print NO.\n\nSample Input 1\n\n1 7 9 4\n\nSample Output 1\n\nYES\n\nWe can get 1974 by swapping N_2 and N_3.\n\nSample Input 2\n\n1 9 7 4\n\nSample Output 2\n\nYES\n\nWe already have 1974 before doing anything.\n\nSample Input 3\n\n1 2 9 1\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n4 9 0 8\n\nSample Output 4\n\nNO", "sample_input": "1 7 9 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03149", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n\nN_1, N_2, N_3 and N_4 are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN_1 N_2 N_3 N_4\n\nOutput\n\nIf N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits \"1974\", print YES; if they cannot, print NO.\n\nSample Input 1\n\n1 7 9 4\n\nSample Output 1\n\nYES\n\nWe can get 1974 by swapping N_2 and N_3.\n\nSample Input 2\n\n1 9 7 4\n\nSample Output 2\n\nYES\n\nWe already have 1974 before doing anything.\n\nSample Input 3\n\n1 2 9 1\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n4 9 0 8\n\nSample Output 4\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 364, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s938427670", "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 longint;\nbegin\n fillchar(f,sizeof(f),0);\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 while f[t]=2 do dec(t);\n f[t]:=1;\n dec(t);\n if (p=0) then begin ans:=a[q]+ans; f[q]:=2; inc(q); end\n else if f[q]=1 then begin if f[p]=1 then begin ans:=a[p-1]+ans; f[p-1]:=2; dec(p,3); end else begin ans:=a[p]+ans; f[p]:=2; dec(p,2); end; end\n else if f[p]=1 then begin ans:=a[p-1]+ans; f[p-1]:=2; dec(p,3); end\n else if s-a[p]<=a[q]-s then\n begin\n ans:=a[p]+ans;\n dec(p);\n f[p]:=2; \n end else\n begin\n ans:=a[q]+ans;\n inc(q);\n f[q]:=2; \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": 1547330168, "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/s938427670.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s938427670", "user_id": "u223928734"}, "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 longint;\nbegin\n fillchar(f,sizeof(f),0);\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 while f[t]=2 do dec(t);\n f[t]:=1;\n dec(t);\n if (p=0) then begin ans:=a[q]+ans; f[q]:=2; inc(q); end\n else if f[q]=1 then begin if f[p]=1 then begin ans:=a[p-1]+ans; f[p-1]:=2; dec(p,3); end else begin ans:=a[p]+ans; f[p]:=2; dec(p,2); end; end\n else if f[p]=1 then begin ans:=a[p-1]+ans; f[p-1]:=2; dec(p,3); end\n else if s-a[p]<=a[q]-s then\n begin\n ans:=a[p]+ans;\n dec(p);\n f[p]:=2; \n end else\n begin\n ans:=a[q]+ans;\n inc(q);\n f[q]:=2; \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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1110, "cpu_time_ms": 2103, "memory_kb": 1792}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s047936902", "group_id": "codeNet:p03162", "input_text": "uses math; \nvar\n n, i, j, k, ans : longint;\n a, dp : array[1..100005, 1..5] of longint;\n\nbegin\n readln(n);\n for i := 1 to n do\n for j := 1 to 3 do read(a[i, j]);\n fillchar(dp, sizeof(dp), 255);\n for i := 1 to 3 do dp[1, i] := a[1, i];\n for i := 2 to n do\n for j := 1 to 3 do\n for k := 1 to 3 do\n if (j <> k) then dp[i, j] := max(dp[i, j], dp[i - 1, k] + a[i, j]);\n ans := -1;\n for i := 1 to 3 do ans := max(ans, dp[n, i]);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1600121008, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "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/s047936902.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s047936902", "user_id": "u366795445"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses math; \nvar\n n, i, j, k, ans : longint;\n a, dp : array[1..100005, 1..5] of longint;\n\nbegin\n readln(n);\n for i := 1 to n do\n for j := 1 to 3 do read(a[i, j]);\n fillchar(dp, sizeof(dp), 255);\n for i := 1 to 3 do dp[1, i] := a[1, i];\n for i := 2 to n do\n for j := 1 to 3 do\n for k := 1 to 3 do\n if (j <> k) then dp[i, j] := max(dp[i, j], dp[i - 1, k] + a[i, j]);\n ans := -1;\n for i := 1 to 3 do ans := max(ans, dp[n, i]);\n writeln(ans);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 484, "cpu_time_ms": 45, "memory_kb": 4360}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s189233175", "group_id": "codeNet:p03162", "input_text": "uses crt;\nconst m = 100000;\nvar\n g,s: array [0..m,0..3] of longint;\n i,j,k,n,s1: longint;\n\nbegin\n clrscr;\n readln (n);\n for i:=1 to n do\n readln ( g[i, 1], g[i,2], g[i,3]);\n\n for i:=1 to 3 do s[1,i]:= g[1,i];\n for i:=2 to n do\n begin\n j:=0;\n repeat\n inc(j); k:=0; s1:=0;\n\n repeat\n inc(k);\n if ( k <> j) and ( s[i-1,k] >= s1) then s1:= s[i-1,k];\n until k = 3;\n\n s[i,j]:= s[i,j] + s1 + g[i,j];\n until j=3;\n\n end;\n\n s1:= 0;\n for i:=1 to 3 do if s[n,i] > s1 then s1:= s[n,i];\n write (s1);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1583426827, "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/s189233175.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s189233175", "user_id": "u428668906"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nconst m = 100000;\nvar\n g,s: array [0..m,0..3] of longint;\n i,j,k,n,s1: longint;\n\nbegin\n clrscr;\n readln (n);\n for i:=1 to n do\n readln ( g[i, 1], g[i,2], g[i,3]);\n\n for i:=1 to 3 do s[1,i]:= g[1,i];\n for i:=2 to n do\n begin\n j:=0;\n repeat\n inc(j); k:=0; s1:=0;\n\n repeat\n inc(k);\n if ( k <> j) and ( s[i-1,k] >= s1) then s1:= s[i-1,k];\n until k = 3;\n\n s[i,j]:= s[i,j] + s1 + g[i,j];\n until j=3;\n\n end;\n\n s1:= 0;\n for i:=1 to 3 do if s[n,i] > s1 then s1:= s[n,i];\n write (s1);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 796, "cpu_time_ms": 38, "memory_kb": 3328}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s489186368", "group_id": "codeNet:p03162", "input_text": "uses crt;\nconst m = 100000;\nvar\n g,s: array [0..m,0..3] of longint;\n i,j,k,n,s1: longint;\n\nbegin\n clrscr;\n readln (n);\n for i:=1 to n do\n readln ( g[i, 1], g[i,2], g[i,3]);\n\n for i:=1 to 3 do s[1,i]:= g[1,i];\n for i:=2 to n do\n begin\n j:=0;\n repeat\n inc(j); k:=0; s1:=0;\n\n repeat\n inc(k);\n if ( k <> j) and ( s[i-1,k] >= s1) then s1:= s[i-1,k];\n until k = 3;\n\n s[i,j]:= s[i,j] + s1 + g[i,j];\n until j=3;\n\n end;\n\n s1:= 0;\n for i:=1 to 3 do if s[n,i] > s1 then s1:= s[n,i];\n write (s[n,i]);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1583426600, "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/s489186368.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s489186368", "user_id": "u428668906"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nconst m = 100000;\nvar\n g,s: array [0..m,0..3] of longint;\n i,j,k,n,s1: longint;\n\nbegin\n clrscr;\n readln (n);\n for i:=1 to n do\n readln ( g[i, 1], g[i,2], g[i,3]);\n\n for i:=1 to 3 do s[1,i]:= g[1,i];\n for i:=2 to n do\n begin\n j:=0;\n repeat\n inc(j); k:=0; s1:=0;\n\n repeat\n inc(k);\n if ( k <> j) and ( s[i-1,k] >= s1) then s1:= s[i-1,k];\n until k = 3;\n\n s[i,j]:= s[i,j] + s1 + g[i,j];\n until j=3;\n\n end;\n\n s1:= 0;\n for i:=1 to 3 do if s[n,i] > s1 then s1:= s[n,i];\n write (s[n,i]);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 800, "cpu_time_ms": 38, "memory_kb": 3328}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s379135260", "group_id": "codeNet:p03162", "input_text": "uses crt;\nvar dp:array[0..100009,0..5] of int64;\ncost:array[1..100004,1..5] of longint;\ni,o,p,l,m,n,a,b,c,k:longint;\nrs:int64;\nfunction max(a,b:int64):int64;\nbegin\nif a>b then max:=a\nelse max:=b;\nend;\nbegin\nrs:=-1;\nread(n);\nfor i:=1 to n do begin\n for l:=1 to 3 do begin\n read(cost[i,l]);\n end;\n end;\nfor i:=1 to n do begin\n dp[1,i]:=cost[1,i];\n end;\nfor i:=2 to n do begin\n dp[i,1]:=max(dp[i-1,2],dp[i-1,3])+cost[i,1];\n dp[i,2]:=max(dp[i-1,3],dp[i-1,1])+cost[i,2];\n dp[i,3]:=max(dp[i-1,2],dp[i-1,1])+cost[i,3];\n end;\nfor i:=1 to 3 do begin\n if dp[n,i]> rs then rs:=dp[n,i]\n end;\nwrite(rs);\nreadln;\nreadln;\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1575149634, "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/s379135260.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s379135260", "user_id": "u448096745"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nvar dp:array[0..100009,0..5] of int64;\ncost:array[1..100004,1..5] of longint;\ni,o,p,l,m,n,a,b,c,k:longint;\nrs:int64;\nfunction max(a,b:int64):int64;\nbegin\nif a>b then max:=a\nelse max:=b;\nend;\nbegin\nrs:=-1;\nread(n);\nfor i:=1 to n do begin\n for l:=1 to 3 do begin\n read(cost[i,l]);\n end;\n end;\nfor i:=1 to n do begin\n dp[1,i]:=cost[1,i];\n end;\nfor i:=2 to n do begin\n dp[i,1]:=max(dp[i-1,2],dp[i-1,3])+cost[i,1];\n dp[i,2]:=max(dp[i-1,3],dp[i-1,1])+cost[i,2];\n dp[i,3]:=max(dp[i-1,2],dp[i-1,1])+cost[i,3];\n end;\nfor i:=1 to 3 do begin\n if dp[n,i]> rs then rs:=dp[n,i]\n end;\nwrite(rs);\nreadln;\nreadln;\nend.\n\n\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 39, "memory_kb": 6784}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s580849934", "group_id": "codeNet:p03162", "input_text": "uses crt;\nvar dp:array[1..100000,1..100000] of longint;\n i,n:longint;\n a,b,c:array[1..100000] of 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 fillchar(dp,sizeof(dp),0);\n for i:=1 to n do \n begin\n dp[i,1]:=max(dp[i-1,1],max(dp[i-1,2],dp[i-1,3]+a[i]));\n dp[i,2]:=max(dp[i-1,2],max(dp[i-1,1],dp[i-1,3]+b[i]));\n dp[i,3]:=max(dp[i-1,3],max(dp[i-1,1],dp[i-1,2]+c[i]));\n end;\n writeln(max(dp[n,1],max(dp[n,2],dp[n,3])));\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1565480398, "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/s580849934.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s580849934", "user_id": "u805448247"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nvar dp:array[1..100000,1..100000] of longint;\n i,n:longint;\n a,b,c:array[1..100000] of 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 fillchar(dp,sizeof(dp),0);\n for i:=1 to n do \n begin\n dp[i,1]:=max(dp[i-1,1],max(dp[i-1,2],dp[i-1,3]+a[i]));\n dp[i,2]:=max(dp[i-1,2],max(dp[i-1,1],dp[i-1,3]+b[i]));\n dp[i,3]:=max(dp[i-1,3],max(dp[i-1,1],dp[i-1,2]+c[i]));\n end;\n writeln(max(dp[n,1],max(dp[n,2],dp[n,3])));\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 622, "cpu_time_ms": 1069, "memory_kb": 1315072}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s301941902", "group_id": "codeNet:p03162", "input_text": "uses crt;\nvar dp:array[1..100000,1..100000] of longint;\n i,n:longint;\n a,b,c:array[1..100000] of 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 dp[1,1]:=a[1];\n dp[1,2]:=b[1];\n dp[1,3]:=c[1];\n for i:=2 to n do \n begin\n dp[i,1]:=max(dp[i-1,1],max(dp[i-1,2],dp[i-1,3]+a[i]));\n dp[i,2]:=max(dp[i-1,2],max(dp[i-1,1],dp[i-1,3]+b[i]));\n dp[i,3]:=max(dp[i-1,3],max(dp[i-1,1],dp[i-1,2]+c[i]));\n end;\n writeln(max(dp[n,1],max(dp[n,2],dp[n,3])));\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1565480245, "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/s301941902.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s301941902", "user_id": "u805448247"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nvar dp:array[1..100000,1..100000] of longint;\n i,n:longint;\n a,b,c:array[1..100000] of 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 dp[1,1]:=a[1];\n dp[1,2]:=b[1];\n dp[1,3]:=c[1];\n for i:=2 to n do \n begin\n dp[i,1]:=max(dp[i-1,1],max(dp[i-1,2],dp[i-1,3]+a[i]));\n dp[i,2]:=max(dp[i-1,2],max(dp[i-1,1],dp[i-1,3]+b[i]));\n dp[i,3]:=max(dp[i-1,3],max(dp[i-1,1],dp[i-1,2]+c[i]));\n end;\n writeln(max(dp[n,1],max(dp[n,2],dp[n,3])));\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 648, "cpu_time_ms": 288, "memory_kb": 1313280}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s901522569", "group_id": "codeNet:p03162", "input_text": "type\n\tnode=record\n\t\t\t\tsa,sb,sc:longint;\n\t\t\tend;\nvar\n\ta,b,c:array[0..100010] of longint;\n\tf1,f2:node;\n\ti,n,ans:longint;\nfunction max(x,y:longint):longint;\nbegin\n\tif x>y then exit(x) else exit(y);\nend;\nbegin\n\treadln(n);\n\tfor i:=1 to n do read(a[i],b[i],c[i]);\n\tf1.sa:=a[1];\n\tf1.sb:=b[1];\n\tf1.sc:=c[1];\n\tfor i:=2 to n do\n\tbegin\n\t\tf2.sa:=a[i]+max(f1.sb,f1.sc);\n\t\tf2.sb:=b[i]+max(f1.sa,f1.sc);\n\t\tf2.sc:=c[i]+max(f1.sa,f1.sb);\n\t\tf1:=f2;\n\tend;\n\tans:=max(f1.sa,f1.sb);\n\tans:=max(ans,f1.sc);\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1548623028, "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/s901522569.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s901522569", "user_id": "u508890103"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "type\n\tnode=record\n\t\t\t\tsa,sb,sc:longint;\n\t\t\tend;\nvar\n\ta,b,c:array[0..100010] of longint;\n\tf1,f2:node;\n\ti,n,ans:longint;\nfunction max(x,y:longint):longint;\nbegin\n\tif x>y then exit(x) else exit(y);\nend;\nbegin\n\treadln(n);\n\tfor i:=1 to n do read(a[i],b[i],c[i]);\n\tf1.sa:=a[1];\n\tf1.sb:=b[1];\n\tf1.sc:=c[1];\n\tfor i:=2 to n do\n\tbegin\n\t\tf2.sa:=a[i]+max(f1.sb,f1.sc);\n\t\tf2.sb:=b[i]+max(f1.sa,f1.sc);\n\t\tf2.sc:=c[i]+max(f1.sa,f1.sb);\n\t\tf1:=f2;\n\tend;\n\tans:=max(f1.sa,f1.sb);\n\tans:=max(ans,f1.sc);\n\twriteln(ans);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 502, "cpu_time_ms": 32, "memory_kb": 1280}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s761273270", "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] 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 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": 1577012595, "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/s761273270.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s761273270", "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] 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 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 881, "cpu_time_ms": 55, "memory_kb": 39680}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s190782584", "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": 1577012308, "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/s190782584.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s190782584", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1162, "cpu_time_ms": 441, "memory_kb": 465280}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s347812156", "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);\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 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:=1 to va do begin\n if j>=v[i] 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:=1 to va do begin\n ans:=ifthen((f[n][j]<=m),j,ans);\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": 1577010931, "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/s347812156.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s347812156", "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);\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 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:=1 to va do begin\n if j>=v[i] 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:=1 to va do begin\n ans:=ifthen((f[n][j]<=m),j,ans);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 870, "cpu_time_ms": 55, "memory_kb": 39680}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s289527866", "group_id": "codeNet:p03164", "input_text": "Program KnapSack2;\nuses math;\nvar F:array[0..100005] of int64;\n V,W:array[1..105] of longint;\n i,j,n,k,sum :longint;\n res:longint;\n fi,fo:text;\n//-----------------------------\nbegin\n//assign(fi,'KnapSack2.inp');reset(fi);\nreadln(n,k);\nfor i:= 1 to n do begin\n Readln(W[i],V[i]);\n sum:=sum+V[i];\n end;\nfor i:=1 to sum do begin\n F[i]:=1000000000000;\n end;\nfor i:=1 to n do begin\n for j:=sum downto 1 do begin \n if j-V[i]>=0 then begin\n F[j]:=min(F[j],F[j-V[i]]+W[i]);\n end;\n end;\n end;\nfor i:=sum downto 1 do begin\n if F[i]<=k then begin\n Writeln(i);\n break;\n end;\n end;\n//readln;\nend.\n\n\n\n", "language": "Pascal", "metadata": {"date": 1566136643, "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/s289527866.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s289527866", "user_id": "u014341649"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "Program KnapSack2;\nuses math;\nvar F:array[0..100005] of int64;\n V,W:array[1..105] of longint;\n i,j,n,k,sum :longint;\n res:longint;\n fi,fo:text;\n//-----------------------------\nbegin\n//assign(fi,'KnapSack2.inp');reset(fi);\nreadln(n,k);\nfor i:= 1 to n do begin\n Readln(W[i],V[i]);\n sum:=sum+V[i];\n end;\nfor i:=1 to sum do begin\n F[i]:=1000000000000;\n end;\nfor i:=1 to n do begin\n for j:=sum downto 1 do begin \n if j-V[i]>=0 then begin\n F[j]:=min(F[j],F[j-V[i]]+W[i]);\n end;\n end;\n end;\nfor i:=sum downto 1 do begin\n if F[i]<=k then begin\n Writeln(i);\n break;\n end;\n end;\n//readln;\nend.\n\n\n\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1074, "cpu_time_ms": 31, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s858667097", "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 n div 2) then s:= s + x[j];\n\n end;\n\n writeln ( s);\n readln;\n // close (f);\n\nend.", "language": "Pascal", "metadata": {"date": 1584226286, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03168.html", "problem_id": "p03168", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03168/input.txt", "sample_output_relpath": "derived/input_output/data/p03168/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03168/Pascal/s143643751.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s143643751", "user_id": "u428668906"}, "prompt_components": {"gold_output": "0.612\n", "input_to_evaluate": "uses crt;\nvar\n // f: text;\n x,p: array [-1..3000] of real;\n nhi: array [-1..3000,-1..3000] of real;\n i,j,n: longint;\n s: real;\n\nbegin\n // assign (f, fi); reset(f);\n readln ( n);\n for i:=1 to n do read ( p[i]);\n // close (F);\n\n // assign (f, fo); rewrite (f);\n x[0]:=1;\n for i:=1 to n do\n for j:=i downto 0 do\n begin\n\n x[j]:= x[j]*(1 - p[i]) + x[j-1]*p[i];\n if (i=n) and (j > n div 2) then s:= s + x[j];\n\n end;\n\n writeln ( s);\n readln;\n // close (f);\n\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro has tossed all the N coins.\nFind the probability of having more heads than tails.\n\nConstraints\n\nN is an odd number.\n\n1 \\leq N \\leq 2999\n\np_i is a real number and has two decimal places.\n\n0 < p_i < 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint the probability of having more heads than tails.\nThe output is considered correct when the absolute error is not greater than 10^{-9}.\n\nSample Input 1\n\n3\n0.30 0.60 0.80\n\nSample Output 1\n\n0.612\n\nThe probability of each case where we have more heads than tails is as follows:\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Head) is 0.3 × 0.6 × 0.8 = 0.144;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Tail, Head, Head) is 0.7 × 0.6 × 0.8 = 0.336;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Tail, Head) is 0.3 × 0.4 × 0.8 = 0.096;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Tail) is 0.3 × 0.6 × 0.2 = 0.036.\n\nThus, the probability of having more heads than tails is 0.144 + 0.336 + 0.096 + 0.036 = 0.612.\n\nSample Input 2\n\n1\n0.50\n\nSample Output 2\n\n0.5\n\nOutputs such as 0.500, 0.500000001 and 0.499999999 are also considered correct.\n\nSample Input 3\n\n5\n0.42 0.01 0.42 0.99 0.42\n\nSample Output 3\n\n0.3821815872", "sample_input": "3\n0.30 0.60 0.80\n"}, "reference_outputs": ["0.612\n"], "source_document_id": "p03168", "source_text": "Score : 100 points\n\nProblem Statement\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro has tossed all the N coins.\nFind the probability of having more heads than tails.\n\nConstraints\n\nN is an odd number.\n\n1 \\leq N \\leq 2999\n\np_i is a real number and has two decimal places.\n\n0 < p_i < 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint the probability of having more heads than tails.\nThe output is considered correct when the absolute error is not greater than 10^{-9}.\n\nSample Input 1\n\n3\n0.30 0.60 0.80\n\nSample Output 1\n\n0.612\n\nThe probability of each case where we have more heads than tails is as follows:\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Head) is 0.3 × 0.6 × 0.8 = 0.144;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Tail, Head, Head) is 0.7 × 0.6 × 0.8 = 0.336;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Tail, Head) is 0.3 × 0.4 × 0.8 = 0.096;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Tail) is 0.3 × 0.6 × 0.2 = 0.036.\n\nThus, the probability of having more heads than tails is 0.144 + 0.336 + 0.096 + 0.036 = 0.612.\n\nSample Input 2\n\n1\n0.50\n\nSample Output 2\n\n0.5\n\nOutputs such as 0.500, 0.500000001 and 0.499999999 are also considered correct.\n\nSample Input 3\n\n5\n0.42 0.01 0.42 0.99 0.42\n\nSample Output 3\n\n0.3821815872", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 606, "cpu_time_ms": 17, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s105111260", "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]) and (f[i-a[j]]=0) then continue;\n ok:=false; break;\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": 1577037726, "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/s105111260.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s105111260", "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]) and (f[i-a[j]]=0) then continue;\n ok:=false; break;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 9, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s622527826", "group_id": "codeNet:p03170", "input_text": "program Kstones;\n\nconst\n fi='kstone.inp';\n fo='kstone.out';\n\nvar\n a:array[1..100] of longint;\n f:array[0..100000] of 0..1;\n n,k: longint;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n readln(n,k);\n for i:=1 to n do read(a[i]);\n\nend;\n\nprocedure xuli;\nvar i,j: longint;\nbegin\n\n fillchar(f,sizeof(f),0);\n\n for i:=1 to n do f[a[i]]:=1;\n\n for i:=1 to k do begin\n for j:=1 to n do begin\n if (i>a[j]) then begin\n if f[i-a[j]]=0 then f[i]:=1;\n end;\n end;\n end;\n\n if f[k]=0 then write('Second')\n else write('First');\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": 1577036790, "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/s622527826.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s622527826", "user_id": "u762868299"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "program Kstones;\n\nconst\n fi='kstone.inp';\n fo='kstone.out';\n\nvar\n a:array[1..100] of longint;\n f:array[0..100000] of 0..1;\n n,k: longint;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n readln(n,k);\n for i:=1 to n do read(a[i]);\n\nend;\n\nprocedure xuli;\nvar i,j: longint;\nbegin\n\n fillchar(f,sizeof(f),0);\n\n for i:=1 to n do f[a[i]]:=1;\n\n for i:=1 to k do begin\n for j:=1 to n do begin\n if (i>a[j]) then begin\n if f[i-a[j]]=0 then f[i]:=1;\n end;\n end;\n end;\n\n if f[k]=0 then write('Second')\n else write('First');\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 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 701, "cpu_time_ms": 24, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s474066791", "group_id": "codeNet:p03171", "input_text": "uses math;\nconst fi='l_deque.inp';\n fo='l_deque.out';\n maxn=3000;\nvar n:int32;\n sum,f:array[0..maxn,0..maxn] of int64;\n a:array[1..maxn] of int32;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n);\n for i:=1 to n do\n begin read(a[i]); sum[1,i]:=sum[1,i-1]+a[i]; end;\nend;\n//=============================\nfunction max(x,y:int64):int64;\nbegin\n if x>y then exit(x)\n else exit(y);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\nbegin\n for i:=1 to n do\n for j:=n downto i do sum[i,j]:=sum[1,j]-sum[1,i-1];\n for i:=1 to n do f[i,i]:=a[i];\n for i:=n-1 downto 1 do\n for j:=i+1 to n do\n f[i,j]:=max(sum[i,j]-f[i+1,j],sum[i,j]-f[i,j-1]);\n write(2*f[1,n]-sum[1,n]);\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": 1577048845, "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/s474066791.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s474066791", "user_id": "u801427196"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "uses math;\nconst fi='l_deque.inp';\n fo='l_deque.out';\n maxn=3000;\nvar n:int32;\n sum,f:array[0..maxn,0..maxn] of int64;\n a:array[1..maxn] of int32;\n//=============================\nprocedure nhap;\nvar i:int32;\nbegin\n readln(n);\n for i:=1 to n do\n begin read(a[i]); sum[1,i]:=sum[1,i-1]+a[i]; end;\nend;\n//=============================\nfunction max(x,y:int64):int64;\nbegin\n if x>y then exit(x)\n else exit(y);\nend;\n//=============================\nprocedure xuli;\nvar i,j:int32;\nbegin\n for i:=1 to n do\n for j:=n downto i do sum[i,j]:=sum[1,j]-sum[1,i-1];\n for i:=1 to n do f[i,i]:=a[i];\n for i:=n-1 downto 1 do\n for j:=i+1 to n do\n f[i,j]:=max(sum[i,j]-f[i+1,j],sum[i,j]-f[i,j-1]);\n write(2*f[1,n]-sum[1,n]);\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\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 926, "cpu_time_ms": 68, "memory_kb": 139392}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s689489373", "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:=n-1 to 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": 1577040266, "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/s689489373.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s689489373", "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:=n-1 to 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 14, "memory_kb": 68224}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s604753716", "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[i]);\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": 1577038427, "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/s604753716.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s604753716", "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[i]);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s779485578", "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.\n", "language": "Pascal", "metadata": {"date": 1590092220, "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/s779485578.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s779485578", "user_id": "u089230684"}, "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.\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 669, "cpu_time_ms": 350, "memory_kb": 245888}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s570156585", "group_id": "codeNet:p03178", "input_text": "uses math;\nconst fi='digitnum.inp';\n fo='digitnum.out';\n maxn=1000;\n modu=trunc(1e9)+7;\nvar f:array[1..maxn,0..99,0..2] of uint64;\n s:ansistring;\n d,len:int16;\nprocedure nhap;\nbegin\n readln(s);\n read(d);\nend;\nprocedure init;\nvar i,j,x:int32;\nbegin\n x:=ord(s[1])-48;\n for i:=1 to 9 do\n begin\n if ix then j:=2\n else j:=1;\n inc(f[1,i mod d,j]);\n end;\nend;\nfunction calc(n:ansistring):uint64;\nvar i,j,r,st,x,newst,newr:int32;\n ans:uint64;\nbegin\n len:=length(n);\n for i:=1 to len-1 do\n for r:=0 to d-1 do\n for st:=0 to 2 do\n begin\n x:=ord(n[i+1])-48;\n for j:=0 to 9 do\n begin\n newst:=st;\n if newst=1 then\n begin\n if jx then newst:=2\n else newst:=1;\n end;\n newr:=(r+j) mod d;\n f[i+1,newr,newst]:=(f[i+1,newr,newst]+f[i,r,st]) mod modu;\n end;\n end;\n ans:=0;\n for i:=1 to len-1 do\n for j:=0 to 2 do inc(ans,f[i,0,j]);\n exit((ans+f[len,0,0]+f[len,0,1]) mod modu);\nend;\n\nprocedure xuli;\nbegin\n init;\n write(calc(s));\nend;\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": 1576993198, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03178.html", "problem_id": "p03178", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03178/input.txt", "sample_output_relpath": "derived/input_output/data/p03178/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03178/Pascal/s570156585.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s570156585", "user_id": "u801427196"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "uses math;\nconst fi='digitnum.inp';\n fo='digitnum.out';\n maxn=1000;\n modu=trunc(1e9)+7;\nvar f:array[1..maxn,0..99,0..2] of uint64;\n s:ansistring;\n d,len:int16;\nprocedure nhap;\nbegin\n readln(s);\n read(d);\nend;\nprocedure init;\nvar i,j,x:int32;\nbegin\n x:=ord(s[1])-48;\n for i:=1 to 9 do\n begin\n if ix then j:=2\n else j:=1;\n inc(f[1,i mod d,j]);\n end;\nend;\nfunction calc(n:ansistring):uint64;\nvar i,j,r,st,x,newst,newr:int32;\n ans:uint64;\nbegin\n len:=length(n);\n for i:=1 to len-1 do\n for r:=0 to d-1 do\n for st:=0 to 2 do\n begin\n x:=ord(n[i+1])-48;\n for j:=0 to 9 do\n begin\n newst:=st;\n if newst=1 then\n begin\n if jx then newst:=2\n else newst:=1;\n end;\n newr:=(r+j) mod d;\n f[i+1,newr,newst]:=(f[i+1,newr,newst]+f[i,r,st]) mod modu;\n end;\n end;\n ans:=0;\n for i:=1 to len-1 do\n for j:=0 to 2 do inc(ans,f[i,0,j]);\n exit((ans+f[len,0,0]+f[len,0,1]) mod modu);\nend;\n\nprocedure xuli;\nbegin\n init;\n write(calc(s));\nend;\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\nFind the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:\n\nThe sum of the digits in base ten is a multiple of D.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K < 10^{10000}\n\n1 \\leq D \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nD\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n30\n4\n\nSample Output 1\n\n6\n\nThose six integers are: 4, 8, 13, 17, 22 and 26.\n\nSample Input 2\n\n1000000009\n1\n\nSample Output 2\n\n2\n\nBe sure to print the number modulo 10^9 + 7.\n\nSample Input 3\n\n98765432109876543210\n58\n\nSample Output 3\n\n635270834", "sample_input": "30\n4\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03178", "source_text": "Score : 100 points\n\nProblem Statement\n\nFind the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:\n\nThe sum of the digits in base ten is a multiple of D.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K < 10^{10000}\n\n1 \\leq D \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nD\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n30\n4\n\nSample Output 1\n\n6\n\nThose six integers are: 4, 8, 13, 17, 22 and 26.\n\nSample Input 2\n\n1000000009\n1\n\nSample Output 2\n\n2\n\nBe sure to print the number modulo 10^9 + 7.\n\nSample Input 3\n\n98765432109876543210\n58\n\nSample Output 3\n\n635270834", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1357, "cpu_time_ms": 170, "memory_kb": 2560}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s034766996", "group_id": "codeNet:p03178", "input_text": "uses math;\nconst fi='digitnum.inp';\n fo='digitnum.out';\n maxn=1000;\n modu=trunc(1e9)+7;\nvar f:array[1..maxn,0..99,0..2] of int32;\n s:ansistring;\n d,len:int16;\nprocedure nhap;\nbegin\n readln(s);\n read(d);\nend;\nprocedure init;\nvar i,j,x:int32;\nbegin\n x:=ord(s[1])-48;\n for i:=1 to 9 do\n begin\n if ix then j:=2\n else j:=1;\n inc(f[1,i mod d,j]);\n end;\nend;\nfunction calc(n:ansistring):uint64;\nvar i,j,r,st,x,newst,newr:int32;\n ans:uint64;\nbegin\n len:=length(n);\n for i:=1 to len-1 do\n for r:=0 to d-1 do\n for st:=0 to 2 do\n begin\n x:=ord(n[i+1])-48;\n for j:=0 to 9 do\n begin\n newst:=st;\n if newst=1 then\n begin\n if jx then newst:=2\n else newst:=1;\n end;\n newr:=(r+j) mod d;\n f[i+1,newr,newst]:=(f[i+1,newr,newst]+f[i,r,st]) mod modu;\n end;\n end;\n ans:=0;\n for i:=1 to len-1 do\n for j:=0 to 2 do inc(ans,f[i,0,j]);\n exit((ans+f[len,0,0]+f[len,0,1]) mod modu);\nend;\n\nprocedure xuli;\nbegin\n init;\n write(calc(s));\nend;\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": 1576992973, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03178.html", "problem_id": "p03178", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03178/input.txt", "sample_output_relpath": "derived/input_output/data/p03178/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03178/Pascal/s034766996.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s034766996", "user_id": "u801427196"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "uses math;\nconst fi='digitnum.inp';\n fo='digitnum.out';\n maxn=1000;\n modu=trunc(1e9)+7;\nvar f:array[1..maxn,0..99,0..2] of int32;\n s:ansistring;\n d,len:int16;\nprocedure nhap;\nbegin\n readln(s);\n read(d);\nend;\nprocedure init;\nvar i,j,x:int32;\nbegin\n x:=ord(s[1])-48;\n for i:=1 to 9 do\n begin\n if ix then j:=2\n else j:=1;\n inc(f[1,i mod d,j]);\n end;\nend;\nfunction calc(n:ansistring):uint64;\nvar i,j,r,st,x,newst,newr:int32;\n ans:uint64;\nbegin\n len:=length(n);\n for i:=1 to len-1 do\n for r:=0 to d-1 do\n for st:=0 to 2 do\n begin\n x:=ord(n[i+1])-48;\n for j:=0 to 9 do\n begin\n newst:=st;\n if newst=1 then\n begin\n if jx then newst:=2\n else newst:=1;\n end;\n newr:=(r+j) mod d;\n f[i+1,newr,newst]:=(f[i+1,newr,newst]+f[i,r,st]) mod modu;\n end;\n end;\n ans:=0;\n for i:=1 to len-1 do\n for j:=0 to 2 do inc(ans,f[i,0,j]);\n exit((ans+f[len,0,0]+f[len,0,1]) mod modu);\nend;\n\nprocedure xuli;\nbegin\n init;\n write(calc(s));\nend;\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\nFind the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:\n\nThe sum of the digits in base ten is a multiple of D.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K < 10^{10000}\n\n1 \\leq D \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nD\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n30\n4\n\nSample Output 1\n\n6\n\nThose six integers are: 4, 8, 13, 17, 22 and 26.\n\nSample Input 2\n\n1000000009\n1\n\nSample Output 2\n\n2\n\nBe sure to print the number modulo 10^9 + 7.\n\nSample Input 3\n\n98765432109876543210\n58\n\nSample Output 3\n\n635270834", "sample_input": "30\n4\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03178", "source_text": "Score : 100 points\n\nProblem Statement\n\nFind the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:\n\nThe sum of the digits in base ten is a multiple of D.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K < 10^{10000}\n\n1 \\leq D \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nD\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n30\n4\n\nSample Output 1\n\n6\n\nThose six integers are: 4, 8, 13, 17, 22 and 26.\n\nSample Input 2\n\n1000000009\n1\n\nSample Output 2\n\n2\n\nBe sure to print the number modulo 10^9 + 7.\n\nSample Input 3\n\n98765432109876543210\n58\n\nSample Output 3\n\n635270834", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1356, "cpu_time_ms": 174, "memory_kb": 1408}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s617352157", "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 write(dis,' ');\n while s=(a[loc]+a[n]-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\twrite(dis,' ');\n\t end\n\t\t else\n\t\t begin\n\t\t\t dis:=dis+a[loc]+a[n]-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]+a[n]-a[loc])>=(a[loc]-a[j])\n\t\t then\n\t\t\tbegin \n\t\t\t dis:=dis+a[i]+a[n]-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+a[loc]-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);\nend.", "language": "Pascal", "metadata": {"date": 1546139278, "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/s617352157.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s617352157", "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 write(dis,' ');\n while s=(a[loc]+a[n]-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\twrite(dis,' ');\n\t end\n\t\t else\n\t\t begin\n\t\t\t dis:=dis+a[loc]+a[n]-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]+a[n]-a[loc])>=(a[loc]-a[j])\n\t\t then\n\t\t\tbegin \n\t\t\t dis:=dis+a[i]+a[n]-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+a[loc]-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);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1001, "cpu_time_ms": 78, "memory_kb": 3072}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s563046783", "group_id": "codeNet:p03192", "input_text": "var n:string;cnt,i:integer;begin read(n);cnt:=0;for i:=1 to 4 do begin if(n[i]='2')then cnt:=cnt+1;end;writeln(cnt);end.", "language": "Pascal", "metadata": {"date": 1597676269, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03192.html", "problem_id": "p03192", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03192/input.txt", "sample_output_relpath": "derived/input_output/data/p03192/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03192/Pascal/s563046783.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s563046783", "user_id": "u984276646"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n:string;cnt,i:integer;begin read(n);cnt:=0;for i:=1 to 4 do begin if(n[i]='2')then cnt:=cnt+1;end;writeln(cnt);end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\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\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "sample_input": "1222\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03192", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\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\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 8, "memory_kb": 1312}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s347407592", "group_id": "codeNet:p03193", "input_text": "var n,h,w,a,b,cnt,i:integer;begin readln(n,h,w);cnt:=0;for i:=1 to n do begin readln(a,b);if((h<=a)and(w<=b))then cnt:=cnt+1;end;writeln(cnt);end.", "language": "Pascal", "metadata": {"date": 1597678811, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "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/s347407592.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s347407592", "user_id": "u984276646"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,h,w,a,b,cnt,i:integer;begin readln(n,h,w);cnt:=0;for i:=1 to n do begin readln(a,b);if((h<=a)and(w<=b))then cnt:=cnt+1;end;writeln(cnt);end.", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 8, "memory_kb": 1380}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s321101013", "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": 1545530872, "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/s321101013.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s321101013", "user_id": "u380619494"}, "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s830912366", "group_id": "codeNet:p03194", "input_text": "var\n\tn,p,s:int64;\n f:array[0..1000010] of longint;\n i,j,t:longint;\nbegin\n\tread(n,p);\n if n=1 then\n begin\n \twriteln(p);\n halt;\n end;\n if p=1 then \n begin\n \twriteln(1);\n halt;\n end;\n fillchar(f,sizeof(f),0);\n i:=1;\n t:=trunc(sqrt(p))+1;\n while (p<>1) and (i<=t) do\n begin\n \tinc(i);\n while p mod i=0 do\n begin\n \tp:=p div i;\n inc(f[i]);\n end;\n end;\n s:=1;\n for i:=2 to t do\n \tif f[i]>=n then\n \tfor j:=1 to f[i] div n do s:=s*i;\n writeln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1545531850, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03194.html", "problem_id": "p03194", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03194/input.txt", "sample_output_relpath": "derived/input_output/data/p03194/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03194/Pascal/s830912366.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s830912366", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,p,s:int64;\n f:array[0..1000010] of longint;\n i,j,t:longint;\nbegin\n\tread(n,p);\n if n=1 then\n begin\n \twriteln(p);\n halt;\n end;\n if p=1 then \n begin\n \twriteln(1);\n halt;\n end;\n fillchar(f,sizeof(f),0);\n i:=1;\n t:=trunc(sqrt(p))+1;\n while (p<>1) and (i<=t) do\n begin\n \tinc(i);\n while p mod i=0 do\n begin\n \tp:=p div i;\n inc(f[i]);\n end;\n end;\n s:=1;\n for i:=2 to t do\n \tif f[i]>=n then\n \tfor j:=1 to f[i] div n do s:=s*i;\n writeln(s);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "sample_input": "3 24\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03194", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 565, "cpu_time_ms": 13, "memory_kb": 3968}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s918231432", "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": 1545533059, "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/s918231432.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s918231432", "user_id": "u380619494"}, "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s426168273", "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.", "language": "Pascal", "metadata": {"date": 1545533030, "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/s426168273.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s426168273", "user_id": "u223928734"}, "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.", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 17, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s313608358", "group_id": "codeNet:p03195", "input_text": "var\n n,k,i,m,j,t,ans,b,c,d:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(k);\n ans:=(ans+k mod 2)mod 2;\n end;\n if ans mod 2=1 then writeln('first')\n else writeln('second');\nend.", "language": "Pascal", "metadata": {"date": 1545532566, "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/s313608358.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s313608358", "user_id": "u380619494"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "var\n n,k,i,m,j,t,ans,b,c,d:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(k);\n ans:=(ans+k mod 2)mod 2;\n end;\n if ans mod 2=1 then writeln('first')\n else writeln('second');\nend.", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 20, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s392003178", "group_id": "codeNet:p03195", "input_text": "var\n\tn,i,x,max,s:longint;\nbegin\n\tread(n);\n max:=0; s:=0;\n for i:=1 to n do\n begin\n \tread(x);\n s:=s+x;\n if x>max then max:=x;\n end;\n s:=s-max;\n if abs(s-max) div 2=0 then writeln('second')\n else writeln('first');\nend.", "language": "Pascal", "metadata": {"date": 1545532334, "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/s392003178.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s392003178", "user_id": "u957998623"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "var\n\tn,i,x,max,s:longint;\nbegin\n\tread(n);\n max:=0; s:=0;\n for i:=1 to n do\n begin\n \tread(x);\n s:=s+x;\n if x>max then max:=x;\n end;\n s:=s-max;\n if abs(s-max) div 2=0 then writeln('second')\n else writeln('first');\nend.", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s326176580", "group_id": "codeNet:p03200", "input_text": "var\n n, i, j : 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": 1545250845, "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/s326176580.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s326176580", "user_id": "u917872461"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n, i, j : 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 384}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s376733837", "group_id": "codeNet:p03200", "input_text": "var\n\tch:ansistring;\n\tn,s,i:longint;\n\tt:int64;\nbegin\n\treadln(ch);\n\tn:=length(ch);\n\ts:=1; t:=0;\n\tfor i:=1 to n do \n\t\tif ch[i]='W' then\n\t\tbegin\n\t\t\tt:=t+i-s;\n\t\t\tinc(s);\n\t\tend;\n\twriteln(t);\nend.", "language": "Pascal", "metadata": {"date": 1544926359, "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/s376733837.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376733837", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tch:ansistring;\n\tn,s,i:longint;\n\tt:int64;\nbegin\n\treadln(ch);\n\tn:=length(ch);\n\ts:=1; t:=0;\n\tfor i:=1 to n do \n\t\tif ch[i]='W' then\n\t\tbegin\n\t\t\tt:=t+i-s;\n\t\t\tinc(s);\n\t\tend;\n\twriteln(t);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s838901614", "group_id": "codeNet:p03200", "input_text": "var\n\tch:ansistring;\n\tn,s,t,i:longint;\nbegin\n\treadln(ch);\n\tn:=length(ch);\n\ts:=1; t:=0;\n\tfor i:=1 to n do \n\t\tif ch[i]='W' then\n\t\tbegin\n\t\t\tt:=t+i-s;\n\t\t\tinc(s);\n\t\tend;\n\twriteln(t);\nend.", "language": "Pascal", "metadata": {"date": 1544926058, "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/s838901614.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s838901614", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tch:ansistring;\n\tn,s,t,i:longint;\nbegin\n\treadln(ch);\n\tn:=length(ch);\n\ts:=1; t:=0;\n\tfor i:=1 to n do \n\t\tif ch[i]='W' then\n\t\tbegin\n\t\t\tt:=t+i-s;\n\t\t\tinc(s);\n\t\tend;\n\twriteln(t);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 181, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s069796543", "group_id": "codeNet:p03201", "input_text": "var\n a:array[0..200000]of longint;\n f:array[0..200000000]of boolean;\n i,j,k,n,ans:longint;\nProcedure qs(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 l1E9;\n k:=j;\n for i:=1 to n do\n read(a[i]);\n qs(1,n);\n for i:=1 to n do\n begin\n if a[i]<>0 then\n begin\n for j:=n downto i+1 do\n begin\n if (a[j]<>0)and((f[a[i]+a[j]])or(k=a[i]+a[j])) then\n begin\n a[i]:=0;a[j]:=0;\n inc(ans);\n end;\n end;\n end;\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544933995, "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/s069796543.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s069796543", "user_id": "u111363574"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[0..200000]of longint;\n f:array[0..200000000]of boolean;\n i,j,k,n,ans:longint;\nProcedure qs(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 l1E9;\n k:=j;\n for i:=1 to n do\n read(a[i]);\n qs(1,n);\n for i:=1 to n do\n begin\n if a[i]<>0 then\n begin\n for j:=n downto i+1 do\n begin\n if (a[j]<>0)and((f[a[i]+a[j]])or(k=a[i]+a[j])) then\n begin\n a[i]:=0;a[j]:=0;\n inc(ans);\n end;\n end;\n end;\n end;\n write(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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 894, "cpu_time_ms": 3, "memory_kb": 14464}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s594277808", "group_id": "codeNet:p03201", "input_text": "var\n a:array[0..200000]of longint;\n f:array[0..100000000]of boolean;\n i,j,k,n,ans:longint;\nProcedure qs(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 l1E9;\n k:=j;\n for i:=1 to n do\n read(a[i]);\n qs(1,n);\n for i:=1 to n do\n begin\n if a[i]<>0 then\n begin\n for j:=n downto i+1 do\n begin\n if (a[j]<>0)and((f[a[i]+a[j]])or(k=a[i]+a[j])) then\n begin\n a[i]:=0;a[j]:=0;\n inc(ans);\n end;\n end;\n end;\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544933956, "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/s594277808.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s594277808", "user_id": "u111363574"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[0..200000]of longint;\n f:array[0..100000000]of boolean;\n i,j,k,n,ans:longint;\nProcedure qs(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 l1E9;\n k:=j;\n for i:=1 to n do\n read(a[i]);\n qs(1,n);\n for i:=1 to n do\n begin\n if a[i]<>0 then\n begin\n for j:=n downto i+1 do\n begin\n if (a[j]<>0)and((f[a[i]+a[j]])or(k=a[i]+a[j])) then\n begin\n a[i]:=0;a[j]:=0;\n inc(ans);\n end;\n end;\n end;\n end;\n write(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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 894, "cpu_time_ms": 3, "memory_kb": 12416}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s444662340", "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,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\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544930291, "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/s444662340.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s444662340", "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,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\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1174, "cpu_time_ms": 2103, "memory_kb": 1024}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s403860143", "group_id": "codeNet:p03202", "input_text": "var\n a:array[1..20000]of longint;\n f:array[1..100000000]of longint;\n n,i,j,ans:longint;\nbegin\n readln(n);\n ans:=1;\n for i:=1 to n do read(a[i]);\n for i:=1 to a[1] do f[i]:=1;\n for i:=2 to n do\n if a[i-1]ans then inc(ans)\n end;\n write(ans)\nend. ", "language": "Pascal", "metadata": {"date": 1545259175, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03202.html", "problem_id": "p03202", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03202/input.txt", "sample_output_relpath": "derived/input_output/data/p03202/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03202/Pascal/s403860143.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s403860143", "user_id": "u917872461"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..20000]of longint;\n f:array[1..100000000]of longint;\n n,i,j,ans:longint;\nbegin\n readln(n);\n ans:=1;\n for i:=1 to n do read(a[i]);\n for i:=1 to a[1] do f[i]:=1;\n for i:=2 to n do\n if a[i-1]ans then inc(ans)\n end;\n write(ans)\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N strings arranged in a row.\nIt is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right.\nThat is, S_1ans then inc(ans)\n end;\n write(ans)\nend. ", "language": "Pascal", "metadata": {"date": 1545258837, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03202.html", "problem_id": "p03202", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03202/input.txt", "sample_output_relpath": "derived/input_output/data/p03202/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03202/Pascal/s589908140.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s589908140", "user_id": "u917872461"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..20000]of longint;\n f:array[1..20000]of longint;\n n,i,j,ans:longint;\nbegin\n readln(n);\n ans:=1;\n for i:=1 to n do read(a[i]);\n for i:=1 to a[1] do f[i]:=1;\n for i:=2 to n do\n if a[i-1]ans then inc(ans)\n end;\n write(ans)\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N strings arranged in a row.\nIt is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right.\nThat is, S_1mid 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 lb then inc(s);\n\t\ta:=b;\n\tend;\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1544929460, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03202.html", "problem_id": "p03202", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03202/input.txt", "sample_output_relpath": "derived/input_output/data/p03202/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03202/Pascal/s680200824.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s680200824", "user_id": "u957998623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,a,b,i,s:longint;\nbegin\n\treadln(n);\n\ts:=0;\n\tread(a);\n\tfor i:=2 to n do\n\tbegin\n\t\tread(b);\n\t\tif a>b then inc(s);\n\t\ta:=b;\n\tend;\n\twriteln(s);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N strings arranged in a row.\nIt is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right.\nThat is, S_1m 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 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 i u then t := u\n end;\n writeln(t)\nend.", "language": "Pascal", "metadata": {"date": 1544323756, "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/s493881279.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s493881279", "user_id": "u492212770"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "type\n\tintArray = array[1..100000] of longint;\nvar i,j,m,n,k : integer;\n t,u : longint;\n h : intArray;\n\nprocedure\tswap(var a,b:longint);\nvar tmp:longint;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n \nprocedure QuickSort(var a:intArray;start_index,end_index:integer);\nvar i,j,x,t:longint;\nbegin\n\tx:=a[(start_index+end_index)div 2];\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i] u then t := u\n end;\n writeln(t)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 27, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s788442397", "group_id": "codeNet:p03209", "input_text": "var n:integer;\nx,ans:int64;\nprocedure find(i:integer);\nbegin \n\tif x<=3 then \n\tbegin \n\t\tans:=ans+x;\n\t\tx:=0;\n\tend;\n\tif x>3 then \n\tbegin \n\t\tans:=ans+3;\n\t\tx:=x-3;\n\t\tif x<=i then \n\t\tbegin \n\t\t\tx:=0;\n\t\tend;\n\t\tif x>i then \n\t\tbegin \n\t\t\tans:=ans+1;\n\t\t\tx:=x-i-1;\n\t\t\tif x<=i then x:=0;\n\t\t\tif x>i then x:=x-i;\n\t\tend;\n\tend;\nend;\nprocedure p(y:integer);\nbegin \n\tif y>1 then p(y-1);\n\tfind(y);\n\tif x=0 then begin write(ans);halt;end;\n\tif y>1 then p(y-1);\nend;\nbegin \n\tread(n);read(x);\n\tans:=0;\n\tx:=x-n;\n\tif x>0 then \n\t\tp(n-1);\n\twrite(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544501598, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03209.html", "problem_id": "p03209", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03209/input.txt", "sample_output_relpath": "derived/input_output/data/p03209/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03209/Pascal/s788442397.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s788442397", "user_id": "u914335902"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n:integer;\nx,ans:int64;\nprocedure find(i:integer);\nbegin \n\tif x<=3 then \n\tbegin \n\t\tans:=ans+x;\n\t\tx:=0;\n\tend;\n\tif x>3 then \n\tbegin \n\t\tans:=ans+3;\n\t\tx:=x-3;\n\t\tif x<=i then \n\t\tbegin \n\t\t\tx:=0;\n\t\tend;\n\t\tif x>i then \n\t\tbegin \n\t\t\tans:=ans+1;\n\t\t\tx:=x-i-1;\n\t\t\tif x<=i then x:=0;\n\t\t\tif x>i then x:=x-i;\n\t\tend;\n\tend;\nend;\nprocedure p(y:integer);\nbegin \n\tif y>1 then p(y-1);\n\tfind(y);\n\tif x=0 then begin write(ans);halt;end;\n\tif y>1 then p(y-1);\nend;\nbegin \n\tread(n);read(x);\n\tans:=0;\n\tx:=x-n;\n\tif x>0 then \n\t\tp(n-1);\n\twrite(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "sample_input": "2 7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03209", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2103, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s037441458", "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 begin writeln(17656+f(7,0,0,1));exit;end;\n\twriteln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1575165894, "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/s037441458.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s037441458", "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 begin writeln(17656+f(7,0,0,1));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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s686541911", "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>777700000 then begin writeln(26484);exit;end;\n\twriteln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1575165686, "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/s686541911.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s686541911", "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>777700000 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s021018833", "group_id": "codeNet:p03212", "input_text": "var n : longint;\n i,sum : integer;\n e : boolean;\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 else e := true\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 sum := 0;\n e := false;\n for i := 3 to 9 do begin\n sft(0, i, false, false, false);\n if e then break;\n end;\n writeln(sum)\nend.", "language": "Pascal", "metadata": {"date": 1543984858, "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/s021018833.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s021018833", "user_id": "u492212770"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n : longint;\n i,sum : integer;\n e : boolean;\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 else e := true\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 sum := 0;\n e := false;\n for i := 3 to 9 do begin\n sft(0, i, false, false, false);\n if e then break;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 524, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s442742101", "group_id": "codeNet:p03212", "input_text": "var n : longint;\n i,sum : integer;\n e : boolean;\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 else e := true\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 sum := 0;\n e := false;\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": 1543984629, "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/s442742101.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s442742101", "user_id": "u492212770"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n : longint;\n i,sum : integer;\n e : boolean;\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 else e := true\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 sum := 0;\n e := false;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 503, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s404477748", "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\tif n>777777752 then begin writeln(26484);exit;end;\n\tf(0,False,False,False);\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543811080, "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/s404477748.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s404477748", "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\tif n>777777752 then begin writeln(26484);exit;end;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s156734048", "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": 1543808041, "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/s156734048.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s156734048", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s774119052", "group_id": "codeNet:p03212", "input_text": "var s:string;\ntot,nn:longint;\na:array[1..10]of integer;\nb:array[1..10]of 0..1;\nprocedure dfs(n,x:longint);\nvar num,i:longint;\nbegin \n\tif (n>=4) and (x<=nn) then \n\tbegin \n\t\t{for i:=1 to n-1 do write(a[i]);\n\t\twriteln;}\n\t\tfillchar(b,sizeof(b),0);\n\t\tfor i:=1 to n-1 do b[a[i]]:=1;\n\t\tif (b[3]=1) and (b[5]=1) and(b[7]=1) then inc(tot);\n\t\t\n\tend;\n\tif n>length(s) then exit;\n\t\ta[n]:=3;\n\t\tdfs(n+1,x*10+3);\n\t\ta[n]:=5;\n\t\tdfs(n+1,x*10+5);\n\t\ta[n]:=7;\n\t\tdfs(n+1,x*10+7);\nend;\nbegin \n readln(s);\n\tval(copy(s,1,length(s)),nn);\n fillchar(a,sizeof(a),0);\n tot:=0;\n dfs(1,0);\n write(tot);\nend.", "language": "Pascal", "metadata": {"date": 1543806853, "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/s774119052.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s774119052", "user_id": "u914335902"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:string;\ntot,nn:longint;\na:array[1..10]of integer;\nb:array[1..10]of 0..1;\nprocedure dfs(n,x:longint);\nvar num,i:longint;\nbegin \n\tif (n>=4) and (x<=nn) then \n\tbegin \n\t\t{for i:=1 to n-1 do write(a[i]);\n\t\twriteln;}\n\t\tfillchar(b,sizeof(b),0);\n\t\tfor i:=1 to n-1 do b[a[i]]:=1;\n\t\tif (b[3]=1) and (b[5]=1) and(b[7]=1) then inc(tot);\n\t\t\n\tend;\n\tif n>length(s) then exit;\n\t\ta[n]:=3;\n\t\tdfs(n+1,x*10+3);\n\t\ta[n]:=5;\n\t\tdfs(n+1,x*10+5);\n\t\ta[n]:=7;\n\t\tdfs(n+1,x*10+7);\nend;\nbegin \n readln(s);\n\tval(copy(s,1,length(s)),nn);\n fillchar(a,sizeof(a),0);\n tot:=0;\n dfs(1,0);\n write(tot);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 589, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s388104238", "group_id": "codeNet:p03213", "input_text": "var\n i,j,k,ans,n:longint;\n s:array[0..110] of longint;\n f:array[0..110,0..110,0..110] of boolean;\nprocedure prime(x:longint);\nbegin\n j:=2;\n while x>=j do\n begin\n while x mod j=0 do\n begin\n inc(s[j]);\n x:=x div j;\n end;\n inc(j);\n end;\nend;\nbegin\n read(n);\n fillchar(s,sizeof(s),0);\n for i:=2 to n do prime(i);\n fillchar(f,sizeof(f),true);\n ans:=0;\n for i:=2 to n do\n for j:=2 to n do\n if i<>j then\n begin\n if (s[i]>=2) and (s[j]>=24) then inc(ans);\n if (s[i]>=4) and (s[j]>=14) then inc(ans);\n if (s[i]>=2) and (s[j]>=4) then \n for k:=2 to n do\n if (i<>k) and (j<>k) then\n if s[k]>=4 then \n if f[i,j,k] then\n begin \n inc(ans);\n f[i,j,k]:=false;\n f[i,k,j]:=false;\n end;\n end;\n for i:=1 to n do\n if s[i]>=74 then inc(ans);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543807058, "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/s388104238.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s388104238", "user_id": "u380619494"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i,j,k,ans,n:longint;\n s:array[0..110] of longint;\n f:array[0..110,0..110,0..110] of boolean;\nprocedure prime(x:longint);\nbegin\n j:=2;\n while x>=j do\n begin\n while x mod j=0 do\n begin\n inc(s[j]);\n x:=x div j;\n end;\n inc(j);\n end;\nend;\nbegin\n read(n);\n fillchar(s,sizeof(s),0);\n for i:=2 to n do prime(i);\n fillchar(f,sizeof(f),true);\n ans:=0;\n for i:=2 to n do\n for j:=2 to n do\n if i<>j then\n begin\n if (s[i]>=2) and (s[j]>=24) then inc(ans);\n if (s[i]>=4) and (s[j]>=14) then inc(ans);\n if (s[i]>=2) and (s[j]>=4) then \n for k:=2 to n do\n if (i<>k) and (j<>k) then\n if s[k]>=4 then \n if f[i,j,k] then\n begin \n inc(ans);\n f[i,j,k]:=false;\n f[i,k,j]:=false;\n end;\n end;\n for i:=1 to n do\n if s[i]>=74 then inc(ans);\n writeln(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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1193, "cpu_time_ms": 1, "memory_kb": 1408}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s193988227", "group_id": "codeNet:p03213", "input_text": "var\n i,j,k,ans,n:longint;\n s:array[0..110] of longint;\n f:array[0..110,0..110,0..110] of boolean;\nprocedure prime(x:longint);\nbegin\n j:=2;\n while x>=j do\n begin\n while x mod j=0 do\n begin\n inc(s[j]);\n x:=x div j;\n end;\n inc(j);\n end;\nend;\nbegin\n read(n);\n fillchar(s,sizeof(s),0);\n for i:=2 to n do prime(i);\n for i:=2 to n do writeln('s[',i,']=',s[i]);\n fillchar(f,sizeof(f),true);\n ans:=0;\n for i:=2 to n do\n for j:=2 to n do\n if i<>j then\n begin\n if (s[i]>=2) and (s[j]>=24) then inc(ans);\n if (s[i]>=4) and (s[j]>=14) then inc(ans);\n if (s[i]>=2) and (s[j]>=4) then \n for k:=2 to n do\n if (i<>k) and (j<>k) then\n if s[k]>=4 then \n if f[i,j,k] then\n begin \n inc(ans);\n f[i,j,k]:=false;\n f[i,k,j]:=false;\n end;\n end;\n for i:=1 to n do\n if s[i]>=74 then inc(ans);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543806971, "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/s193988227.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s193988227", "user_id": "u380619494"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i,j,k,ans,n:longint;\n s:array[0..110] of longint;\n f:array[0..110,0..110,0..110] of boolean;\nprocedure prime(x:longint);\nbegin\n j:=2;\n while x>=j do\n begin\n while x mod j=0 do\n begin\n inc(s[j]);\n x:=x div j;\n end;\n inc(j);\n end;\nend;\nbegin\n read(n);\n fillchar(s,sizeof(s),0);\n for i:=2 to n do prime(i);\n for i:=2 to n do writeln('s[',i,']=',s[i]);\n fillchar(f,sizeof(f),true);\n ans:=0;\n for i:=2 to n do\n for j:=2 to n do\n if i<>j then\n begin\n if (s[i]>=2) and (s[j]>=24) then inc(ans);\n if (s[i]>=4) and (s[j]>=14) then inc(ans);\n if (s[i]>=2) and (s[j]>=4) then \n for k:=2 to n do\n if (i<>k) and (j<>k) then\n if s[k]>=4 then \n if f[i,j,k] then\n begin \n inc(ans);\n f[i,j,k]:=false;\n f[i,k,j]:=false;\n end;\n end;\n for i:=1 to n do\n if s[i]>=74 then inc(ans);\n writeln(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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1241, "cpu_time_ms": 1, "memory_kb": 1408}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s199087036", "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\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": 1543805213, "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/s199087036.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s199087036", "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\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 887, "cpu_time_ms": 1, "memory_kb": 1408}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s667466942", "group_id": "codeNet:p03221", "input_text": "var\n\ta,b,x,y,num,pro: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\tt:=num[pro[i]]; num[pro[i]]:=num[pro[j]]; num[pro[j]]:=t;\n\t\t\tt:=pro[num[i]]; pro[num[i]]:=pro[num[j]]; pro[num[j]]:=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": 1541389207, "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/s667466942.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s667466942", "user_id": "u957998623"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "var\n\ta,b,x,y,num,pro: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\tt:=num[pro[i]]; num[pro[i]]:=num[pro[j]]; num[pro[j]]:=t;\n\t\t\tt:=pro[num[i]]; pro[num[i]]:=pro[num[j]]; pro[num[j]]:=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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1114, "cpu_time_ms": 98, "memory_kb": 3712}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s407104988", "group_id": "codeNet:p03221", "input_text": "var\n\ta,b,x,y,num,pro: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\tt:=num[pro[i]]; num[pro[i]]:=num[pro[j]]; num[pro[j]]:=t;\n\t\t\tpro[num[i]]:=j; pro[num[i]]:=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": 1541389098, "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/s407104988.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s407104988", "user_id": "u957998623"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "var\n\ta,b,x,y,num,pro: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\tt:=num[pro[i]]; num[pro[i]]:=num[pro[j]]; num[pro[j]]:=t;\n\t\t\tpro[num[i]]:=j; pro[num[i]]:=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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1088, "cpu_time_ms": 97, "memory_kb": 3840}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s347774326", "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\tnum[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": 1541388280, "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/s271719827.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s271719827", "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\tnum[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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1005, "cpu_time_ms": 95, "memory_kb": 3328}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s297458986", "group_id": "codeNet:p03222", "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]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\t\tif r=ttt then dec(r);\n\t\tend;\n\t\tif xmid 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\t\tif r=ttt then dec(r);\n\t\tend;\n\t\tif xmid 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.\n", "language": "Pascal", "metadata": {"date": 1540749415, "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/s138849202.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s138849202", "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.\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1135, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s890828047", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r:longint;\n\ts: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 labs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1540695426, "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/s890828047.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s890828047", "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: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 labs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 25, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s432879610", "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 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": 1540690846, "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/s432879610.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s432879610", "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 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1052, "cpu_time_ms": 26, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s115973644", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r:longint;\n\ts: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\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1540690435, "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/s115973644.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s115973644", "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: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\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 670, "cpu_time_ms": 24, "memory_kb": 512}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s153681101", "group_id": "codeNet:p03224", "input_text": "var\n\tk,n,p,q,i,j:Longint;\n\ts:array[1..500,1..500]of Longint;\n\tc:array[1..500]of Longint;\nbegin\n\tread(n);\n\tk:=1;\n\twhile k*(k-1)n*2 then begin\n\t\twriteln('No');\n\t\texit;\n\tend;\n\twriteln('Yes');\n\twriteln(k);\n\tp:=1;\n\tq:=2;\n\tfor i:=1 to n do begin\n\t\tinc(c[p]);\n\t\tinc(c[q]);\n\t\ts[p,c[p]]:=i;\n\t\ts[q,c[q]]:=i;\n\t\tinc(q);\n\t\tif q>k then begin\n\t\t\tinc(p);\n\t\t\tq:=p+1;\n\t\tend;\n\tend;\n\tfor i:=1 to k do begin\n\t\twrite(k-1);\n\t\tfor j:=1 to k-1 do write(' ',s[i,j]);\n\t\twriteln;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1540694014, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03224.html", "problem_id": "p03224", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03224/input.txt", "sample_output_relpath": "derived/input_output/data/p03224/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03224/Pascal/s153681101.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s153681101", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n3\n2 1 2\n2 3 1\n2 2 3\n", "input_to_evaluate": "var\n\tk,n,p,q,i,j:Longint;\n\ts:array[1..500,1..500]of Longint;\n\tc:array[1..500]of Longint;\nbegin\n\tread(n);\n\tk:=1;\n\twhile k*(k-1)n*2 then begin\n\t\twriteln('No');\n\t\texit;\n\tend;\n\twriteln('Yes');\n\twriteln(k);\n\tp:=1;\n\tq:=2;\n\tfor i:=1 to n do begin\n\t\tinc(c[p]);\n\t\tinc(c[q]);\n\t\ts[p,c[p]]:=i;\n\t\ts[q,c[q]]:=i;\n\t\tinc(q);\n\t\tif q>k then begin\n\t\t\tinc(p);\n\t\t\tq:=p+1;\n\t\tend;\n\tend;\n\tfor i:=1 to k do begin\n\t\twrite(k-1);\n\t\tfor j:=1 to k-1 do write(' ',s[i,j]);\n\t\twriteln;\n\tend;\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": "p03224", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 491, "cpu_time_ms": 29, "memory_kb": 2176}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s618960965", "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,sum1: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 abs(c[x]-a[i])>abs(c[y]-a[i])then \n\tbegin\n\t c[x]:=a[i];inc(i);dec(x);\n\t c[y]:=a[i];inc(i);inc(y);\n\tend\n\telse\n\tbegin\n c[y]:=a[i];inc(i);inc(y);\n\t c[x]:=a[i];inc(i);dec(x);\n\tend;\n if abs(c[x]-a[j])>abs(c[y]-a[j])then\n\tbegin\n\tc[x]:=a[j];dec(j);dec(x);\n\tc[y]:=a[j];dec(j);inc(y);\n\tend\n\telse begin\n c[y]:=a[j];dec(j);inc(y);\n\t c[x]:=a[j];dec(j);dec(x);\n\tend;\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:=2 to n do sum1:=sum1+abs(c[i]-c[i-1]);\n write(sum1);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1540694534, "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/s618960965.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s618960965", "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,sum1: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 abs(c[x]-a[i])>abs(c[y]-a[i])then \n\tbegin\n\t c[x]:=a[i];inc(i);dec(x);\n\t c[y]:=a[i];inc(i);inc(y);\n\tend\n\telse\n\tbegin\n c[y]:=a[i];inc(i);inc(y);\n\t c[x]:=a[i];inc(i);dec(x);\n\tend;\n if abs(c[x]-a[j])>abs(c[y]-a[j])then\n\tbegin\n\tc[x]:=a[j];dec(j);dec(x);\n\tc[y]:=a[j];dec(j);inc(y);\n\tend\n\telse begin\n c[y]:=a[j];dec(j);inc(y);\n\t c[x]:=a[j];dec(j);dec(x);\n\tend;\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:=2 to n do sum1:=sum1+abs(c[i]-c[i-1]);\n write(sum1);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1494, "cpu_time_ms": 25, "memory_kb": 1024}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s535728057", "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,sum1,sum2: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 sum1:=sum1+abs(c[i]-c[i-1]);\n i:=2;j:=n-2;\n if odd(n) then \n begin \n\t\t\t c[n div 2+1]:=a[1];\n\t\t\t\tc[n div 2]:=a[n];\n\t\t\t\tc[n div 2+2]:=a[n-1];\n\t\t\t\ts:=3;\n\t\t\t\tx:=n div 2-1;\n\t\t\t\ty:=n div 2+3;\n\t\t\t end\n\t\t\telse \n\t\t\t begin \n\t\t\t c[n div 2]:=a[1];\n\t\t\t\tc[n div 2-1]:=a[n];\n\t\t\t\tc[n div 2+1]:=a[n-1];\n\t\t\t\ts:=3;\n\t\t\t\tx:=n div 2-2;\n\t\t\t\ty:=n div 2+2;\n\t\t\t end;\n while (x>=1) and (y<=n) do\n begin\n if (s mod 4=3)and(i<=n) then \n begin\n c[y]:=a[i];inc(i);inc(y);\n\tc[x]:=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[y]:=a[j];dec(j);dec(x);\n\tc[x]:=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 sum2:=sum2+abs(c[i]-c[i-1]);\n if sum1>sum2 then write(sum1) else write(sum2);\n readln(i);\nend.", "language": "Pascal", "metadata": {"date": 1540693920, "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/s535728057.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s535728057", "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,sum1,sum2: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 sum1:=sum1+abs(c[i]-c[i-1]);\n i:=2;j:=n-2;\n if odd(n) then \n begin \n\t\t\t c[n div 2+1]:=a[1];\n\t\t\t\tc[n div 2]:=a[n];\n\t\t\t\tc[n div 2+2]:=a[n-1];\n\t\t\t\ts:=3;\n\t\t\t\tx:=n div 2-1;\n\t\t\t\ty:=n div 2+3;\n\t\t\t end\n\t\t\telse \n\t\t\t begin \n\t\t\t c[n div 2]:=a[1];\n\t\t\t\tc[n div 2-1]:=a[n];\n\t\t\t\tc[n div 2+1]:=a[n-1];\n\t\t\t\ts:=3;\n\t\t\t\tx:=n div 2-2;\n\t\t\t\ty:=n div 2+2;\n\t\t\t end;\n while (x>=1) and (y<=n) do\n begin\n if (s mod 4=3)and(i<=n) then \n begin\n c[y]:=a[i];inc(i);inc(y);\n\tc[x]:=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[y]:=a[j];dec(j);dec(x);\n\tc[x]:=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 sum2:=sum2+abs(c[i]-c[i-1]);\n if sum1>sum2 then write(sum1) else write(sum2);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2086, "cpu_time_ms": 26, "memory_kb": 1024}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s656371189", "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": 1540693399, "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/s656371189.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s656371189", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s628401718", "group_id": "codeNet:p03230", "input_text": "var\n c:array[1..10000, 1..10000]of longint;\n f:array[1..2,1..100001]of boolean;\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 if f[2,p]=false then begin write(p,' '); f[2,p]:=true; end;\n\t\t continue;\n\t\tend;\n\t\tinc(q);\n\t\twrite(q,' ');\n\t\tf[1,q]:=true;\n\t\tc[j,k]:=q;\n\tend;\n\tend;\n\twriteln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1540696538, "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/s628401718.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s628401718", "user_id": "u223928734"}, "prompt_components": {"gold_output": "Yes\n3\n2 1 2\n2 3 1\n2 2 3\n", "input_to_evaluate": "var\n c:array[1..10000, 1..10000]of longint;\n f:array[1..2,1..100001]of boolean;\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 if f[2,p]=false then begin write(p,' '); f[2,p]:=true; end;\n\t\t continue;\n\t\tend;\n\t\tinc(q);\n\t\twrite(q,' ');\n\t\tf[1,q]:=true;\n\t\tc[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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1514, "cpu_time_ms": 3, "memory_kb": 4608}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s590667874", "group_id": "codeNet:p03231", "input_text": "var\n x,y:array[0..100000]of char;\n ans:int64;\n i,n,m:longint;\nFunction gcd(x,y:longint):int64;\nbegin\n if y=0 then exit(x) else\n exit(gcd(y,x mod y));\nend;\nbegin\n readln(n,m);\n for i:=1 to n do\n read(x[i]);\n readln;\n for i:=1 to m do\n read(y[i]);\n for i:=0 to n-1 do\n if i*m mod n=0 then\n if x[i+1]<>y[i*m div n+1] then\n begin\n write(-1);\n exit;\n end;\n ans:=n*m div gcd(n,m);\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1539711459, "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/s590667874.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s590667874", "user_id": "u111363574"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n x,y:array[0..100000]of char;\n ans:int64;\n i,n,m:longint;\nFunction gcd(x,y:longint):int64;\nbegin\n if y=0 then exit(x) else\n exit(gcd(y,x mod y));\nend;\nbegin\n readln(n,m);\n for i:=1 to n do\n read(x[i]);\n readln;\n for i:=1 to m do\n read(y[i]);\n for i:=0 to n-1 do\n if i*m mod n=0 then\n if x[i+1]<>y[i*m div n+1] then\n begin\n write(-1);\n exit;\n end;\n ans:=n*m div gcd(n,m);\n write(ans);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 5, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s273140617", "group_id": "codeNet:p03231", "input_text": "var\n\ti:Longint;\n\tn,m,u:int64;\n\ts,t:String;\nfunction gcd(a,b:int64):int64;\nbegin\n\tif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\n\treadln(n,m);\n\tsetlength(s,n);\n\tsetlength(t,m);\n\treadln(s);\n\treadln(t);\n\tu:=gcd(n,m);\n\tfor i:=0 to u-1 do if s[n div u*i+1]<>t[m div u*i+1]then begin\n\t\twriteln(-1);\n\t\texit;\n\tend;\n\twriteln(n*m div u);\nend.\n", "language": "Pascal", "metadata": {"date": 1539491366, "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/s273140617.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s273140617", "user_id": "u657913472"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\ti:Longint;\n\tn,m,u:int64;\n\ts,t:String;\nfunction gcd(a,b:int64):int64;\nbegin\n\tif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\n\treadln(n,m);\n\tsetlength(s,n);\n\tsetlength(t,m);\n\treadln(s);\n\treadln(t);\n\tu:=gcd(n,m);\n\tfor i:=0 to u-1 do if s[n div u*i+1]<>t[m div u*i+1]then begin\n\t\twriteln(-1);\n\t\texit;\n\tend;\n\twriteln(n*m div u);\nend.\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 342, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s690697141", "group_id": "codeNet:p03231", "input_text": "var\n a,b:string;\n n,m,i,j:longint;\n k,p,q:qword;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n p:=n;\n q:=m;\n if p0 do if p>q then begin p:=p mod q; i:=p; p:=q; q:=i; end;\n k:=n*m div q;\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": 1539487243, "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/s690697141.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s690697141", "user_id": "u223928734"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n a,b:string;\n n,m,i,j:longint;\n k,p,q:qword;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n p:=n;\n q:=m;\n if p0 do if p>q then begin p:=p mod q; i:=p; p:=q; q:=i; end;\n k:=n*m div q;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 431, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s975174210", "group_id": "codeNet:p03231", "input_text": "var\n a,b,c:string;\n t:char;\n n,m,i,j,p,q,k:longint;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n p:=n;\n q:=m;\n if p0 do begin p:=p mod q; i:=p; p:=q; q:=i; end;\n k:=n*m div q;\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": 1539486805, "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/s975174210.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s975174210", "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;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n p:=n;\n q:=m;\n if p0 do begin p:=p mod q; i:=p; p:=q; q:=i; end;\n k:=n*m div q;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s035700985", "group_id": "codeNet:p03231", "input_text": "var\n a,b,c:string;\n t:char;\n n,m,i,j,p,q,k:longint;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n p:=n;\n q:=m;\n if p0 do if p>q then begin p:=p mod q; i:=p; p:=q; q:=i; end;\n k:=n*m div q;\n i:=1;\n t:='2';\n while true do\n begin\n t:='2';\n i:=i+q;\n if i>k then break;\n if ((i-1) mod (k mod n)=0) then \n begin\n c[i div q]:=a[(i-1) div (k mod n)+1];\n if ((i-1) mod (k mod m)=0) then t:=b[(i-1) div (k mod m)+1];\n if (t<>'2')and(t=c[i]) then continue\n else if (t<>'2') then begin writeln('-1'); halt; end;\n end;\n end;\n writeln(k);\nend.", "language": "Pascal", "metadata": {"date": 1539485371, "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/s035700985.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s035700985", "user_id": "u380619494"}, "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;\nbegin\n readln(n,m);\n readln(a);\n readln(b);\n p:=n;\n q:=m;\n if p0 do if p>q then begin p:=p mod q; i:=p; p:=q; q:=i; end;\n k:=n*m div q;\n i:=1;\n t:='2';\n while true do\n begin\n t:='2';\n i:=i+q;\n if i>k then break;\n if ((i-1) mod (k mod n)=0) then \n begin\n c[i div q]:=a[(i-1) div (k mod n)+1];\n if ((i-1) mod (k mod m)=0) then t:=b[(i-1) div (k mod m)+1];\n if (t<>'2')and(t=c[i]) then continue\n else if (t<>'2') then begin writeln('-1'); halt; end;\n end;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 638, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s188141637", "group_id": "codeNet:p03241", "input_text": "var\n n,m,d,ans:longint;\nfunction check(x:longint):boolean;\nbegin\n if (m div x)>=n then\n begin\n check:=true;\n end\n else\n begin\n check:=false;\n end;\nend;\nbegin\n ans:=1;\n readln(n,m);\n for d:=1 to trunc(sqrt(m)) do\n begin\n if (m mod d)<>0 then\n begin\n continue;\n end;\n if check(d) then\n begin\n if d>ans then\n begin\n ans:=d;\n end;\n end;\n if check(m div d) then\n begin\n if (m div d)>ans then\n begin\n ans:=m div d;\n end;\n end;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1538965532, "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/s188141637.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s188141637", "user_id": "u478713725"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,m,d,ans:longint;\nfunction check(x:longint):boolean;\nbegin\n if (m div x)>=n then\n begin\n check:=true;\n end\n else\n begin\n check:=false;\n end;\nend;\nbegin\n ans:=1;\n readln(n,m);\n for d:=1 to trunc(sqrt(m)) do\n begin\n if (m mod d)<>0 then\n begin\n continue;\n end;\n if check(d) then\n begin\n if d>ans then\n begin\n ans:=d;\n end;\n end;\n if check(m div d) then\n begin\n if (m div d)>ans then\n begin\n ans:=m div d;\n end;\n end;\n end;\n writeln(ans);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 541, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s594187236", "group_id": "codeNet:p03241", "input_text": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=m div n downto 1 do\n if m mod i=0 then break;\nwrite(i);\nend.", "language": "Pascal", "metadata": {"date": 1538879981, "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/s594187236.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s594187236", "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:=m div n downto 1 do\n if m mod i=0 then break;\nwrite(i);\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 209, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s596146192", "group_id": "codeNet:p03241", "input_text": "var\nn,m,i,t:longint;\nbegin\nread(n,m);\nt:=trunc(sqrt(m));\nfor i:=t downto 1 do\nif m mod i=0 then\nif m div i>=n then\nbegin\nwriteln(i);\nbreak;\nend;\nend.", "language": "Pascal", "metadata": {"date": 1538876977, "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/s596146192.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s596146192", "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:=t downto 1 do\nif m mod i=0 then\nif m div i>=n then\nbegin\nwriteln(i);\nbreak;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 149, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s936043578", "group_id": "codeNet:p03242", "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\n Write (10-strtoint(s[1]));\n Write (10-strtoint(s[2]));\n Writeln(10-strtoint(s[3]));\n\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538269623, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Pascal/s936043578.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s936043578", "user_id": "u755925739"}, "prompt_components": {"gold_output": "991\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;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Readln(s);\n count:=0;\n max :=0;\n min :=100;\n\n Write (10-strtoint(s[1]));\n Write (10-strtoint(s[2]));\n Writeln(10-strtoint(s[3]));\n\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\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 594, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s389811824", "group_id": "codeNet:p03244", "input_text": "var\n a:array[1..100000]of longint;\n b:array[1..2,1..100000]of longint;\n n,m,k,i,p,q,o,f,t:longint;\nbegin \n readln(n);\n for i:=1 to n do \n begin\n read(a[i]);\n\t inc(b[((i-1)mod 2)+1,a[i]]);\n\t if a[i]>k then k:=a[i];\n end;\n for i:=1 to k do\n begin\n if b[1,i]>p then begin p:=b[1,i]; o:=i; end;\n if b[2,i]>q then begin q:=b[2,i]; m:=i; end;\n end;\n if o=m then \n begin \n if p>q then\n\tbegin\n for i:=1 to k do\n\tbegin\n if (b[2,i]<>q)and(b[2,i]>f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if pp)and(b[1,i]>f) then f:=b[1,i];\n end;\n\tf:=f+q;\n\tend else\n\tbegin\n for i:=1 to k do\n\tbegin\n if (b[1,i]<>p)and(b[1,i]>f) then f:=b[1,i];\n if (b[2,i]<>p)and(b[2,i]>t) then t:=b[2,i];\n end;\n\tif t>f then f:=t+p\n\telse f:=f+p;\n\tend;\n end else f:=p+q;\n writeln(n-f);\nend.\n", "language": "Pascal", "metadata": {"date": 1538271442, "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/s389811824.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s389811824", "user_id": "u380619494"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[1..100000]of longint;\n b:array[1..2,1..100000]of longint;\n n,m,k,i,p,q,o,f,t:longint;\nbegin \n readln(n);\n for i:=1 to n do \n begin\n read(a[i]);\n\t inc(b[((i-1)mod 2)+1,a[i]]);\n\t if a[i]>k then k:=a[i];\n end;\n for i:=1 to k do\n begin\n if b[1,i]>p then begin p:=b[1,i]; o:=i; end;\n if b[2,i]>q then begin q:=b[2,i]; m:=i; end;\n end;\n if o=m then \n begin \n if p>q then\n\tbegin\n for i:=1 to k do\n\tbegin\n if (b[2,i]<>q)and(b[2,i]>f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if pp)and(b[1,i]>f) then f:=b[1,i];\n end;\n\tf:=f+q;\n\tend else\n\tbegin\n for i:=1 to k do\n\tbegin\n if (b[1,i]<>p)and(b[1,i]>f) then f:=b[1,i];\n if (b[2,i]<>p)and(b[2,i]>t) then t:=b[2,i];\n end;\n\tif t>f then f:=t+p\n\telse f:=f+p;\n\tend;\n end else f:=p+q;\n writeln(n-f);\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": "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 876, "cpu_time_ms": 14, "memory_kb": 1280}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s116918613", "group_id": "codeNet:p03244", "input_text": "var\n\tf1,f2:array[0..100010] of longint;\n\tmax,t:array[1..2,1..2] of longint;\n\tn,i,x,s:longint;\nbegin\n\tread(n);\n\tfillchar(f1,sizeof(f1),0);\n\tfillchar(f2,sizeof(f2),0);\n\tfillchar(max,sizeof(max),0);\n\tfor i:=1 to n do\n\tbegin\n\t\tread(x);\n\t\tif i mod 2=1 then\n\t\tbegin \n\t\t\tinc(f1[x]);\n\t\t\tif f1[x]>max[1,1] then\n\t\t\tbegin\n\t\t\t\tif x<>t[1,1] then \n\t\t\t\tbegin\n\t\t\t\t\tmax[1,2]:=max[1,1];\n\t\t\t\t\tt[1,2]:=t[1,1];\n\t\t\t\tend;\n\t\t\t\tmax[1,1]:=f1[x];\n\t\t\t\tt[1,1]:=x;\n\t\t\tend\n\t\t\telse if f1[x]>max[1,2] then \n\t\t\t\tbegin \n\t\t\t\t\tmax[1,2]:=f1[x];\n\t\t\t\t\tt[1,2]:=x;\n\t\t\t\tend;\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tinc(f2[x]);\n\t\t\tif f2[x]>max[2,1] then\n\t\t\tbegin\n\t\t\t\tif x<>t[2,1] then\n\t\t\t\tbegin\n\t\t\t\t\tmax[2,2]:=max[2,1];\n\t\t\t\t\tt[2,2]:=t[2,1];\n\t\t\t\tend;\n\t\t\t\tmax[2,1]:=f2[x];\n\t\t\t\tt[2,1]:=x;\n\t\t\tend\n\t\t\telse if f2[x]>max[2,2] then \t\n\t\t\t\tbegin \n\t\t\t\t\tmax[2,2]:=f2[x];\n\t\t\t\t\tt[1,2]:=x;\n\t\t\t\tend;\n\t\tend;\n\tend;\n\ts:=0;\n\tif (t[1,1]<>t[2,1]) then s:=max[1,1]+max[2,1]\n\telse if max[1,2]+max[2,1]>max[1,1]+max[2,2] then s:=max[1,2]+max[2,1]\n\telse s:=max[1,1]+max[2,2];\n\tif (t[1,1]=t[2,1]) and (max[1,2]=0) and (max[2,2]=0) then writeln(n div 2)\n\telse writeln(n-s);\nend.", "language": "Pascal", "metadata": {"date": 1538270962, "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/s116918613.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s116918613", "user_id": "u957998623"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tf1,f2:array[0..100010] of longint;\n\tmax,t:array[1..2,1..2] of longint;\n\tn,i,x,s:longint;\nbegin\n\tread(n);\n\tfillchar(f1,sizeof(f1),0);\n\tfillchar(f2,sizeof(f2),0);\n\tfillchar(max,sizeof(max),0);\n\tfor i:=1 to n do\n\tbegin\n\t\tread(x);\n\t\tif i mod 2=1 then\n\t\tbegin \n\t\t\tinc(f1[x]);\n\t\t\tif f1[x]>max[1,1] then\n\t\t\tbegin\n\t\t\t\tif x<>t[1,1] then \n\t\t\t\tbegin\n\t\t\t\t\tmax[1,2]:=max[1,1];\n\t\t\t\t\tt[1,2]:=t[1,1];\n\t\t\t\tend;\n\t\t\t\tmax[1,1]:=f1[x];\n\t\t\t\tt[1,1]:=x;\n\t\t\tend\n\t\t\telse if f1[x]>max[1,2] then \n\t\t\t\tbegin \n\t\t\t\t\tmax[1,2]:=f1[x];\n\t\t\t\t\tt[1,2]:=x;\n\t\t\t\tend;\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tinc(f2[x]);\n\t\t\tif f2[x]>max[2,1] then\n\t\t\tbegin\n\t\t\t\tif x<>t[2,1] then\n\t\t\t\tbegin\n\t\t\t\t\tmax[2,2]:=max[2,1];\n\t\t\t\t\tt[2,2]:=t[2,1];\n\t\t\t\tend;\n\t\t\t\tmax[2,1]:=f2[x];\n\t\t\t\tt[2,1]:=x;\n\t\t\tend\n\t\t\telse if f2[x]>max[2,2] then \t\n\t\t\t\tbegin \n\t\t\t\t\tmax[2,2]:=f2[x];\n\t\t\t\t\tt[1,2]:=x;\n\t\t\t\tend;\n\t\tend;\n\tend;\n\ts:=0;\n\tif (t[1,1]<>t[2,1]) then s:=max[1,1]+max[2,1]\n\telse if max[1,2]+max[2,1]>max[1,1]+max[2,2] then s:=max[1,2]+max[2,1]\n\telse s:=max[1,1]+max[2,2];\n\tif (t[1,1]=t[2,1]) and (max[1,2]=0) and (max[2,2]=0) then writeln(n div 2)\n\telse writeln(n-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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1091, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s613296170", "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: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;\ns:=0;\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": 1538270209, "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/s613296170.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s613296170", "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: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;\ns:=0;\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 16, "memory_kb": 1280}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s365211094", "group_id": "codeNet:p03245", "input_text": "var\n\ti,j,k,n,max:longint;\n\tt,x,y:array[-110..10010] 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": 1538274847, "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/s365211094.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s365211094", "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[-110..10010] 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 256}, "variant": "low_resource"}
{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s301922887", "group_id": "codeNet:p03246", "input_text": "var\n\tN,i,L,R,x,y,z,w:Longint;\n\ta,b:Array[0..100000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(x);\n\t\tif i mod 2=1 then inc(a[x])else inc(b[x]);\n\tend;\n\tx:=0;\n\tfor i:=1 to N do begin\n\t\tif a[x]z then writeln(N-a[x]-b[z])else begin\n\t\tL:=N-a[y]-b[z];\n\t\tR:=N-a[x]-b[w];\n\t\tif Lz then writeln(N-a[x]-b[z])else begin\n\t\tL:=N-a[y]-b[z];\n\t\tR:=N-a[x]-b[w];\n\t\tif Ly then exit(x) else exit(y);\n end;\nbegin\nreadln(n);\nfor i:=1 to n do\n begin\n read(a[i]);\n if mp2 then\n begin\n ans:=n-k1-k2;\n end\n else\n begin\n j1:=0;j2:=0;\n for i:=1 to m do\n begin\n if i=p1 then continue;\n if j1y then exit(x) else exit(y);\n end;\nbegin\nreadln(n);\nfor i:=1 to n do\n begin\n read(a[i]);\n if m