{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s092709226", "group_id": "codeNet:p02534", "input_text": "var\n n, i: integer;\nbegin\n read(n);\n for i:=1 to n do write('ACL');\nend.", "language": "Pascal", "metadata": {"date": 1601177372, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02534.html", "problem_id": "p02534", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02534/input.txt", "sample_output_relpath": "derived/input_output/data/p02534/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02534/Pascal/s092709226.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s092709226", "user_id": "u172873334"}, "prompt_components": {"gold_output": "ACLACLACL\n", "input_to_evaluate": "var\n n, i: integer;\nbegin\n read(n);\n for i:=1 to n do write('ACL');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer K.\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nFor example, if K = 3, print ACLACLACL.\n\nConstraints\n\n1 \\leq K \\leq 5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nACLACLACL", "sample_input": "3\n"}, "reference_outputs": ["ACLACLACL\n"], "source_document_id": "p02534", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer K.\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nFor example, if K = 3, print ACLACLACL.\n\nConstraints\n\n1 \\leq K \\leq 5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nACLACLACL", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 75, "cpu_time_ms": 6, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s201626657", "group_id": "codeNet:p02546", "input_text": "var s:String;\nbegin\nreadln(s);\nwrite(s);\nif s[length(s)]='s' then writeln('es')else writeln('s');\nend.", "language": "Pascal", "metadata": {"date": 1600548130, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02546.html", "problem_id": "p02546", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02546/input.txt", "sample_output_relpath": "derived/input_output/data/p02546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02546/Pascal/s201626657.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s201626657", "user_id": "u657913472"}, "prompt_components": {"gold_output": "apples\n", "input_to_evaluate": "var s:String;\nbegin\nreadln(s);\nwrite(s);\nif s[length(s)]='s' then writeln('es')else writeln('s');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\n\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n\nIf a noun's singular form does not end with s, append s to the end of the singular form.\n\nIf a noun's singular form ends with s, append es to the end of the singular form.\n\nYou are given the singular form S of a Taknese noun. Output its plural form.\n\nConstraints\n\nS is a string of length 1 between 1000, inclusive.\n\nS contains only lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the plural form of the given Taknese word.\n\nSample Input 1\n\napple\n\nSample Output 1\n\napples\n\napple ends with e, so its plural form is apples.\n\nSample Input 2\n\nbus\n\nSample Output 2\n\nbuses\n\nbus ends with s, so its plural form is buses.\n\nSample Input 3\n\nbox\n\nSample Output 3\n\nboxs", "sample_input": "apple\n"}, "reference_outputs": ["apples\n"], "source_document_id": "p02546", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\n\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n\nIf a noun's singular form does not end with s, append s to the end of the singular form.\n\nIf a noun's singular form ends with s, append es to the end of the singular form.\n\nYou are given the singular form S of a Taknese noun. Output its plural form.\n\nConstraints\n\nS is a string of length 1 between 1000, inclusive.\n\nS contains only lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the plural form of the given Taknese word.\n\nSample Input 1\n\napple\n\nSample Output 1\n\napples\n\napple ends with e, so its plural form is apples.\n\nSample Input 2\n\nbus\n\nSample Output 2\n\nbuses\n\nbus ends with s, so its plural form is buses.\n\nSample Input 3\n\nbox\n\nSample Output 3\n\nboxs", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s278657512", "group_id": "codeNet:p02548", "input_text": "program test;\n{$mode objfpc}{$H+}{$R+}{$S+}\nUses sysutils,math;\nvar\n\tN\t :integer;\n\ta,b,ans :integer;\nbegin\n readln(N);\n ans:=0;\n for a:=1 to N do\n begin\n for b:=1 to (N div a) do\n begin\n if ((a*b) 0 then\n begin\n offset := b[x] - 1;\n period := i - offset - 1;\n break;\n end;\n b[x] := i;\n end;\n num := (n - offset) div period;\n rem := n - offset - num * period;\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "language": "Pascal", "metadata": {"date": 1600569768, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Pascal/s157434722.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s157434722", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[x] := 1;\n for i := 2 to m + 1 do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n if b[x] > 0 then\n begin\n offset := b[x] - 1;\n period := i - offset - 1;\n break;\n end;\n b[x] := i;\n end;\n num := (n - offset) div period;\n rem := n - offset - num * period;\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 691, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s329211917", "group_id": "codeNet:p02550", "input_text": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, k, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[integer(x)] := 1;\n for i := 2 to integer(m) + 1 do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n k := integer(x);\n if b[k] > 0 then\n begin\n offset := b[k] - 1;\n period := i - offset - 1;\n break;\n end;\n b[k] := i;\n end;\n num := (n - offset) div int64(period);\n rem := integer(n - offset - num * period);\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "language": "Pascal", "metadata": {"date": 1600569089, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Pascal/s329211917.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s329211917", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, k, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[integer(x)] := 1;\n for i := 2 to integer(m) + 1 do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n k := integer(x);\n if b[k] > 0 then\n begin\n offset := b[k] - 1;\n period := i - offset - 1;\n break;\n end;\n b[k] := i;\n end;\n num := (n - offset) div int64(period);\n rem := integer(n - offset - num * period);\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 749, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s288950532", "group_id": "codeNet:p02550", "input_text": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n for i := 0 to 100000 do\n begin\n a[i] := 0;\n b[i] := 0;\n end;\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[x] := 1;\n for i := 2 to m do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n if b[x] > 0 then\n begin\n offset := b[x] - 1;\n period := i - offset - 1;\n break;\n end;\n b[x] := i;\n end;\n num := (n - offset) div period;\n rem := n - offset - num * period;\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "language": "Pascal", "metadata": {"date": 1600568905, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Pascal/s288950532.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s288950532", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum;\nvar\n n, x, m, num: int64;\n i, offset, period, rem: integer;\n a: array[0..100000] of int64;\n b: array[0..100000] of integer;\nbegin\n for i := 0 to 100000 do\n begin\n a[i] := 0;\n b[i] := 0;\n end;\n read(n, x, m);\n if n = 1 then\n begin\n writeln(x);\n halt(0);\n end;\n a[1] := x;\n b[x] := 1;\n for i := 2 to m do\n begin\n x := (x * x) mod m;\n a[i] := a[i - 1] + x;\n if i = n then\n begin\n writeln(a[i]);\n halt(0);\n end;\n if b[x] > 0 then\n begin\n offset := b[x] - 1;\n period := i - offset - 1;\n break;\n end;\n b[x] := i;\n end;\n num := (n - offset) div period;\n rem := n - offset - num * period;\n writeln((a[offset + period] - a[offset]) * num + a[offset + rem]);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 758, "cpu_time_ms": 3, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s250905391", "group_id": "codeNet:p02552", "input_text": "var\n i: integer;\nbegin\n read(i);\n write(1-i);\nend.", "language": "Pascal", "metadata": {"date": 1600027868, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Pascal/s250905391.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s250905391", "user_id": "u172873334"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i: integer;\nbegin\n read(i);\n write(1-i);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 53, "cpu_time_ms": 4, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s282706451", "group_id": "codeNet:p02552", "input_text": "var\n\nk,x,i:integer;\ns:string;\nr:real;\n\n\n\nbegin\n\n//program 1\n\nreadln(x);\n\nIF (x = 0) THEN\n\nbegin\n\twriteln('1');\nend;\n\nIF (x = 1) THEN\n\nbegin\n\twriteln('0');\nend;\n\nend.\n", "language": "Pascal", "metadata": {"date": 1600023758, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Pascal/s282706451.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s282706451", "user_id": "u655825084"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n\nk,x,i:integer;\ns:string;\nr:real;\n\n\n\nbegin\n\n//program 1\n\nreadln(x);\n\nIF (x = 0) THEN\n\nbegin\n\twriteln('1');\nend;\n\nIF (x = 1) THEN\n\nbegin\n\twriteln('0');\nend;\n\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 166, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s895612466", "group_id": "codeNet:p02553", "input_text": "Program AtCoderBeginnerContest178;\n\nuses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (c > 0) THEN//if all positive\nbegin\n\tx:= b * d;\n\twriteln(x);\n\texit;\nend;\n\nIF (b < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\n\n\n\n//program 1\n\n{readln(x);\n\nIF (x = 0) THEN\n\nbegin\n\twriteln('1');\nend;\n\nIF (x = 1) THEN\n\nbegin\n\twriteln('0');\nend;}\n\nend.\n", "language": "Pascal", "metadata": {"date": 1600029361, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s895612466.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s895612466", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Program AtCoderBeginnerContest178;\n\nuses\nsysutils,strutils, math;\n\nvar\n\na,b,c,d,x,temp,t2 :int64;\ns:string;\nr:real;\n\n\n\nbegin\n\nread(a);\nread(b);\nread(c);\nread(d);\n\n\nIF (b = 0) AND (d = 0) THEN\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (c > 0) THEN//if all positive\nbegin\n\tx:= b * d;\n\twriteln(x);\n\texit;\nend;\n\nIF (b < 0) AND (d < 0) THEN//if all negative\nbegin\n\tx:= a * c;\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) AND (b < 0) AND (c > 0) AND (d > 0) THEN//if both x range negative\nbegin\n\ttemp:= max(a,b);\n\tx:= temp * min(c,d);\n\twriteln(x);\n\texit;\nend;\n\nIF (a > 0) AND (b > 0) AND (c < 0) AND (d < 0) THEN//if both y range negative\nbegin\n\ttemp:= max(c,d);\n\tx:= temp * min(a,b);\n\twriteln(x);\n\texit;\nend;\n\nIF (a < 0) OR (b < 0) THEN\nbegin\n\ttemp:= max(a,b);\nend;\n\n\nIF (c < 0) OR (d < 0) THEN\nbegin\n\tt2:= max(c,d);\nend;\n\nwriteln(x);\n\n\n\n\n//program 1\n\n{readln(x);\n\nIF (x = 0) THEN\n\nbegin\n\twriteln('1');\nend;\n\nIF (x = 1) THEN\n\nbegin\n\twriteln('0');\nend;}\n\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 963, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s899947332", "group_id": "codeNet:p02553", "input_text": "uses\nsysutils, math;\n\n\nvar\na,b,c,d,x,t1,t2: integer;\n\nbegin\n\nread (a);\nread (b);\nread(c);\nread(d);\n\nIF (b = 0) AND (c = 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n\nIF (a > 0) AND (c > 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\nend;\n\nIF (b < 0) AND (d < 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n\nIF (a < 0) AND (c < 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\n exit;\nend;\n\nIF (b < 0) OR (d < 0) THEN\nbegin\n\tx:= min(a,b) * min(c,d);\n writeln(x);\n exit;\nend;\n\nend.", "language": "Pascal", "metadata": {"date": 1600029144, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s899947332.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s899947332", "user_id": "u655825084"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses\nsysutils, math;\n\n\nvar\na,b,c,d,x,t1,t2: integer;\n\nbegin\n\nread (a);\nread (b);\nread(c);\nread(d);\n\nIF (b = 0) AND (c = 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n\nIF (a > 0) AND (c > 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\nend;\n\nIF (b < 0) AND (d < 0) THEN\nbegin\n\tx:= a * c;\n writeln(x);\n exit;\nend;\n\nIF (a < 0) AND (c < 0) THEN\nbegin\n\tx:= b * d;\n writeln(x);\n exit;\nend;\n\nIF (b < 0) OR (d < 0) THEN\nbegin\n\tx:= min(a,b) * min(c,d);\n writeln(x);\n exit;\nend;\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 497, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s665032646", "group_id": "codeNet:p02553", "input_text": "program test;\n{$mode objfpc}{$H+}{$R+}{$S+}\nUses sysutils,math;\nvar\n\ta,b,c,d\t\t:int64;\n ans :int64;\nbegin\n readln(a,b,c,d);\n ans:=max(max(a*c,a*d),max(b*c,b*d));\n writeln(stdout,ans);\nend.", "language": "Pascal", "metadata": {"date": 1600024647, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Pascal/s665032646.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s665032646", "user_id": "u705827623"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program test;\n{$mode objfpc}{$H+}{$R+}{$S+}\nUses sysutils,math;\nvar\n\ta,b,c,d\t\t:int64;\n ans :int64;\nbegin\n readln(a,b,c,d);\n ans:=max(max(a*c,a*d),max(b*c,b*d));\n writeln(stdout,ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 6, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s734971029", "group_id": "codeNet:p02556", "input_text": "program test;\n{$mode objfpc}{$H+}{$R-}{$S+}\nUses sysutils;\nvar\n\tN,i,j\t :integer;\n X,Y :array [1..200000] of integer;\n\ttmp,ans\t\t:integer;\nbegin\n readln(N);\n for i:=1 to N do if (ij) then\n begin\n tmp:=ABS(X[i]-X[j])+ABS(Y[i]-Y[j]);\n if (ansj) then\n begin\n tmp:=ABS(X[i]-X[j])+ABS(Y[i]-Y[j]);\n if (ansa) then\n begin\n if (abs(t-D) <= t) then\n begin\n t:=t-D;\n inc(a);\n end;\n if ((k-a) mod 2 <> 0) then t:=t+D;\n end;\n write(abs(t));\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1597522048, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02584.html", "problem_id": "p02584", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02584/input.txt", "sample_output_relpath": "derived/input_output/data/p02584/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02584/Pascal/s916482324.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s916482324", "user_id": "u824872487"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program bt;\n\nvar X,K,D,a,t:int64;\n\nbegin\n readln(X,K,D);\n a:=X div D;\n t:=X mod D;\n if (ka) then\n begin\n if (abs(t-D) <= t) then\n begin\n t:=t-D;\n inc(a);\n end;\n if ((k-a) mod 2 <> 0) then t:=t+D;\n end;\n write(abs(t));\n readln;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "sample_input": "6 2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02584", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 328, "cpu_time_ms": 4, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s312000828", "group_id": "codeNet:p02588", "input_text": "program bt;\n\nvar n,i,j,t :longint;\n a :array[1..200001] of real;\n \nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if ((a[i]*a[j])=trunc(a[i]*a[j])) then inc(t);\n write(t);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1597024344, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02588.html", "problem_id": "p02588", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02588/input.txt", "sample_output_relpath": "derived/input_output/data/p02588/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02588/Pascal/s312000828.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s312000828", "user_id": "u824872487"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program bt;\n\nvar n,i,j,t :longint;\n a :array[1..200001] of real;\n \nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if ((a[i]*a[j])=trunc(a[i]*a[j])) then inc(t);\n write(t);\n readln;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N real values A_1, A_2, \\ldots, A_N.\nCompute the number of pairs of indices (i, j)\nsuch that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 < A_i < 10^4\n\nA_i is given with at most 9 digits after the decimal.\n\nInput\n\nInput is given from Standard Input in the following format.\n\nN\nA_1\nA_2\n\\vdots\nA_N\n\nOutput\n\nPrint the number of pairs with integer product A_i \\cdot A_j (and i < j).\n\nSample Input 1\n\n5\n7.5\n2.4\n17.000000001\n17\n16.000000000\n\nSample Output 1\n\n3\n\nThere are 3 pairs with integer product:\n\n7.5 \\cdot 2.4 = 18\n\n7.5 \\cdot 16 = 120\n\n17 \\cdot 16 = 272\n\nSample Input 2\n\n11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.000000001\n\nSample Output 2\n\n8", "sample_input": "5\n7.5\n2.4\n17.000000001\n17\n16.000000000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02588", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N real values A_1, A_2, \\ldots, A_N.\nCompute the number of pairs of indices (i, j)\nsuch that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 < A_i < 10^4\n\nA_i is given with at most 9 digits after the decimal.\n\nInput\n\nInput is given from Standard Input in the following format.\n\nN\nA_1\nA_2\n\\vdots\nA_N\n\nOutput\n\nPrint the number of pairs with integer product A_i \\cdot A_j (and i < j).\n\nSample Input 1\n\n5\n7.5\n2.4\n17.000000001\n17\n16.000000000\n\nSample Output 1\n\n3\n\nThere are 3 pairs with integer product:\n\n7.5 \\cdot 2.4 = 18\n\n7.5 \\cdot 16 = 120\n\n17 \\cdot 16 = 272\n\nSample Input 2\n\n11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.000000001\n\nSample Output 2\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2205, "memory_kb": 1764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s293381698", "group_id": "codeNet:p02590", "input_text": "program Hello;\n\nvar n,i,j:longint;\n t : int64;\n a :array[1..200001] of longint;\nbegin\n readln(n);\n for i:=1 to n-1 do\n begin\n read(a[i]);\n end;\n readln(a[n]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n t:=t+((a[i]*a[j]) mod 200003);\n write(t);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1597025939, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02590.html", "problem_id": "p02590", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02590/input.txt", "sample_output_relpath": "derived/input_output/data/p02590/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02590/Pascal/s293381698.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s293381698", "user_id": "u824872487"}, "prompt_components": {"gold_output": "474287\n", "input_to_evaluate": "program Hello;\n\nvar n,i,j:longint;\n t : int64;\n a :array[1..200001] of longint;\nbegin\n readln(n);\n for i:=1 to n-1 do\n begin\n read(a[i]);\n end;\n readln(a[n]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n t:=t+((a[i]*a[j]) mod 200003);\n write(t);\n readln;\nend.", "problem_context": "Score : 800 points\n\nProblem Statement\n\nLet’s take a prime P = 200\\,003.\nYou are given N integers A_1, A_2, \\ldots, A_N.\nFind the sum of ((A_i \\cdot A_j) \\bmod P) over all N \\cdot (N-1) / 2 unordered pairs of elements (i < j).\n\nPlease note that the sum isn't computed modulo P.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 \\leq A_i < P = 200\\,003\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 \\cdots A_N\n\nOutput\n\nPrint one integer — the sum over ((A_i \\cdot A_j) \\bmod P).\n\nSample Input 1\n\n4\n2019 0 2020 200002\n\nSample Output 1\n\n474287\n\nThe non-zero products are:\n\n2019 \\cdot 2020 \\bmod P = 78320\n\n2019 \\cdot 200002 \\bmod P = 197984\n\n2020 \\cdot 200002 \\bmod P = 197983\n\nSo the answer is 0 + 78320 + 197984 + 0 + 0 + 197983 = 474287.\n\nSample Input 2\n\n5\n1 1 2 2 100000\n\nSample Output 2\n\n600013", "sample_input": "4\n2019 0 2020 200002\n"}, "reference_outputs": ["474287\n"], "source_document_id": "p02590", "source_text": "Score : 800 points\n\nProblem Statement\n\nLet’s take a prime P = 200\\,003.\nYou are given N integers A_1, A_2, \\ldots, A_N.\nFind the sum of ((A_i \\cdot A_j) \\bmod P) over all N \\cdot (N-1) / 2 unordered pairs of elements (i < j).\n\nPlease note that the sum isn't computed modulo P.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 \\leq A_i < P = 200\\,003\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 \\cdots A_N\n\nOutput\n\nPrint one integer — the sum over ((A_i \\cdot A_j) \\bmod P).\n\nSample Input 1\n\n4\n2019 0 2020 200002\n\nSample Output 1\n\n474287\n\nThe non-zero products are:\n\n2019 \\cdot 2020 \\bmod P = 78320\n\n2019 \\cdot 200002 \\bmod P = 197984\n\n2020 \\cdot 200002 \\bmod P = 197983\n\nSo the answer is 0 + 78320 + 197984 + 0 + 0 + 197983 = 474287.\n\nSample Input 2\n\n5\n1 1 2 2 100000\n\nSample Output 2\n\n600013", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2205, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s551330398", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597205459, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s551330398.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s551330398", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s826261243", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1597205425, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s826261243.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s826261243", "user_id": "u959888075"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\n read(x);\n if x >= 30 then writeln('Yes')\n else writeln('No')\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s879016588", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596462468, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s879016588.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s879016588", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 5, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s725280824", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1596435911, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s725280824.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s725280824", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 6, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s053590311", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596433725, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s053590311.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s053590311", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s240268497", "group_id": "codeNet:p02594", "input_text": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596433485, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s240268497.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s240268497", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "var x:Longint;\nbegin\nread(x);\nif x>=30 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 2, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s257977718", "group_id": "codeNet:p02594", "input_text": "program bt;\nvar x:integer;\nbegin\n readln(x);\n if (x>=30) then write('Yes') else write('No');\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1596418209, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Pascal/s257977718.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s257977718", "user_id": "u824872487"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program bt;\nvar x:integer;\nbegin\n readln(x);\n if (x>=30) then write('Yes') else write('No');\n readln;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 112, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s162344637", "group_id": "codeNet:p02595", "input_text": "var\n a,b:array[0..200005] of int64;\n i:longint;\n n,h,res:int64;\n check:real;\nbegin\n read(n,h);\n res:=0;\n for i:=1 to n do read(a[i],b[i]);\n for i:=1 to n do\n begin\n check:=0;\n check:=sqrt(sqr(a[i])+sqr(b[i]));\n if check<=h then inc(res);\n end;\n write(res);\nend.\n", "language": "Pascal", "metadata": {"date": 1599273337, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Pascal/s162344637.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s162344637", "user_id": "u697669604"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n a,b:array[0..200005] of int64;\n i:longint;\n n,h,res:int64;\n check:real;\nbegin\n read(n,h);\n res:=0;\n for i:=1 to n do read(a[i],b[i]);\n for i:=1 to n do\n begin\n check:=0;\n check:=sqrt(sqr(a[i])+sqr(b[i]));\n if check<=h then inc(res);\n end;\n write(res);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 384, "cpu_time_ms": 60, "memory_kb": 3340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s911099329", "group_id": "codeNet:p02595", "input_text": "var\n a,b:array[0..200005] of int64;\n i:longint;\n n,h,res:int64;\n check:real;\nbegin\n read(n,h);\n res:=0;\n for i:=1 to n do read(a[i],b[i]);\n for i:=1 to n do\n begin\n check:=0;\n check:=sqrt(sqr(a[i])+sqr(b[i]));\n if check<=h then inc(res);\n end;\n write(res);\nend.\n", "language": "Pascal", "metadata": {"date": 1599273313, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Pascal/s911099329.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s911099329", "user_id": "u697669604"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n a,b:array[0..200005] of int64;\n i:longint;\n n,h,res:int64;\n check:real;\nbegin\n read(n,h);\n res:=0;\n for i:=1 to n do read(a[i],b[i]);\n for i:=1 to n do\n begin\n check:=0;\n check:=sqrt(sqr(a[i])+sqr(b[i]));\n if check<=h then inc(res);\n end;\n write(res);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 384, "cpu_time_ms": 62, "memory_kb": 3340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s355184668", "group_id": "codeNet:p02595", "input_text": "program bt;\n\nvar t,n,d,i:integer;\n x,y,a:array[1..10000] of integer;\n\nbegin\n readln(n,d);\n for i:=1 to n do\n readln(x[i],y[i]);\n for i:=1 to n do\n a[i]:=trunc(sqrt(sqr(x[i])+sqr(y[i])));\n t:=0;\n for i:=1 to n do\n if (a[i]=d) then t:=t+1;\n write(t);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1596420004, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Pascal/s355184668.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s355184668", "user_id": "u824872487"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program bt;\n\nvar t,n,d,i:integer;\n x,y,a:array[1..10000] of integer;\n\nbegin\n readln(n,d);\n for i:=1 to n do\n readln(x[i],y[i]);\n for i:=1 to n do\n a[i]:=trunc(sqrt(sqr(x[i])+sqr(y[i])));\n t:=0;\n for i:=1 to n do\n if (a[i]=d) then t:=t+1;\n write(t);\n readln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 14, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s810068667", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733558, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s810068667.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s810068667", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s606243722", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733419, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s606243722.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s606243722", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 7, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s645485613", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733294, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s645485613.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s645485613", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 3, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s381805382", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733076, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s381805382.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s381805382", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s454159506", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733051, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s454159506.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s454159506", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s340414050", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595733002, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s340414050.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s340414050", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s443947688", "group_id": "codeNet:p02600", "input_text": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "language": "Pascal", "metadata": {"date": 1595732904, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s443947688.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s443947688", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "var N:Longint;\nbegin\nread(N);\nwriteln(10-N div 200);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 2, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s144702617", "group_id": "codeNet:p02600", "input_text": "program bt;\n\nvar x:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then write(8) else\n if (x>=600) and (x<=799) then write(7) else\n if (x>=800) and (x<=999) then write(6) else\n if (x>=1000) and (x<=1199) then write(5) else\n if (x>=1200) and (x<=1399) then write(4) else\n if (x>=1400) and (x<=1399) then write(3) else\n if (x>=1600) and (x<=1799) then write(2) else\n if (x>=1800) and (x<=1999) then write(1);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595727337, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s144702617.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s144702617", "user_id": "u824872487"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program bt;\n\nvar x:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then write(8) else\n if (x>=600) and (x<=799) then write(7) else\n if (x>=800) and (x<=999) then write(6) else\n if (x>=1000) and (x<=1199) then write(5) else\n if (x>=1200) and (x<=1399) then write(4) else\n if (x>=1400) and (x<=1399) then write(3) else\n if (x>=1600) and (x<=1799) then write(2) else\n if (x>=1800) and (x<=1999) then write(1);\n readln;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 446, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s671849538", "group_id": "codeNet:p02600", "input_text": "program bt;\n\nvar x:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then write('8') else\n if (x>=600) and (x<=799) then write('7') else\n if (x>=800) and (x<=999) then write('6') else\n if (x>=1000) and (x<=1199) then write('5') else\n if (x>=1200) and (x<=1399) then write(4) else\n if (x>=1400) and (x<=1399) then write(3) else\n if (x>=1600) and (x<=1799) then write(2) else\n if (x>=1800) and (x<=1999) then write(1);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595726847, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Pascal/s671849538.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s671849538", "user_id": "u824872487"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program bt;\n\nvar x:integer;\n\nbegin\n readln(x);\n if (x>=400) and (x<=599) then write('8') else\n if (x>=600) and (x<=799) then write('7') else\n if (x>=800) and (x<=999) then write('6') else\n if (x>=1000) and (x<=1199) then write('5') else\n if (x>=1200) and (x<=1399) then write(4) else\n if (x>=1400) and (x<=1399) then write(3) else\n if (x>=1600) and (x<=1799) then write(2) else\n if (x>=1800) and (x<=1999) then write(1);\n readln;\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 454, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s162139057", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733522, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s162139057.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s162139057", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s971123422", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733421, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s971123422.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s971123422", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 4, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s152290004", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733410, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s152290004.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s152290004", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s253410146", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733296, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s253410146.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s253410146", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s013780457", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733244, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s013780457.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s013780457", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 5, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s289475196", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595733208, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s289475196.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s289475196", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s568569115", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1595732906, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s568569115.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s568569115", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s485968435", "group_id": "codeNet:p02601", "input_text": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1595732764, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s485968435.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s485968435", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tA,B,C,K:Longint;\nbegin\n\tread(A,B,C,K);\n\twhile A>=B do begin\n\t\tdec(K);\n\t\tB:=B*2;\n\tend;\n\twhile B>=C do begin\n\t\tdec(K);\n\t\tC:=C*2;\n\tend;\n\tif K<0 then writeln('No')else writeln('Yes');\nend.\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 3, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s659893147", "group_id": "codeNet:p02601", "input_text": "program bt;\nvar a,b,c,k:integer;\nbegin\n readln(a,b,c);\n readln(k);\n while (b<=a) and (k>0) do\n begin\n b:=b*2;\n k:=k-1;\n end;\n while (c<=b) and (k>0) do\n begin\n c:=c*2;\n k:=k-1;\n end;\n if (b>a) and (c>b) then write('Yes') else write('No');\n readln;\n end.\n ", "language": "Pascal", "metadata": {"date": 1595731010, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Pascal/s659893147.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s659893147", "user_id": "u824872487"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program bt;\nvar a,b,c,k:integer;\nbegin\n readln(a,b,c);\n readln(k);\n while (b<=a) and (k>0) do\n begin\n b:=b*2;\n k:=k-1;\n end;\n while (c<=b) and (k>0) do\n begin\n c:=c*2;\n k:=k-1;\n end;\n if (b>a) and (c>b) then write('Yes') else write('No');\n readln;\n end.\n ", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 305, "cpu_time_ms": 8, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s593156951", "group_id": "codeNet:p02602", "input_text": "program bt;\n\nvar n,k,i:longint;\n a :array[1..200001] of longint;\n\nbegin\n readln(n,k);\n for i:=1 to n-1 do\n read(a[i]);\n readln(a[n]);\n for i:=k+1 to n do\n if (a[i]>a[i-1]) then writeln('Yes') else writeln('No');\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1595729696, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02602.html", "problem_id": "p02602", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02602/input.txt", "sample_output_relpath": "derived/input_output/data/p02602/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02602/Pascal/s593156951.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s593156951", "user_id": "u824872487"}, "prompt_components": {"gold_output": "Yes\nNo\n", "input_to_evaluate": "program bt;\n\nvar n,k,i:longint;\n a :array[1..200001] of longint;\n\nbegin\n readln(n,k);\n for i:=1 to n-1 do\n read(a[i]);\n readln(a[n]);\n for i:=k+1 to n do\n if (a[i]>a[i-1]) then writeln('Yes') else writeln('No');\n readln;\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\n\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\nFor the first through (K-1)-th terms: not given.\n\nFor each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.\n\nM-kun scored A_i in the exam at the end of the i-th term.\n\nFor each i such that K+1 \\leq i \\leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq K \\leq N-1\n\n1 \\leq A_i \\leq 10^{9}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 A_3 \\ldots A_N\n\nOutput\n\nPrint the answer in N-K lines.\n\nThe i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.\n\nSample Input 1\n\n5 3\n96 98 95 100 20\n\nSample Output 1\n\nYes\nNo\n\nHis grade for each term is computed as follows:\n\n3-rd term: (96 \\times 98 \\times 95) = 893760\n\n4-th term: (98 \\times 95 \\times 100) = 931000\n\n5-th term: (95 \\times 100 \\times 20) = 190000\n\nSample Input 2\n\n3 2\n1001 869120 1001\n\nSample Output 2\n\nNo\n\nNote that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.\n\nSample Input 3\n\n15 7\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9\n\nSample Output 3\n\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes", "sample_input": "5 3\n96 98 95 100 20\n"}, "reference_outputs": ["Yes\nNo\n"], "source_document_id": "p02602", "source_text": "Score: 300 points\n\nProblem Statement\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\n\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\nFor the first through (K-1)-th terms: not given.\n\nFor each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.\n\nM-kun scored A_i in the exam at the end of the i-th term.\n\nFor each i such that K+1 \\leq i \\leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq K \\leq N-1\n\n1 \\leq A_i \\leq 10^{9}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 A_3 \\ldots A_N\n\nOutput\n\nPrint the answer in N-K lines.\n\nThe i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.\n\nSample Input 1\n\n5 3\n96 98 95 100 20\n\nSample Output 1\n\nYes\nNo\n\nHis grade for each term is computed as follows:\n\n3-rd term: (96 \\times 98 \\times 95) = 893760\n\n4-th term: (98 \\times 95 \\times 100) = 931000\n\n5-th term: (95 \\times 100 \\times 20) = 190000\n\nSample Input 2\n\n3 2\n1001 869120 1001\n\nSample Output 2\n\nNo\n\nNote that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.\n\nSample Input 3\n\n15 7\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9\n\nSample Output 3\n\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 247, "cpu_time_ms": 49, "memory_kb": 1672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s475972721", "group_id": "codeNet:p02603", "input_text": "var\n\tN,i:Longint;\n\tp,A,T:int64;\nbegin\n\tread(N,p);\n\tT:=1000;\n\tfor i:=2 to N do begin\n\t\tread(A);\n\t\tif p10) do\nreadln (a);\nwriteln (a+a*a+a*a*a);\nend.\n", "language": "Pascal", "metadata": {"date": 1594313110, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02621.html", "problem_id": "p02621", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02621/input.txt", "sample_output_relpath": "derived/input_output/data/p02621/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02621/Pascal/s079092170.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s079092170", "user_id": "u746789001"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main;\nvar a : integer;\nbegin\nwhile (a<1) and (a>10) do\nreadln (a);\nwriteln (a+a*a+a*a*a);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02621", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 4, "memory_kb": 1336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s263950888", "group_id": "codeNet:p02621", "input_text": "program main;\nvar input:integer;\nbegin\n\treadln(input);\n writeln(input + input*input + input*input*input);\nend.", "language": "Pascal", "metadata": {"date": 1594303699, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02621.html", "problem_id": "p02621", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02621/input.txt", "sample_output_relpath": "derived/input_output/data/p02621/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02621/Pascal/s263950888.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263950888", "user_id": "u172444704"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main;\nvar input:integer;\nbegin\n\treadln(input);\n writeln(input + input*input + input*input*input);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02621", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 113, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s776596282", "group_id": "codeNet:p02622", "input_text": "program bt;\n\nvar s,t:string;\n r,i:longint;\n\nbegin\n readln(s);\n readln(t);\n r:=0;\n for i:=1 to length(s) do\n if (s[i]<>t[i]) then inc(r);\n write(r);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1597629779, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Pascal/s776596282.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s776596282", "user_id": "u824872487"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program bt;\n\nvar s,t:string;\n r,i:longint;\n\nbegin\n readln(s);\n readln(t);\n r:=0;\n for i:=1 to length(s) do\n if (s[i]<>t[i]) then inc(r);\n write(r);\n readln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 179, "cpu_time_ms": 8, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s396114543", "group_id": "codeNet:p02622", "input_text": "program hi;\nvar \n s, t: string;\n i, cnt: longint;\n\nbegin\n readln(s);\n readln(t);\n cnt := 0;\n for i := 1 to length(s) do \n if s[i] <> t[i] then\n inc(cnt);\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596470087, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Pascal/s396114543.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s396114543", "user_id": "u051422473"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program hi;\nvar \n s, t: string;\n i, cnt: longint;\n\nbegin\n readln(s);\n readln(t);\n cnt := 0;\n for i := 1 to length(s) do \n if s[i] <> t[i] then\n inc(cnt);\n writeln(cnt);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 9, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s587855234", "group_id": "codeNet:p02627", "input_text": "program main;\nvar c : char;\nbegin\n\treadln(c);\n if(ord(c) >= 65) and (ord(c) <= 90) then\n \twriteln('A')\n else if(ord(c) >= 97) and (ord(c) <= 122) then\n \twriteln('a');\nend.", "language": "Pascal", "metadata": {"date": 1600793461, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s587855234.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s587855234", "user_id": "u212944395"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar c : char;\nbegin\n\treadln(c);\n if(ord(c) >= 65) and (ord(c) <= 90) then\n \twriteln('A')\n else if(ord(c) >= 97) and (ord(c) <= 122) then\n \twriteln('a');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 6, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s271914848", "group_id": "codeNet:p02627", "input_text": "program alphabet;\nvar\n a : char;\nbegin\n read(a);\n if (ord(a) >= 97) and (ord(a) <= 122) then\n writeln('a')\n else\n writeln('A');\nend.", "language": "Pascal", "metadata": {"date": 1597976201, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s271914848.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s271914848", "user_id": "u583992857"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program alphabet;\nvar\n a : char;\nbegin\n read(a);\n if (ord(a) >= 97) and (ord(a) <= 122) then\n writeln('a')\n else\n writeln('A');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 7, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s226284260", "group_id": "codeNet:p02627", "input_text": "program main; \nvar a : string;\nbegin\n readln(a);\n if( Upcase(a) = a ) then \n writeln('A')\n else \n writeln('a');\nend.", "language": "Pascal", "metadata": {"date": 1597083277, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s226284260.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s226284260", "user_id": "u743163683"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main; \nvar a : string;\nbegin\n readln(a);\n if( Upcase(a) = a ) then \n writeln('A')\n else \n writeln('a');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s933347623", "group_id": "codeNet:p02627", "input_text": "program main;\nvar\n n, k, sum, min, i, j, temp : integer;\n a : array[1..1000] of integer;\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n sum := 0;\n for i := 1 to k do begin\n min := i;\n for j := i + 1 to n do \n if (a[min] > a[j]) then\n min := j;\n \n sum := sum + a[min];\n temp := a[min];\n a[min] := a[i];\n a[i] := temp;\n end;\n \n\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595395822, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s933347623.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s933347623", "user_id": "u151858600"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar\n n, k, sum, min, i, j, temp : integer;\n a : array[1..1000] of integer;\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n sum := 0;\n for i := 1 to k do begin\n min := i;\n for j := i + 1 to n do \n if (a[min] > a[j]) then\n min := j;\n \n sum := sum + a[min];\n temp := a[min];\n a[min] := a[i];\n a[i] := temp;\n end;\n \n\n writeln(sum);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 466, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s672525787", "group_id": "codeNet:p02627", "input_text": "program main;\nvar\n\tx : char;\nbegin\n\treadln(x);\n if ((ord(x)) > 97) or ((ord(x)) = 97)\n \tthen writeln('a')\n \telse writeln('A');\nend.\n ", "language": "Pascal", "metadata": {"date": 1595392921, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Pascal/s672525787.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s672525787", "user_id": "u522723337"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program main;\nvar\n\tx : char;\nbegin\n\treadln(x);\n if ((ord(x)) > 97) or ((ord(x)) = 97)\n \tthen writeln('a')\n \telse writeln('A');\nend.\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 5, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s648074486", "group_id": "codeNet:p02628", "input_text": "program main;\nvar \n a, b, i, k, ans, temp : integer;\n ar : array[1..1000] of integer;\nbegin\n ans := 0;\n readln(a, b);\n for i := 1 to a do \n read(ar[i]);\n for i := 1 to a do \n for k := 1 to a-1 do \n if ar[k] > ar[k+1] then \n begin \n temp := ar[k];\n ar[k] := ar[k+1];\n ar[k+1] := temp;\n end;\n for i := 1 to b do \n ans := ans + ar[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1597086095, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s648074486.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s648074486", "user_id": "u743163683"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\nvar \n a, b, i, k, ans, temp : integer;\n ar : array[1..1000] of integer;\nbegin\n ans := 0;\n readln(a, b);\n for i := 1 to a do \n read(ar[i]);\n for i := 1 to a do \n for k := 1 to a-1 do \n if ar[k] > ar[k+1] then \n begin \n temp := ar[k];\n ar[k] := ar[k+1];\n ar[k+1] := temp;\n end;\n for i := 1 to b do \n ans := ans + ar[i];\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 494, "cpu_time_ms": 8, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s614801475", "group_id": "codeNet:p02628", "input_text": "program main;\nvar\n n, k, sum, i: integer;\n a : array[1..1000] of integer;\n\n\nprocedure qs (l, r : integer);\nvar\n p, i, j, temp : integer;\nbegin\n p := a[(l + r) div 2]; i := l; j := r;\n \n while (i < j) do begin\n while (a[j] > p) do\n j := j - 1;\n while (a[i] < p) do\n i := i + 1;\n \n if (i < j) then begin\n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n j := j - 1;\n i := i + 1;\n end;\n end;\n\n if (l - r > 1) then begin\n qs(l, j);\n qs(i, r);\n end;\nend;\n\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n qs(1, n);\n\n sum := 0;\n for i := 1 to k do\n sum := sum + a[i];\n \n\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595395405, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Pascal/s614801475.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s614801475", "user_id": "u151858600"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main;\nvar\n n, k, sum, i: integer;\n a : array[1..1000] of integer;\n\n\nprocedure qs (l, r : integer);\nvar\n p, i, j, temp : integer;\nbegin\n p := a[(l + r) div 2]; i := l; j := r;\n \n while (i < j) do begin\n while (a[j] > p) do\n j := j - 1;\n while (a[i] < p) do\n i := i + 1;\n \n if (i < j) then begin\n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n j := j - 1;\n i := i + 1;\n end;\n end;\n\n if (l - r > 1) then begin\n qs(l, j);\n qs(i, r);\n end;\nend;\n\n\nbegin\n readln(n, k);\n\n for i := 1 to n do \n read(a[i]);\n\n qs(1, n);\n\n sum := 0;\n for i := 1 to k do\n sum := sum + a[i];\n \n\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s718035755", "group_id": "codeNet:p02631", "input_text": "var\n\tn,b,i:int64;\n a:Array[1..200000] of int64;\nbegin\n\tread(n);\n for i:=1 to n do begin\n \tread(a[i]);\n b:=b xor a[i];\n end;\n for i:=1 to n do begin\n \twriteln(b xor a[i]);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1593435994, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02631.html", "problem_id": "p02631", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02631/input.txt", "sample_output_relpath": "derived/input_output/data/p02631/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02631/Pascal/s718035755.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718035755", "user_id": "u989345508"}, "prompt_components": {"gold_output": "26 5 7 22\n", "input_to_evaluate": "var\n\tn,b,i:int64;\n a:Array[1..200000] of int64;\nbegin\n\tread(n);\n for i:=1 to n do begin\n \tread(a[i]);\n b:=b xor a[i];\n end;\n for i:=1 to n do begin\n \twriteln(b xor a[i]);\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\n\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\n\nRecently, they learned the operation called xor (exclusive OR).\n\nWhat is xor?\n\nFor n non-negative integers x_1, x_2, \\ldots, x_n, their xor, x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is defined as follows:\n\nWhen x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3~\\textrm{xor}~5 = 6.\n\nThey wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.\n\nWe know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.\nUsing this information, restore the integer written on the scarf of each Snuke Cat.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n0 \\leq a_i \\leq 10^9\n\nThere exists a combination of integers on the scarfs that is consistent with the given information.\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 a line containing N integers separated with space.\n\nThe i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.\n\nIf there are multiple possible solutions, you may print any of them.\n\nSample Input 1\n\n4\n20 11 9 24\n\nSample Output 1\n\n26 5 7 22\n\n5~\\textrm{xor}~7~\\textrm{xor}~22 = 20\n\n26~\\textrm{xor}~7~\\textrm{xor}~22 = 11\n\n26~\\textrm{xor}~5~\\textrm{xor}~22 = 9\n\n26~\\textrm{xor}~5~\\textrm{xor}~7 = 24\n\nThus, this output is consistent with the given information.", "sample_input": "4\n20 11 9 24\n"}, "reference_outputs": ["26 5 7 22\n"], "source_document_id": "p02631", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\n\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\n\nRecently, they learned the operation called xor (exclusive OR).\n\nWhat is xor?\n\nFor n non-negative integers x_1, x_2, \\ldots, x_n, their xor, x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is defined as follows:\n\nWhen x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3~\\textrm{xor}~5 = 6.\n\nThey wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.\n\nWe know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.\nUsing this information, restore the integer written on the scarf of each Snuke Cat.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n0 \\leq a_i \\leq 10^9\n\nThere exists a combination of integers on the scarfs that is consistent with the given information.\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 a line containing N integers separated with space.\n\nThe i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.\n\nIf there are multiple possible solutions, you may print any of them.\n\nSample Input 1\n\n4\n20 11 9 24\n\nSample Output 1\n\n26 5 7 22\n\n5~\\textrm{xor}~7~\\textrm{xor}~22 = 20\n\n26~\\textrm{xor}~7~\\textrm{xor}~22 = 11\n\n26~\\textrm{xor}~5~\\textrm{xor}~22 = 9\n\n26~\\textrm{xor}~5~\\textrm{xor}~7 = 24\n\nThus, this output is consistent with the given information.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 61, "memory_kb": 3924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s915656776", "group_id": "codeNet:p02633", "input_text": "var\n x, i :Longint;\nbegin\n read(x);\n i := 360;\n while true do begin\n if i mod x = 0 then begin\n writeln(i div x);\n exit;\n end;\n i += 360;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1592747614, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02633.html", "problem_id": "p02633", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02633/input.txt", "sample_output_relpath": "derived/input_output/data/p02633/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02633/Pascal/s915656776.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s915656776", "user_id": "u172873334"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n x, i :Longint;\nbegin\n read(x);\n i := 360;\n while true do begin\n if i mod x = 0 then begin\n writeln(i div x);\n exit;\n end;\n i += 360;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "sample_input": "90\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02633", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s266670851", "group_id": "codeNet:p02633", "input_text": "var N:Longint;\nfunction gcd(a,b:Longint):Longint;\nbegin\nif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\nread(N);\nwriteln(360 div gcd(360,N));\nend.", "language": "Pascal", "metadata": {"date": 1592710139, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02633.html", "problem_id": "p02633", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02633/input.txt", "sample_output_relpath": "derived/input_output/data/p02633/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02633/Pascal/s266670851.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s266670851", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var N:Longint;\nfunction gcd(a,b:Longint):Longint;\nbegin\nif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\nread(N);\nwriteln(360 div gcd(360,N));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "sample_input": "90\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02633", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s566533158", "group_id": "codeNet:p02639", "input_text": "program main;\nvar x : array[1..5] of integer;\n\ti,n : integer;\nbegin\n\tfor i := 1 to 5 do begin\n \treadln(x[i]);\n end;\n if(x[1] = 0) \n \tthen n := 1\n else if(x[2] = 0) \n \t\tthen n := 2\n else if(x[3] = 0) \n \t\t\t then n := 3\n else if(x[4] = 0) \n \t\t\t \tthen n := 4\n else if(x[5] = 0) \n \t\t\t \t\tthen n := 5; \n writeln(n);\nend. ", "language": "Pascal", "metadata": {"date": 1600794393, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s566533158.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s566533158", "user_id": "u212944395"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar x : array[1..5] of integer;\n\ti,n : integer;\nbegin\n\tfor i := 1 to 5 do begin\n \treadln(x[i]);\n end;\n if(x[1] = 0) \n \tthen n := 1\n else if(x[2] = 0) \n \t\tthen n := 2\n else if(x[3] = 0) \n \t\t\t then n := 3\n else if(x[4] = 0) \n \t\t\t \tthen n := 4\n else if(x[5] = 0) \n \t\t\t \t\tthen n := 5; \n writeln(n);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 399, "cpu_time_ms": 5, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s027549032", "group_id": "codeNet:p02639", "input_text": "program main;\nvar x : array[1..5] of integer;\n\ti,n : integer;\nbegin\n\tfor i := 1 to 5 do begin\n \treadln(x[i]);\n if(x[i] = 0) then\n \tn := i;\n end;\n writeln(n);\nend. ", "language": "Pascal", "metadata": {"date": 1600793923, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s027549032.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s027549032", "user_id": "u212944395"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar x : array[1..5] of integer;\n\ti,n : integer;\nbegin\n\tfor i := 1 to 5 do begin\n \treadln(x[i]);\n if(x[i] = 0) then\n \tn := i;\n end;\n writeln(n);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s139073443", "group_id": "codeNet:p02639", "input_text": "program main; \nvar a,b,c,d,e : integer;\nbegin\n readln(a,b,c,d,e);\n if a = 0 then\n writeln('1');\n if b = 0 then\n writeln('2');\n if c = 0 then\n writeln('3');\n if d = 0 then\n writeln('4');\n if e = 0 then\n writeln('5');\nend.", "language": "Pascal", "metadata": {"date": 1598114841, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s139073443.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139073443", "user_id": "u289438802"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main; \nvar a,b,c,d,e : integer;\nbegin\n readln(a,b,c,d,e);\n if a = 0 then\n writeln('1');\n if b = 0 then\n writeln('2');\n if c = 0 then\n writeln('3');\n if d = 0 then\n writeln('4');\n if e = 0 then\n writeln('5');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 5, "memory_kb": 1236}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s746971326", "group_id": "codeNet:p02639", "input_text": "var a,s,d,f,g:longint;\nbegin\nread(a,s,d,f,g);\nwriteln(15-a-s-d-f-g);\nend.", "language": "Pascal", "metadata": {"date": 1597457130, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s746971326.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s746971326", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a,s,d,f,g:longint;\nbegin\nread(a,s,d,f,g);\nwriteln(15-a-s-d-f-g);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 73, "cpu_time_ms": 4, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s367752502", "group_id": "codeNet:p02639", "input_text": "program main; \nvar a,b,c,d,e : integer;\nbegin\n readln(a,b,c,d,e);\n if a = 0 then\n writeln('1');\n if b = 0 then\n writeln('2');\n if c = 0 then\n writeln('3');\n if d = 0 then\n writeln('4');\n if e = 0 then\n writeln('5');\nend.", "language": "Pascal", "metadata": {"date": 1597083501, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s367752502.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s367752502", "user_id": "u743163683"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main; \nvar a,b,c,d,e : integer;\nbegin\n readln(a,b,c,d,e);\n if a = 0 then\n writeln('1');\n if b = 0 then\n writeln('2');\n if c = 0 then\n writeln('3');\n if d = 0 then\n writeln('4');\n if e = 0 then\n writeln('5');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 5, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s097299455", "group_id": "codeNet:p02639", "input_text": "program main;\nvar x, y, a, b : longint;\n t : real;\n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n t := (y-2*x) / 2;\n if (frac(t) = 0) and (t >= 0) then\n b := trunc(t)\n else \n r := false;\n a := x - b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596485098, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s097299455.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s097299455", "user_id": "u122156580"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar x, y, a, b : longint;\n t : real;\n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n t := (y-2*x) / 2;\n if (frac(t) = 0) and (t >= 0) then\n b := trunc(t)\n else \n r := false;\n a := x - b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 312, "cpu_time_ms": 4, "memory_kb": 1304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s049262453", "group_id": "codeNet:p02639", "input_text": "program main;\nvar\n\ti, num :integer;\n a : array[1..5] of integer;\nbegin\n\n\tfor i := 1 to 5 do begin\n \tread(a[i]);\n if a[i] = 0\n \tthen num := i;\n end;\n writeln(num);\nend.", "language": "Pascal", "metadata": {"date": 1595535958, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Pascal/s049262453.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s049262453", "user_id": "u522723337"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\nvar\n\ti, num :integer;\n a : array[1..5] of integer;\nbegin\n\n\tfor i := 1 to 5 do begin\n \tread(a[i]);\n if a[i] = 0\n \tthen num := i;\n end;\n writeln(num);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 193, "cpu_time_ms": 3, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s000243005", "group_id": "codeNet:p02640", "input_text": "program main;\nvar x, y, a, b : longint;\n t : real;\n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n t := (y-2*x) / 2;\n if (frac(t) = 0) and (t >= 0) then\n b := trunc(t)\n else \n r := false;\n a := x - b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596485119, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s000243005.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s000243005", "user_id": "u122156580"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar x, y, a, b : longint;\n t : real;\n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n t := (y-2*x) / 2;\n if (frac(t) = 0) and (t >= 0) then\n b := trunc(t)\n else \n r := false;\n a := x - b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 312, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s787648591", "group_id": "codeNet:p02640", "input_text": "program main;\nvar x, y, a, b : longint; \n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n if frac((y-2*x) / 2) = 0 then\n b := (y-2*x) div 2\n else \n r := false;\n if r then\n a := x-b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1596484416, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s787648591.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s787648591", "user_id": "u122156580"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar x, y, a, b : longint; \n r : boolean;\n\nbegin\n readln(x,y);\n r := true;\n if frac((y-2*x) / 2) = 0 then\n b := (y-2*x) div 2\n else \n r := false;\n if r then\n a := x-b;\n if a < 0 then\n r := false;\n if r then\n writeln('Yes')\n else\n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 2, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s599744669", "group_id": "codeNet:p02640", "input_text": "program hi;\nvar x, y: integer;\n\nbegin\n readln(x, y);\n if (x * 4 < y) or (x * 2 > y) or (y mod 2 = 1) then\n writeln('No')\n else\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1596471181, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Pascal/s599744669.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s599744669", "user_id": "u051422473"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program hi;\nvar x, y: integer;\n\nbegin\n readln(x, y);\n if (x * 4 < y) or (x * 2 > y) or (y mod 2 = 1) then\n writeln('No')\n else\n writeln('Yes');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 171, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s954650262", "group_id": "codeNet:p02641", "input_text": "var x,n,i:longint;\na:array[1..100]of longint;\nfunction f(t:longint):Boolean;\nvar j,c:longint;\nbegin\nc:=0;\nfor j:=1 to n do if a[j]=t then inc(c);\nf:=c=0;\nend;\nbegin\nread(x,n);\nfor i:=1 to n do read(a[i]);\nfor i:=0 to 111 do begin\nif f(x-i)then begin\nwriteln(x-i);\nexit;\nend;\nif f(x+i)then begin\nwriteln(x+i);\nexit;\nend;\nend;\nend.", "language": "Pascal", "metadata": {"date": 1597460719, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Pascal/s954650262.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s954650262", "user_id": "u657913472"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var x,n,i:longint;\na:array[1..100]of longint;\nfunction f(t:longint):Boolean;\nvar j,c:longint;\nbegin\nc:=0;\nfor j:=1 to n do if a[j]=t then inc(c);\nf:=c=0;\nend;\nbegin\nread(x,n);\nfor i:=1 to n do read(a[i]);\nfor i:=0 to 111 do begin\nif f(x-i)then begin\nwriteln(x-i);\nexit;\nend;\nif f(x+i)then begin\nwriteln(x+i);\nexit;\nend;\nend;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s506800639", "group_id": "codeNet:p02646", "input_text": "var a,b,v,w,t: longint; x:real;\nbegin\nreadln(a,v);\nreadln(b,w);\nreadln(t);\nif w>=v then begin writeln('NO'); exit end;\nx:=(b*v-a*w)/(v-w);\nx:=(x-a)/v;\nif x>t then begin writeln('NO'); exit end;\nwriteln('YES')\nend.", "language": "Pascal", "metadata": {"date": 1592099871, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02646.html", "problem_id": "p02646", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02646/input.txt", "sample_output_relpath": "derived/input_output/data/p02646/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02646/Pascal/s506800639.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s506800639", "user_id": "u851084981"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var a,b,v,w,t: longint; x:real;\nbegin\nreadln(a,v);\nreadln(b,w);\nreadln(t);\nif w>=v then begin writeln('NO'); exit end;\nx:=(b*v-a*w)/(v-w);\nx:=(x-a)/v;\nif x>t then begin writeln('NO'); exit end;\nwriteln('YES')\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "sample_input": "1 2\n3 1\n3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02646", "source_text": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 213, "cpu_time_ms": 6, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s205370281", "group_id": "codeNet:p02657", "input_text": "program main; \nvar a,b : integer;\nbegin\n readln(a,b);\n writeln(a*b);\nend.", "language": "Pascal", "metadata": {"date": 1597083709, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s205370281.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s205370281", "user_id": "u743163683"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main; \nvar a,b : integer;\nbegin\n readln(a,b);\n writeln(a*b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 79, "cpu_time_ms": 6, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s654459360", "group_id": "codeNet:p02657", "input_text": "program main;\nvar i, n : int64;\n m : array [1..10000] of longint;\n p : qword = 1;\n c : boolean = false;\n z : boolean = false;\n \nbegin\n readln(n);\n for i := 1 to n do\n read(m[i]);\n readln;\n for i := 1 to n do\n if (m[i] = 0) then begin\n z := true;\n break;\n end;\n if not(z) then\n for i := 1 to n do\n if p*m[i] > 1e18 then begin\n c := true;\n break;\n end\n else p := p * m[i];\n if z then\n writeln(p-p)\n else if c then\n writeln('-1')\n else writeln(p);\nend.", "language": "Pascal", "metadata": {"date": 1596486178, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s654459360.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s654459360", "user_id": "u122156580"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main;\nvar i, n : int64;\n m : array [1..10000] of longint;\n p : qword = 1;\n c : boolean = false;\n z : boolean = false;\n \nbegin\n readln(n);\n for i := 1 to n do\n read(m[i]);\n readln;\n for i := 1 to n do\n if (m[i] = 0) then begin\n z := true;\n break;\n end;\n if not(z) then\n for i := 1 to n do\n if p*m[i] > 1e18 then begin\n c := true;\n break;\n end\n else p := p * m[i];\n if z then\n writeln(p-p)\n else if c then\n writeln('-1')\n else writeln(p);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 526, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s786871520", "group_id": "codeNet:p02657", "input_text": "program main;\nvar i, n, p, t : int64;\n \nbegin\n readln(n);\n p := 1;\n for i := 1 to n do begin\n read(t);\n p := p * t;\n end;\n readln;\n if p > 1000000000000000000 then\n writeln('-1')\n else writeln(p);\nend.", "language": "Pascal", "metadata": {"date": 1596439726, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s786871520.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s786871520", "user_id": "u122156580"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main;\nvar i, n, p, t : int64;\n \nbegin\n readln(n);\n p := 1;\n for i := 1 to n do begin\n read(t);\n p := p * t;\n end;\n readln;\n if p > 1000000000000000000 then\n writeln('-1')\n else writeln(p);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s691730138", "group_id": "codeNet:p02657", "input_text": "program main;\nvar a, b : integer;\n\nbegin\n readln(a,b);\n writeln(a*b);\nend.", "language": "Pascal", "metadata": {"date": 1596437992, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s691730138.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s691730138", "user_id": "u122156580"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main;\nvar a, b : integer;\n\nbegin\n readln(a,b);\n writeln(a*b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 3, "memory_kb": 1348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s171703237", "group_id": "codeNet:p02657", "input_text": "program main;\nvar\n x, y : integer;\nbegin\n readln(x, y);\n writeln(x*y);\nend.\n", "language": "Pascal", "metadata": {"date": 1595459367, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Pascal/s171703237.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s171703237", "user_id": "u581648177"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main;\nvar\n x, y : integer;\nbegin\n readln(x, y);\n writeln(x*y);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s937110714", "group_id": "codeNet:p02675", "input_text": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon');\n if s[len]='3'\n \tthen writeln('bon');\nend.", "language": "Pascal", "metadata": {"date": 1595466732, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s937110714.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s937110714", "user_id": "u522723337"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon');\n if s[len]='3'\n \tthen writeln('bon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 366, "cpu_time_ms": 6, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s553041852", "group_id": "codeNet:p02675", "input_text": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon');\n if s[len]='3'\n \tthen writeln('hon');\nend.", "language": "Pascal", "metadata": {"date": 1595466636, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s553041852.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s553041852", "user_id": "u522723337"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon');\n if s[len]='3'\n \tthen writeln('hon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 366, "cpu_time_ms": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620134832", "group_id": "codeNet:p02675", "input_text": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon');\n if s[len]='0'\n \tthen writeln('hon');\nend.", "language": "Pascal", "metadata": {"date": 1595466543, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s620134832.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s620134832", "user_id": "u522723337"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon');\n if s[len]='0'\n \tthen writeln('hon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 366, "cpu_time_ms": 4, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s054784217", "group_id": "codeNet:p02675", "input_text": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon')\n \t\telse writeln('hon');\nend.", "language": "Pascal", "metadata": {"date": 1595466402, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s054784217.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s054784217", "user_id": "u522723337"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main;\nvar\n\ts : string;\n len : integer;\n\nbegin\n\tread(s);\n len := length(s);\n \n if (s[len]='2') or (s[len]='4') or (s[len]='5') or (s[len]='7') or (s[len]='9')\n \tthen writeln('hon');\n if (s[len]='0') or (s[len]='1') or (s[len]='6') or (s[len]='8')\n \tthen writeln('pon')\n \t\telse writeln('hon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 7, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s753297445", "group_id": "codeNet:p02675", "input_text": "var\n\ts:string;\nbegin\n\treadln(s);\n\tif s[length(s)]='3' then \n \twriteln('pon')\n else if pos(s[length(s)],'24579')<>0 then\n \twriteln('hon')\n else writeln('bon');\nend.", "language": "Pascal", "metadata": {"date": 1595008990, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s753297445.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s753297445", "user_id": "u678829637"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n\ts:string;\nbegin\n\treadln(s);\n\tif s[length(s)]='3' then \n \twriteln('pon')\n else if pos(s[length(s)],'24579')<>0 then\n \twriteln('hon')\n else writeln('bon');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 4, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s997532184", "group_id": "codeNet:p02675", "input_text": "var\n n: Integer;\n\nbegin\n read(n);\n\n case n mod 10 of\n\n 2, 4, 5, 7, 9:\n writeln('hon');\n\n 0, 1, 6, 8:\n writeln('pon');\n else\n writeln('bon');\n end;\n\nend.", "language": "Pascal", "metadata": {"date": 1590615643, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s997532184.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s997532184", "user_id": "u496848914"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n n: Integer;\n\nbegin\n read(n);\n\n case n mod 10 of\n\n 2, 4, 5, 7, 9:\n writeln('hon');\n\n 0, 1, 6, 8:\n writeln('pon');\n else\n writeln('bon');\n end;\n\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s773352831", "group_id": "codeNet:p02675", "input_text": "var\n n: Integer;\n\nbegin\n read(n);\n\n case n mod 10 of\n 3:\n writeln('bon');\n 0, 1, 6, 8:\n writeln('pon');\n else\n writeln('hon');\n end;\n\nend.", "language": "Pascal", "metadata": {"date": 1590614180, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s773352831.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s773352831", "user_id": "u029261695"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n n: Integer;\n\nbegin\n read(n);\n\n case n mod 10 of\n 3:\n writeln('bon');\n 0, 1, 6, 8:\n writeln('pon');\n else\n writeln('hon');\n end;\n\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 1, "memory_kb": 1344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s582046409", "group_id": "codeNet:p02675", "input_text": "var\n n: Integer;\n\nbegin\n read(n);\n\n case n mod 10 of\n 3:\n writeln('bon');\n 0, 1, 6, 8:\n writeln('pon');\n else\n writeln('hon');\n end;\n\nend.", "language": "Pascal", "metadata": {"date": 1590614169, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s582046409.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s582046409", "user_id": "u029261695"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n n: Integer;\n\nbegin\n read(n);\n\n case n mod 10 of\n 3:\n writeln('bon');\n 0, 1, 6, 8:\n writeln('pon');\n else\n writeln('hon');\n end;\n\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s936336668", "group_id": "codeNet:p02675", "input_text": "var\n n, digits: Integer;\n measure: String;\n\nbegin\n read(n);\n digits := n;\n\n digits := digits mod 10;\n\n if (digits = 0) or (digits = 1) or (digits = 6) or (digits = 8) then\n begin\n measure := 'pon';\n end\n\n else if digits = 3 then\n begin\n measure := 'bon';\n end\n\n else\n begin\n measure := 'hon';\n end;\n\n\n write(measure);\n\nend.", "language": "Pascal", "metadata": {"date": 1590611832, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s936336668.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s936336668", "user_id": "u888256791"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "var\n n, digits: Integer;\n measure: String;\n\nbegin\n read(n);\n digits := n;\n\n digits := digits mod 10;\n\n if (digits = 0) or (digits = 1) or (digits = 6) or (digits = 8) then\n begin\n measure := 'pon';\n end\n\n else if digits = 3 then\n begin\n measure := 'bon';\n end\n\n else\n begin\n measure := 'hon';\n end;\n\n\n write(measure);\n\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 347, "cpu_time_ms": 1, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s859178581", "group_id": "codeNet:p02675", "input_text": "Var st:ansistring;\ni,j,n:longint;\nbegin\nreadln(st);\nIf st[length(st)] in ['2','4','5','7','9'] then writeln('hon')\nelse if st[length(st)] in ['0','1','6','8'] then writeln('pon')\nelse writeln('bon');\nend.\n", "language": "Pascal", "metadata": {"date": 1590019712, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s859178581.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s859178581", "user_id": "u382911836"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "Var st:ansistring;\ni,j,n:longint;\nbegin\nreadln(st);\nIf st[length(st)] in ['2','4','5','7','9'] then writeln('hon')\nelse if st[length(st)] in ['0','1','6','8'] then writeln('pon')\nelse writeln('bon');\nend.\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s108623304", "group_id": "codeNet:p02675", "input_text": "Var st:ansistring;\ni,j,n:longint;\nbegin\nreadln(st);\nIf st[1] in ['2','4','5','7','9'] then writeln('hon')\nelse if st[1] in ['0','1','6','8'] then writeln('pon')\nelse writeln('bon');\nend.\n", "language": "Pascal", "metadata": {"date": 1590019653, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Pascal/s108623304.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s108623304", "user_id": "u382911836"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "Var st:ansistring;\ni,j,n:longint;\nbegin\nreadln(st);\nIf st[1] in ['2','4','5','7','9'] then writeln('hon')\nelse if st[1] in ['0','1','6','8'] then writeln('pon')\nelse writeln('bon');\nend.\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 1, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s162489269", "group_id": "codeNet:p02676", "input_text": "program dots;\nvar\n k : longint;\n s : string;\nbegin\n readln(k);\n readln(s);\n if length(s) > k then begin\n s := copy(s, 1, k);\n writeln(s,'...');\n end\n else \n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1597910984, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s162489269.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s162489269", "user_id": "u583992857"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program dots;\nvar\n k : longint;\n s : string;\nbegin\n readln(k);\n readln(s);\n if length(s) > k then begin\n s := copy(s, 1, k);\n writeln(s,'...');\n end\n else \n writeln(s);\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s199806414", "group_id": "codeNet:p02676", "input_text": "program main;\nvar\n\tnum, i, len : integer;\n\ts : string;\n\nbegin\n\treadln(num);\n readln(s);\n len := length(s);\n for i := 1 to num do \n \twrite(s[i]);\n if len > num\n \tthen write('...');\nend.\n ", "language": "Pascal", "metadata": {"date": 1595429480, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s199806414.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s199806414", "user_id": "u522723337"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main;\nvar\n\tnum, i, len : integer;\n\ts : string;\n\nbegin\n\treadln(num);\n readln(s);\n len := length(s);\n for i := 1 to num do \n \twrite(s[i]);\n if len > num\n \tthen write('...');\nend.\n ", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s052404958", "group_id": "codeNet:p02676", "input_text": "program main;\nvar\n\tnum, i, len : integer;\n\ts : string;\n\nbegin\n\treadln(num);\n readln(s);\n len := length(s);\n for i := 1 to num do \n \twrite(s[i]);\n if i < len\n \tthen write('...');\nend.\n ", "language": "Pascal", "metadata": {"date": 1595429281, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s052404958.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s052404958", "user_id": "u522723337"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main;\nvar\n\tnum, i, len : integer;\n\ts : string;\n\nbegin\n\treadln(num);\n readln(s);\n len := length(s);\n for i := 1 to num do \n \twrite(s[i]);\n if i < len\n \tthen write('...');\nend.\n ", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 5, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s972587374", "group_id": "codeNet:p02676", "input_text": "program main;\nvar\n\tnum, i, len : integer;\n\ts : string;\n\nbegin\n\treadln(num);\n readln(s);\n len := length(s);\n for i := 1 to num do \n \twrite(s[i]);\n if i < len\n \tthen write('...');\nend.\n ", "language": "Pascal", "metadata": {"date": 1595428994, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s972587374.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s972587374", "user_id": "u522723337"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main;\nvar\n\tnum, i, len : integer;\n\ts : string;\n\nbegin\n\treadln(num);\n readln(s);\n len := length(s);\n for i := 1 to num do \n \twrite(s[i]);\n if i < len\n \tthen write('...');\nend.\n ", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 6, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s163073782", "group_id": "codeNet:p02676", "input_text": "var\n k: Integer;\n s: String;\n dots: String;\n\nbegin\n\n readln(k);\n readln(s);\n\n dots := '...';\n\n if length(s)>k then\n begin\n s := Copy(s,0,k) + dots;\n end;\n\n writeln(s);\n\nend.", "language": "Pascal", "metadata": {"date": 1590616082, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s163073782.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s163073782", "user_id": "u888256791"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "var\n k: Integer;\n s: String;\n dots: String;\n\nbegin\n\n readln(k);\n readln(s);\n\n dots := '...';\n\n if length(s)>k then\n begin\n s := Copy(s,0,k) + dots;\n end;\n\n writeln(s);\n\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 1, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s127738733", "group_id": "codeNet:p02676", "input_text": "Var st:ansistring;\ni,j,k,n:longint;\nbegin\nreadln(n);readln(st);\nif length(st)>n then begin delete(st,n+1,length(st)-n);writeln(st,'...');end\nelse writeln(st);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1590019900, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Pascal/s127738733.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s127738733", "user_id": "u382911836"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "Var st:ansistring;\ni,j,k,n:longint;\nbegin\nreadln(n);readln(st);\nif length(st)>n then begin delete(st,n+1,length(st)-n);writeln(st,'...');end\nelse writeln(st);\nend.\n\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 1, "memory_kb": 1356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s820822546", "group_id": "codeNet:p02677", "input_text": "{$APPTYPE CONSOLE}\n\nvar\n a, b, h, m: Integer;\n rad_h, rad_m: Double;\n x_h, y_h, x_m, y_m: Double;\n answer: Double;\n\nbegin\n read(a);\n read(b);\n read(h);\n read(m);\n\n rad_h := 2 * Pi * (h / 12) + (2 * Pi * (m / 60) * 1/12);\n rad_m := 2 * Pi * (m / 60);\n\n x_h := Cos(rad_h) * a;\n y_h := Sin(rad_h) * a;\n\n x_m := Cos(rad_m) * b;\n y_m := Sin(rad_m) * b;\n\n answer := Sqrt(Sqr(x_h - x_m) + Sqr(y_h - y_m));\n\n writeln(answer);\nend.", "language": "Pascal", "metadata": {"date": 1590603981, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Pascal/s820822546.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820822546", "user_id": "u029261695"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "{$APPTYPE CONSOLE}\n\nvar\n a, b, h, m: Integer;\n rad_h, rad_m: Double;\n x_h, y_h, x_m, y_m: Double;\n answer: Double;\n\nbegin\n read(a);\n read(b);\n read(h);\n read(m);\n\n rad_h := 2 * Pi * (h / 12) + (2 * Pi * (m / 60) * 1/12);\n rad_m := 2 * Pi * (m / 60);\n\n x_h := Cos(rad_h) * a;\n y_h := Sin(rad_h) * a;\n\n x_m := Cos(rad_m) * b;\n y_m := Sin(rad_m) * b;\n\n answer := Sqrt(Sqr(x_h - x_m) + Sqr(y_h - y_m));\n\n writeln(answer);\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 438, "cpu_time_ms": 1, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s343100657", "group_id": "codeNet:p02677", "input_text": "Uses crt,math;\nVar a,b,h,m,i,j,k,n:longint;\nangle1,angle2,res:extended;\nst:string;\nbegin\nclrscr;\nreadln(a,b,h,m);\nangle1:=0.5*(h*60+m);\nangle2:=6*m;\nangle1:=abs(angle1-angle2);\nangle1:=min(360-angle1,angle1);\nwriteln(sqrt(a*a+b*b-2*a*b*cos((angle1)/180*pi)):0:20);\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1590022274, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Pascal/s343100657.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s343100657", "user_id": "u382911836"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "Uses crt,math;\nVar a,b,h,m,i,j,k,n:longint;\nangle1,angle2,res:extended;\nst:string;\nbegin\nclrscr;\nreadln(a,b,h,m);\nangle1:=0.5*(h*60+m);\nangle2:=6*m;\nangle1:=abs(angle1-angle2);\nangle1:=min(360-angle1,angle1);\nwriteln(sqrt(a*a+b*b-2*a*b*cos((angle1)/180*pi)):0:20);\nend.\n\n\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 279, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s077409946", "group_id": "codeNet:p02677", "input_text": "Uses crt,math;\nVar a,b,h,m,i,j,k,n:longint;\nangle1,angle2,res:extended;\nst:string;\nbegin\nclrscr;\nreadln(a,b,h,m);\nangle1:=(m/60)*360;\nIf angle1<180 then angle1:=360-angle1;\nangle2:=((m/60+h)/12)*360;\nangle1:=abs(angle1-angle2);\nres:=3.14159265358979323846264;\nwriteln(sqrt(a*a+b*b-2*a*b*cos((angle1)/180*res)):0:18);\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1590021893, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Pascal/s077409946.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s077409946", "user_id": "u382911836"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "Uses crt,math;\nVar a,b,h,m,i,j,k,n:longint;\nangle1,angle2,res:extended;\nst:string;\nbegin\nclrscr;\nreadln(a,b,h,m);\nangle1:=(m/60)*360;\nIf angle1<180 then angle1:=360-angle1;\nangle2:=((m/60+h)/12)*360;\nangle1:=abs(angle1-angle2);\nres:=3.14159265358979323846264;\nwriteln(sqrt(a*a+b*b-2*a*b*cos((angle1)/180*res)):0:18);\nend.\n\n\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 331, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s230807995", "group_id": "codeNet:p02681", "input_text": "program main;\nvar\n s1, s2 : string;\n pass : boolean;\nbegin\n pass := true;\n readln(s1);\n readln(s2);\n if length(s1) > 10\n then pass := false;\n if length(s2) - length(s1) <> 1\n then pass := false;\n s2 := copy(s2, 1, length(s2)-1);\n if s1 <> s2 \n then pass := false;\n if pass\n then writeln('Yes')\n else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1595458090, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Pascal/s230807995.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s230807995", "user_id": "u581648177"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar\n s1, s2 : string;\n pass : boolean;\nbegin\n pass := true;\n readln(s1);\n readln(s2);\n if length(s1) > 10\n then pass := false;\n if length(s2) - length(s1) <> 1\n then pass := false;\n s2 := copy(s2, 1, length(s2)-1);\n if s1 <> s2 \n then pass := false;\n if pass\n then writeln('Yes')\n else writeln('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 385, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s055450765", "group_id": "codeNet:p02681", "input_text": "program main;\nvar\n\ts, t : string;\n count, i, len : integer;\nbegin\n\treadln(s);\n\treadln(t);\n len := length(t);\n count := 0;\n for i := 1 to len do begin\n \tif s[i] <> t[i]\n \tthen count := count + 1;\n end;\n if count <> 1\n \tthen writeln('No')\n \telse writeln('Yes');\nend.\n ", "language": "Pascal", "metadata": {"date": 1595428650, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Pascal/s055450765.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055450765", "user_id": "u522723337"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar\n\ts, t : string;\n count, i, len : integer;\nbegin\n\treadln(s);\n\treadln(t);\n len := length(t);\n count := 0;\n for i := 1 to len do begin\n \tif s[i] <> t[i]\n \tthen count := count + 1;\n end;\n if count <> 1\n \tthen writeln('No')\n \telse writeln('Yes');\nend.\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s211432225", "group_id": "codeNet:p02681", "input_text": "var s,t:String;i,j:Longint;\nbegin\nreadln(s);\nreadln(t);\nfor i:=1 to length(s)do if s[i]<>t[i]then inc(j);\nif j=0 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1589415961, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Pascal/s211432225.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s211432225", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s,t:String;i,j:Longint;\nbegin\nreadln(s);\nreadln(t);\nfor i:=1 to length(s)do if s[i]<>t[i]then inc(j);\nif j=0 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 1, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s917020060", "group_id": "codeNet:p02682", "input_text": "program main;\nvar\n a, b, c, d, sum : int64;\nbegin\n sum := 0;\n readln(a, b, c, d);\n if d < a \n then sum := sum + d\n else begin\n sum := sum + a;\n d := d - a -b;\n if d > 0\n then sum := sum - d;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595462465, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Pascal/s917020060.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s917020060", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar\n a, b, c, d, sum : int64;\nbegin\n sum := 0;\n readln(a, b, c, d);\n if d < a \n then sum := sum + d\n else begin\n sum := sum + a;\n d := d - a -b;\n if d > 0\n then sum := sum - d;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 6, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s362874635", "group_id": "codeNet:p02682", "input_text": "program main;\nvar\n a, b, c, d, sum : int64;\nbegin\n sum := 0;\n readln(a, b, c, d);\n sum := sum + a;\n d := d - a -b;\n if d > 0\n then sum := sum - d;\n writeln(sum);\nend.\n", "language": "Pascal", "metadata": {"date": 1595462211, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Pascal/s362874635.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s362874635", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar\n a, b, c, d, sum : int64;\nbegin\n sum := 0;\n readln(a, b, c, d);\n sum := sum + a;\n d := d - a -b;\n if d > 0\n then sum := sum - d;\n writeln(sum);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 4, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s383895452", "group_id": "codeNet:p02682", "input_text": "program main;\nvar\n a, b, c, d, sum : int64;\nbegin\n sum := 0;\n readln(a, b, c, d);\n if d < a \n then sum := sum + a\n else begin\n sum := sum + a;\n d := d - a -b;\n if d > 0\n then sum := sum -d;\n end;\n writeln(sum);\nend.\n", "language": "Pascal", "metadata": {"date": 1595462092, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Pascal/s383895452.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s383895452", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar\n a, b, c, d, sum : int64;\nbegin\n sum := 0;\n readln(a, b, c, d);\n if d < a \n then sum := sum + a\n else begin\n sum := sum + a;\n d := d - a -b;\n if d > 0\n then sum := sum -d;\n end;\n writeln(sum);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s619944841", "group_id": "codeNet:p02683", "input_text": "begin\nwriteln(0);\nend.", "language": "Pascal", "metadata": {"date": 1589746980, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02683.html", "problem_id": "p02683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02683/input.txt", "sample_output_relpath": "derived/input_output/data/p02683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02683/Pascal/s619944841.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s619944841", "user_id": "u480821607"}, "prompt_components": {"gold_output": "120\n", "input_to_evaluate": "begin\nwriteln(0);\nend.", "problem_context": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "sample_input": "3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n"}, "reference_outputs": ["120\n"], "source_document_id": "p02683", "source_text": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 22, "cpu_time_ms": 2, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s390453564", "group_id": "codeNet:p02687", "input_text": "program AC;var x : string;begin readln(x);if x = 'ABC'then writeln('ARC')else writeln('ABC')end.", "language": "Pascal", "metadata": {"date": 1597183330, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s390453564.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s390453564", "user_id": "u583992857"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "program AC;var x : string;begin readln(x);if x = 'ABC'then writeln('ARC')else writeln('ABC')end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 96, "cpu_time_ms": 5, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s842256045", "group_id": "codeNet:p02687", "input_text": "program main;\nvar\n s : string;\nbegin\n readln(s);\n if s = 'ABC'\n then writeln('ARC');\n if s = 'ARC'\n then writeln('ABC');\nend.\n", "language": "Pascal", "metadata": {"date": 1595455978, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s842256045.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s842256045", "user_id": "u581648177"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "program main;\nvar\n s : string;\nbegin\n readln(s);\n if s = 'ABC'\n then writeln('ARC');\n if s = 'ARC'\n then writeln('ABC');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 2, "memory_kb": 1224}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s652382865", "group_id": "codeNet:p02687", "input_text": "var s:String;\nbegin\nreadln(s);\nif s='ABC'then writeln('ARC')else writeln('ABC');\nend.", "language": "Pascal", "metadata": {"date": 1589415911, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s652382865.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s652382865", "user_id": "u657913472"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "var s:String;\nbegin\nreadln(s);\nif s='ABC'then writeln('ARC')else writeln('ABC');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 1, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s674370984", "group_id": "codeNet:p02687", "input_text": "var\n s:string[3];//省空间\nbegin\n readln(s);//读入s\n write('A');//先输出前一个字母\n if s[2]='B' then write('R')//如果为B,输出R\n else write('B');//否则输出B\n write('C');//输出最后一个\nend.", "language": "Pascal", "metadata": {"date": 1588702351, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Pascal/s674370984.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s674370984", "user_id": "u476418095"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "var\n s:string[3];//省空间\nbegin\n readln(s);//读入s\n write('A');//先输出前一个字母\n if s[2]='B' then write('R')//如果为B,输出R\n else write('B');//否则输出B\n write('C');//输出最后一个\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 1, "memory_kb": 1264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s211789290", "group_id": "codeNet:p02688", "input_text": "var N,K,i,c,j,a:Longint;\nex:Array[1..100]of Boolean;\nbegin\nread(N,K);\nfor i:=1 to K do begin\nread(c);\nfor j:=1 to c do begin\nread(a);\nif not ex[a]then begin\nex[a]:=True;\ndec(N);\nend;\nend;\nend;\nwriteln(N);\nend.", "language": "Pascal", "metadata": {"date": 1589415823, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Pascal/s211789290.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s211789290", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var N,K,i,c,j,a:Longint;\nex:Array[1..100]of Boolean;\nbegin\nread(N,K);\nfor i:=1 to K do begin\nread(c);\nfor j:=1 to c do begin\nread(a);\nif not ex[a]then begin\nex[a]:=True;\ndec(N);\nend;\nend;\nend;\nwriteln(N);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 209, "cpu_time_ms": 2, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s311800499", "group_id": "codeNet:p02693", "input_text": "program main;\nvar\n n, up, low : integer;\nbegin\n readln(n);\n readln(low, up);\n\n if ((up div n) > ((low - 1) div n)) then \n writeln ('OK')\n else \n writeln ('NG');\nend.", "language": "Pascal", "metadata": {"date": 1595437028, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s311800499.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s311800499", "user_id": "u151858600"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "program main;\nvar\n n, up, low : integer;\nbegin\n readln(n);\n readln(low, up);\n\n if ((up div n) > ((low - 1) div n)) then \n writeln ('OK')\n else \n writeln ('NG');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 4, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s265280873", "group_id": "codeNet:p02693", "input_text": "var k,a,b:longint;\nbegin\n readln(k,a,b);\n for a:=a to b do\n if a mod k=0 then\n begin\n writeln('OK');\n halt;\n end;\n writeln('NG');\nend.", "language": "Pascal", "metadata": {"date": 1588547537, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Pascal/s265280873.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s265280873", "user_id": "u263933075"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "var k,a,b:longint;\nbegin\n readln(k,a,b);\n for a:=a to b do\n if a mod k=0 then\n begin\n writeln('OK');\n halt;\n end;\n writeln('NG');\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 5, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s376628584", "group_id": "codeNet:p02694", "input_text": "program main;\nvar x, amount, year : Int64;\nbegin\n readln(X);\n\n amount := 100;\n year := 0;\n while amount < x do begin\n amount := amount + (amount div 100);\n year := year + 1;\n end;\n\n writeln(year);\nend.", "language": "Pascal", "metadata": {"date": 1597342910, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s376628584.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376628584", "user_id": "u766932905"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar x, amount, year : Int64;\nbegin\n readln(X);\n\n amount := 100;\n year := 0;\n while amount < x do begin\n amount := amount + (amount div 100);\n year := year + 1;\n end;\n\n writeln(year);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s053057885", "group_id": "codeNet:p02694", "input_text": "program onepercent;\nvar\n x : int64;\n counter : longint;\n\nfunction power(a, b : real) : real;\nvar time, z : real;\nbegin\n time := 0;\n z := a;\n while time <> b do begin\n a := a * z;\n time += 1;\n end;\n power := a;\nend;\n\n\nfunction compound(count : real) : real;\nconst yen = 100;\nbegin\n compound := yen * power(1 + 0.01, count);\nend;\n\nbegin\n readln(x);\n counter := 0;\n while not(compound(counter) >= x) do begin\n writeln(compound(counter));\n counter += 1;\n end;\n writeln(counter + 1);\nend.", "language": "Pascal", "metadata": {"date": 1597179913, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s053057885.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s053057885", "user_id": "u583992857"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program onepercent;\nvar\n x : int64;\n counter : longint;\n\nfunction power(a, b : real) : real;\nvar time, z : real;\nbegin\n time := 0;\n z := a;\n while time <> b do begin\n a := a * z;\n time += 1;\n end;\n power := a;\nend;\n\n\nfunction compound(count : real) : real;\nconst yen = 100;\nbegin\n compound := yen * power(1 + 0.01, count);\nend;\n\nbegin\n readln(x);\n counter := 0;\n while not(compound(counter) >= x) do begin\n writeln(compound(counter));\n counter += 1;\n end;\n writeln(counter + 1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 550, "cpu_time_ms": 37, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s289478908", "group_id": "codeNet:p02694", "input_text": "program main;\nvar X, amount, year : Int64;\nbegin\n readln(X);\n\n amount := 100;\n year := 0;\n while amount < X do begin\n amount := trunc(amount * 1.01);\n year := year + 1;\n end;\n\n writeln(year);\nend.", "language": "Pascal", "metadata": {"date": 1597113889, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s289478908.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s289478908", "user_id": "u085059942"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar X, amount, year : Int64;\nbegin\n readln(X);\n\n amount := 100;\n year := 0;\n while amount < X do begin\n amount := trunc(amount * 1.01);\n year := year + 1;\n end;\n\n writeln(year);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 7, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s049050257", "group_id": "codeNet:p02694", "input_text": "program main;\nvar\n n, m, i : int64;\nbegin\n readln(n);\n\n m := 100; i := 0;\n while (m < n) do begin\n i += 1;\n m := trunc(m * 1.01);\n end; \n\n writeln(i);\nend.", "language": "Pascal", "metadata": {"date": 1595630532, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s049050257.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s049050257", "user_id": "u151858600"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar\n n, m, i : int64;\nbegin\n readln(n);\n\n m := 100; i := 0;\n while (m < n) do begin\n i += 1;\n m := trunc(m * 1.01);\n end; \n\n writeln(i);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 187, "cpu_time_ms": 4, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s263595016", "group_id": "codeNet:p02694", "input_text": "program main;\nvar\n yr : integer;\n target, bal : int64;\nbegin\n yr := 0;\n bal := 100;\n readln(target);\n while bal < target do begin\n bal := trunc(bal*1.01);\n yr := yr + 1;\n if bal >= target\n then writeln(yr);;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1595455424, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Pascal/s263595016.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263595016", "user_id": "u581648177"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar\n yr : integer;\n target, bal : int64;\nbegin\n yr := 0;\n bal := 100;\n readln(target);\n while bal < target do begin\n bal := trunc(bal*1.01);\n yr := yr + 1;\n if bal >= target\n then writeln(yr);;\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 272, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s259160184", "group_id": "codeNet:p02694", "input_text": "uses math;\nvar\n\ti,tar,save : int64;\nbegin\n\treadln(tar);\n\tsave:=100;\n i:=0;\n while save=s then writeln('unsafe')\n else writeln('safe');\nend.\n ", "language": "Pascal", "metadata": {"date": 1597101084, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s827479896.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s827479896", "user_id": "u303822545"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program hihi;\nvar s, w : integer;\nbegin \n\treadln(s, w);\n if w>=s then writeln('unsafe')\n else writeln('safe');\nend.\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s251477221", "group_id": "codeNet:p02699", "input_text": "program main;\ntype\n arraytype = array[1..200000] of string[10];\nvar\n i, n, count : longint;\n A : arraytype;\n\nprocedure Quicksort(var A : arraytype; left, right : integer);\nvar\n i, j : integer;\n pivot, temp : string;\nbegin\n i := left; \n j := right;\n pivot := A[(left + right) div 2];\n while i <= j do begin\n while A[i] < pivot do \n i := i + 1;\n while A[j] > pivot do \n j := j - 1;\n if i <= j then begin \n temp := A[i];\n A[i] := A[j];\n A[j] := temp;\n i := i + 1;\n j := j - 1;\n end;\n end;\n if left < j\n then Quicksort(A, left, j);\n if i < right \n then Quicksort(A, i, right);\nend;\n\nbegin\n //read\n readln(n);\n for i := 1 to n do \n readln(A[i]);\n \n //sort\n Quicksort(A, 1, n);\n\n //count\n count := 1;\n for i := 2 to n do\n if A[i] <> A[i-1]\n then count := count + 1;\n writeln(count);\nend.", "language": "Pascal", "metadata": {"date": 1596667739, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s251477221.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s251477221", "user_id": "u581648177"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\ntype\n arraytype = array[1..200000] of string[10];\nvar\n i, n, count : longint;\n A : arraytype;\n\nprocedure Quicksort(var A : arraytype; left, right : integer);\nvar\n i, j : integer;\n pivot, temp : string;\nbegin\n i := left; \n j := right;\n pivot := A[(left + right) div 2];\n while i <= j do begin\n while A[i] < pivot do \n i := i + 1;\n while A[j] > pivot do \n j := j - 1;\n if i <= j then begin \n temp := A[i];\n A[i] := A[j];\n A[j] := temp;\n i := i + 1;\n j := j - 1;\n end;\n end;\n if left < j\n then Quicksort(A, left, j);\n if i < right \n then Quicksort(A, i, right);\nend;\n\nbegin\n //read\n readln(n);\n for i := 1 to n do \n readln(A[i]);\n \n //sort\n Quicksort(A, 1, n);\n\n //count\n count := 1;\n for i := 2 to n do\n if A[i] <> A[i-1]\n then count := count + 1;\n writeln(count);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 987, "cpu_time_ms": 2, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s401679714", "group_id": "codeNet:p02699", "input_text": "program main;\nvar s, w : integer;\nbegin\n\treadln(s, w);\n if w >= s\n then writeln('unsafe')\n else writeln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1596647123, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s401679714.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s401679714", "user_id": "u384260326"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\nvar s, w : integer;\nbegin\n\treadln(s, w);\n if w >= s\n then writeln('unsafe')\n else writeln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 3, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s797548058", "group_id": "codeNet:p02699", "input_text": "program saw;\nvar\n s, w : longint;\nbegin\n readln(s,w);\n if (s > w) then writeln('safe')\n else writeln('unsafe');\nend.", "language": "Pascal", "metadata": {"date": 1596600486, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s797548058.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s797548058", "user_id": "u583992857"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program saw;\nvar\n s, w : longint;\nbegin\n readln(s,w);\n if (s > w) then writeln('safe')\n else writeln('unsafe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 132, "cpu_time_ms": 3, "memory_kb": 1308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s526197859", "group_id": "codeNet:p02699", "input_text": "program main;\n\nvar\n\tn, m : integer;\n \nbegin\n\treadln(n, m);\n if m >= n then\n \twriteln('unsafe')\n else\n \twriteln('safe');\nend.", "language": "Pascal", "metadata": {"date": 1596582488, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s526197859.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s526197859", "user_id": "u838994261"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "program main;\n\nvar\n\tn, m : integer;\n \nbegin\n\treadln(n, m);\n if m >= n then\n \twriteln('unsafe')\n else\n \twriteln('safe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 139, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s580956373", "group_id": "codeNet:p02699", "input_text": "uses StrUtils;\nvar\n a, b: integer;\nbegin\n read(a);\n read(b);\n writeln(ifThen(a > b, 'safe', 'unsafe'));\nend.", "language": "Pascal", "metadata": {"date": 1588187029, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s580956373.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s580956373", "user_id": "u172873334"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "uses StrUtils;\nvar\n a, b: integer;\nbegin\n read(a);\n read(b);\n writeln(ifThen(a > b, 'safe', 'unsafe'));\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 112, "cpu_time_ms": 1, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s022018889", "group_id": "codeNet:p02699", "input_text": "var a,b:Longint;\nbegin\nread(a,b);\nif a>b then writeln('safe')else writeln('unsafe');\nend.", "language": "Pascal", "metadata": {"date": 1588140128, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Pascal/s022018889.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s022018889", "user_id": "u657913472"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "var a,b:Longint;\nbegin\nread(a,b);\nif a>b then writeln('safe')else writeln('unsafe');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 89, "cpu_time_ms": 1, "memory_kb": 1344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s756090349", "group_id": "codeNet:p02701", "input_text": "program main;\nvar \n n, i, ans : integer;\n prev : string;\n a : array[1..200000] of string;\n\nprocedure qs(l, r : integer);\nvar\n i, j : integer;\n p, temp : string;\nbegin\n if (l <= r) then begin\n i := l; j := l; p := a[r];\n while (i < r) do begin\n if (a[i] <= p) then begin \n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n j := j + 1;\n end;\n i := i + 1;\n end;\n temp := a[j];\n a[j] := a[r];\n a[r] := temp;\n\n qs(l, j - 1);\n qs(j + 1, r);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(a[i]);\n \n qs(1, n);\n\n prev := a[1]; ans := 1;\n for i := 2 to n do\n if (a[i] <> prev) then begin\n ans := ans + 1;\n prev := a[i];\n end;\n\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1597335656, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s756090349.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s756090349", "user_id": "u151858600"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar \n n, i, ans : integer;\n prev : string;\n a : array[1..200000] of string;\n\nprocedure qs(l, r : integer);\nvar\n i, j : integer;\n p, temp : string;\nbegin\n if (l <= r) then begin\n i := l; j := l; p := a[r];\n while (i < r) do begin\n if (a[i] <= p) then begin \n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n j := j + 1;\n end;\n i := i + 1;\n end;\n temp := a[j];\n a[j] := a[r];\n a[r] := temp;\n\n qs(l, j - 1);\n qs(j + 1, r);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(a[i]);\n \n qs(1, n);\n\n prev := a[1]; ans := 1;\n for i := 2 to n do\n if (a[i] <> prev) then begin\n ans := ans + 1;\n prev := a[i];\n end;\n\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 878, "cpu_time_ms": 2207, "memory_kb": 59932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s146996071", "group_id": "codeNet:p02701", "input_text": "program main;\nvar \n n, i, ans : integer;\n prev : string;\n a : array[1..200000] of string;\n\nprocedure qs(l, r : longint);\nvar\n i, j : longint;\n p, temp : string;\nbegin\n if (l <= r) then begin\n i := l; j := l; p := a[r];\n while (i < r) do begin\n if (a[i] <= p) then begin \n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n j := j + 1;\n end;\n i := i + 1;\n end;\n temp := a[j];\n a[j] := a[r];\n a[r] := temp;\n\n qs(l, j - 1);\n qs(j + 1, r);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(a[i]);\n \n qs(1, n);\n\n prev := a[1]; ans := 1;\n for i := 2 to n do\n if (a[i] <> prev) then begin\n ans := ans + 1;\n prev := a[i];\n end;\n\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1597334985, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s146996071.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s146996071", "user_id": "u151858600"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar \n n, i, ans : integer;\n prev : string;\n a : array[1..200000] of string;\n\nprocedure qs(l, r : longint);\nvar\n i, j : longint;\n p, temp : string;\nbegin\n if (l <= r) then begin\n i := l; j := l; p := a[r];\n while (i < r) do begin\n if (a[i] <= p) then begin \n temp := a[i];\n a[i] := a[j];\n a[j] := temp;\n j := j + 1;\n end;\n i := i + 1;\n end;\n temp := a[j];\n a[j] := a[r];\n a[r] := temp;\n\n qs(l, j - 1);\n qs(j + 1, r);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(a[i]);\n \n qs(1, n);\n\n prev := a[1]; ans := 1;\n for i := 2 to n do\n if (a[i] <> prev) then begin\n ans := ans + 1;\n prev := a[i];\n end;\n\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 878, "cpu_time_ms": 2207, "memory_kb": 59912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s278523044", "group_id": "codeNet:p02701", "input_text": "program train;\nvar \n a : array[1..200000] of string;\n i, j, count, n : integer;\n b : array[1..200000] of integer;\nbegin\n readln(n);\n count := 0;\n for i := 1 to n do begin\n readln(a[i]); \n b[i] := 1;\n end;\n for i := 1 to n do \n for j := i+1 to n do\n if b[i] <> 0\n then if a[i] = a[j]\n then b[j] := 0;\n for i := 1 to n do \n count := count + b[i];\n write(count);\nend. ", "language": "Pascal", "metadata": {"date": 1597020746, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s278523044.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s278523044", "user_id": "u999320099"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program train;\nvar \n a : array[1..200000] of string;\n i, j, count, n : integer;\n b : array[1..200000] of integer;\nbegin\n readln(n);\n count := 0;\n for i := 1 to n do begin\n readln(a[i]); \n b[i] := 1;\n end;\n for i := 1 to n do \n for j := i+1 to n do\n if b[i] <> 0\n then if a[i] = a[j]\n then b[j] := 0;\n for i := 1 to n do \n count := count + b[i];\n write(count);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 476, "cpu_time_ms": 2207, "memory_kb": 59208}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s157736162", "group_id": "codeNet:p02701", "input_text": "program train;\nvar \n a : array[1..200000] of string;\n i, j, count, n : integer;\n b : array[1..200000] of integer;\nbegin\n readln(n);\n count := 0;\n for i := 1 to n do begin\n readln(a[i]); \n b[i] := 1;\n end;\n for i := 1 to n do \n for j := i+1 to n do\n if b[j] <> 0\n then if a[i] = a[j]\n then b[j] := 0;\n for i := 1 to n do \n count := count + b[i];\n write(count);\nend. ", "language": "Pascal", "metadata": {"date": 1597020623, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s157736162.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s157736162", "user_id": "u999320099"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program train;\nvar \n a : array[1..200000] of string;\n i, j, count, n : integer;\n b : array[1..200000] of integer;\nbegin\n readln(n);\n count := 0;\n for i := 1 to n do begin\n readln(a[i]); \n b[i] := 1;\n end;\n for i := 1 to n do \n for j := i+1 to n do\n if b[j] <> 0\n then if a[i] = a[j]\n then b[j] := 0;\n for i := 1 to n do \n count := count + b[i];\n write(count);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 476, "cpu_time_ms": 2208, "memory_kb": 59220}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s448603334", "group_id": "codeNet:p02701", "input_text": "program train;\nvar \n a : array[1..200000] of string;\n i, j, count, n : integer;\n b : array[1..200000] of integer;\nbegin\n readln(n);\n count := 0;\n for i := 1 to n do begin\n readln(a[i]); \n b[i] := 1;\n end;\n for i := 1 to n do \n for j := i+1 to n do\n if a[i] = a[j]\n then b[j] := 0;\n for i := 1 to n do \n count := count + b[i];\n write(count);\nend. ", "language": "Pascal", "metadata": {"date": 1597020313, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s448603334.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s448603334", "user_id": "u999320099"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program train;\nvar \n a : array[1..200000] of string;\n i, j, count, n : integer;\n b : array[1..200000] of integer;\nbegin\n readln(n);\n count := 0;\n for i := 1 to n do begin\n readln(a[i]); \n b[i] := 1;\n end;\n for i := 1 to n do \n for j := i+1 to n do\n if a[i] = a[j]\n then b[j] := 0;\n for i := 1 to n do \n count := count + b[i];\n write(count);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 438, "cpu_time_ms": 2207, "memory_kb": 59172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s822873607", "group_id": "codeNet:p02701", "input_text": "program main;\ntype\n ar = array [1..200000] of string;\nvar n,i,c : longint;\n a : ar;\nprocedure QuickSort(var A : ar; left,right : longint);\nvar i,j : longint;\n p,temp : string;\nbegin\n i := left;\n j := right;\n p := A[(left + right) div 2];\n while i <= j do begin\n while A[i] < p do\n inc(i);\n while A[j] > p do\n dec(j);\n if i <= j then begin\n temp := A[i];\n A[i] := A[j];\n A[j] := temp;\n inc(i);\n dec(j);\n end;\n end;\n if left < j\n then QuickSort(A, left, j);\n if right > i\n then QuickSort(A, i, right);\nend;\n\nbegin\n c := 1;\n readln(n);\n for i := 1 to n do\n readln(a[i]);\n QuickSort(a, 1, n);\n for i := 2 to n do\n if a[i] > a[i-1]\n then inc(c);\n writeln(c);\nend.", "language": "Pascal", "metadata": {"date": 1596734833, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s822873607.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s822873607", "user_id": "u225670189"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\ntype\n ar = array [1..200000] of string;\nvar n,i,c : longint;\n a : ar;\nprocedure QuickSort(var A : ar; left,right : longint);\nvar i,j : longint;\n p,temp : string;\nbegin\n i := left;\n j := right;\n p := A[(left + right) div 2];\n while i <= j do begin\n while A[i] < p do\n inc(i);\n while A[j] > p do\n dec(j);\n if i <= j then begin\n temp := A[i];\n A[i] := A[j];\n A[j] := temp;\n inc(i);\n dec(j);\n end;\n end;\n if left < j\n then QuickSort(A, left, j);\n if right > i\n then QuickSort(A, i, right);\nend;\n\nbegin\n c := 1;\n readln(n);\n for i := 1 to n do\n readln(a[i]);\n QuickSort(a, 1, n);\n for i := 2 to n do\n if a[i] > a[i-1]\n then inc(c);\n writeln(c);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 846, "cpu_time_ms": 299, "memory_kb": 58436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s945690939", "group_id": "codeNet:p02701", "input_text": "program hi;\ntype ars = array[1..200000] of string;\nvar \n n, i, cnt: longint;\n a, tmp: ars;\n\nprocedure merge(var a, tmp: ars; l, m, r: longint);\nvar i, i1, i2: longint;\nbegin\n i := l; i1 := l; i2 := m + 1;\n while (i1 <= m) and (i2 <= r) do begin\n if a[i1] <= a[i2] then begin\n tmp[i] := a[i1];\n inc(i1);\n end else begin\n tmp[i] := a[i2];\n inc(i2);\n end;\n inc(i);\n end;\n if i1 <= m then \n while i1 <= m do begin\n tmp[i] := a[i1];\n inc(i1); inc(i);\n end \n else \n while i2 <= r do begin\n tmp[i] := a[i2];\n inc(i2); inc(i);\n end;\n for i := l to r do \n a[i] := tmp[i];\nend;\n\nprocedure mSort(var a, tmp: ars; l, r: longint);\nvar m: longint;\nbegin\n if l < r then begin\n m := (l + r) div 2;\n mSort(a, tmp, l, m);\n mSort(a, tmp, m + 1, r);\n merge(a, tmp, l, m, r);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(a[i]);\n mSort(a, tmp, 1, n);\n cnt := 1;\n for i := 1 to n - 1 do \n if a[i] <> a[i + 1] then\n inc(cnt);\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596728361, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s945690939.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s945690939", "user_id": "u051422473"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program hi;\ntype ars = array[1..200000] of string;\nvar \n n, i, cnt: longint;\n a, tmp: ars;\n\nprocedure merge(var a, tmp: ars; l, m, r: longint);\nvar i, i1, i2: longint;\nbegin\n i := l; i1 := l; i2 := m + 1;\n while (i1 <= m) and (i2 <= r) do begin\n if a[i1] <= a[i2] then begin\n tmp[i] := a[i1];\n inc(i1);\n end else begin\n tmp[i] := a[i2];\n inc(i2);\n end;\n inc(i);\n end;\n if i1 <= m then \n while i1 <= m do begin\n tmp[i] := a[i1];\n inc(i1); inc(i);\n end \n else \n while i2 <= r do begin\n tmp[i] := a[i2];\n inc(i2); inc(i);\n end;\n for i := l to r do \n a[i] := tmp[i];\nend;\n\nprocedure mSort(var a, tmp: ars; l, r: longint);\nvar m: longint;\nbegin\n if l < r then begin\n m := (l + r) div 2;\n mSort(a, tmp, l, m);\n mSort(a, tmp, m + 1, r);\n merge(a, tmp, l, m, r);\n end;\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(a[i]);\n mSort(a, tmp, 1, n);\n cnt := 1;\n for i := 1 to n - 1 do \n if a[i] <> a[i + 1] then\n inc(cnt);\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1187, "cpu_time_ms": 331, "memory_kb": 59996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s453555258", "group_id": "codeNet:p02701", "input_text": "program gacha;\ntype \n arr = array[1..200000] of string;\n\nvar\n n, i, count : longint;\n list : arr;\n\nprocedure swap(var x: string; var y: string);\nvar tmp: string;\nbegin\n tmp := x;\n x := y;\n y := tmp;\nend;\n\nprocedure quicksort(var x: arr; left, right: longint);\nvar \n i, j: integer;\n k: string;\n\nbegin\n i := left; \n j := right;\n k := x[(left + right) div 2];\n while i <= j do begin\n while x[i] < k do \n inc(i);\n while x[j] > k do\n dec(j);\n if i <= j then begin\n swap(x[i], x[j]);\n inc(i);\n dec(j);\n end;\n end;\n if left < j then\n quicksort(x, left, j);\n if right > i then \n quicksort(x, i, right);\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(list[i]);\n quicksort(list, 1, n);\n count := 1;\n for i := 2 to n do begin\n if list[i - 1] <> list[i] then \n inc(count);\n end;\n writeln(count);\nend.", "language": "Pascal", "metadata": {"date": 1596691651, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s453555258.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s453555258", "user_id": "u583992857"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program gacha;\ntype \n arr = array[1..200000] of string;\n\nvar\n n, i, count : longint;\n list : arr;\n\nprocedure swap(var x: string; var y: string);\nvar tmp: string;\nbegin\n tmp := x;\n x := y;\n y := tmp;\nend;\n\nprocedure quicksort(var x: arr; left, right: longint);\nvar \n i, j: integer;\n k: string;\n\nbegin\n i := left; \n j := right;\n k := x[(left + right) div 2];\n while i <= j do begin\n while x[i] < k do \n inc(i);\n while x[j] > k do\n dec(j);\n if i <= j then begin\n swap(x[i], x[j]);\n inc(i);\n dec(j);\n end;\n end;\n if left < j then\n quicksort(x, left, j);\n if right > i then \n quicksort(x, i, right);\nend;\n\nbegin\n readln(n);\n for i := 1 to n do \n readln(list[i]);\n quicksort(list, 1, n);\n count := 1;\n for i := 2 to n do begin\n if list[i - 1] <> list[i] then \n inc(count);\n end;\n writeln(count);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 982, "cpu_time_ms": 324, "memory_kb": 58432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s051383114", "group_id": "codeNet:p02701", "input_text": "program main;\ntype\n arraytype = array[1..200000] of string[10];\nvar\n i, n, count : longint;\n A : arraytype;\n\nprocedure Quicksort(var A : arraytype; left, right : integer);\nvar\n i, j : integer;\n pivot, temp : string;\nbegin\n i := left; \n j := right;\n pivot := A[(left + right) div 2];\n while i <= j do begin\n while A[i] < pivot do \n i := i + 1;\n while A[j] > pivot do \n j := j - 1;\n if i <= j then begin \n temp := A[i];\n A[i] := A[j];\n A[j] := temp;\n i := i + 1;\n j := j - 1;\n end;\n end;\n if left < j\n then Quicksort(A, left, j);\n if i < right \n then Quicksort(A, i, right);\nend;\n\nbegin\n //read\n readln(n);\n for i := 1 to n do \n readln(A[i]);\n \n //sort\n Quicksort(A, 1, n);\n\n //count\n count := 1;\n writeln(n);\n for i := 2 to n do\n if A[i] <> A[i-1]\n then count := count + 1;\nend.", "language": "Pascal", "metadata": {"date": 1596667334, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s051383114.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s051383114", "user_id": "u581648177"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\ntype\n arraytype = array[1..200000] of string[10];\nvar\n i, n, count : longint;\n A : arraytype;\n\nprocedure Quicksort(var A : arraytype; left, right : integer);\nvar\n i, j : integer;\n pivot, temp : string;\nbegin\n i := left; \n j := right;\n pivot := A[(left + right) div 2];\n while i <= j do begin\n while A[i] < pivot do \n i := i + 1;\n while A[j] > pivot do \n j := j - 1;\n if i <= j then begin \n temp := A[i];\n A[i] := A[j];\n A[j] := temp;\n i := i + 1;\n j := j - 1;\n end;\n end;\n if left < j\n then Quicksort(A, left, j);\n if i < right \n then Quicksort(A, i, right);\nend;\n\nbegin\n //read\n readln(n);\n for i := 1 to n do \n readln(A[i]);\n \n //sort\n Quicksort(A, 1, n);\n\n //count\n count := 1;\n writeln(n);\n for i := 2 to n do\n if A[i] <> A[i-1]\n then count := count + 1;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 983, "cpu_time_ms": 266, "memory_kb": 2408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s666552510", "group_id": "codeNet:p02701", "input_text": "program main;\nvar\n n, cnt, i, j : LongInt;\n found : boolean;\n x : string;\n s : array[1..200000] of string;\nbegin\n readln(n);\n\n cnt := 0;\n for i := 1 to n do begin\n readln(x);\n\n // find x in array of s\n found := false;\n for j := 1 to cnt do\n if s[j] = x then\n found := true;\n \n // if cannot find x, then inc cnt and add x to s\n if not found then begin\n cnt := cnt + 1;\n s[cnt] := x;\n end;\n end;\n\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596594145, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s666552510.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s666552510", "user_id": "u085059942"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar\n n, cnt, i, j : LongInt;\n found : boolean;\n x : string;\n s : array[1..200000] of string;\nbegin\n readln(n);\n\n cnt := 0;\n for i := 1 to n do begin\n readln(x);\n\n // find x in array of s\n found := false;\n for j := 1 to cnt do\n if s[j] = x then\n found := true;\n \n // if cannot find x, then inc cnt and add x to s\n if not found then begin\n cnt := cnt + 1;\n s[cnt] := x;\n end;\n end;\n\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 469, "cpu_time_ms": 2205, "memory_kb": 4520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s956127755", "group_id": "codeNet:p02701", "input_text": "program main;\nvar n,i,j,c : integer;\n a : array[1..10000] of string;\n t : boolean;\nbegin\n c := 0;\n t := true;\n readln(n);\n for i := 1 to n do begin\n readln(a[i]);\n if i > 1 then\n for j := 1 to i-1 do\n if a[i] = a[j]\n then t := false;\n if t = true\n then inc(c)\n else t:=true;\n end;\n writeln(c);\nend.", "language": "Pascal", "metadata": {"date": 1596209043, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Pascal/s956127755.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s956127755", "user_id": "u225670189"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar n,i,j,c : integer;\n a : array[1..10000] of string;\n t : boolean;\nbegin\n c := 0;\n t := true;\n readln(n);\n for i := 1 to n do begin\n readln(a[i]);\n if i > 1 then\n for j := 1 to i-1 do\n if a[i] = a[j]\n then t := false;\n if t = true\n then inc(c)\n else t:=true;\n end;\n writeln(c);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 386, "cpu_time_ms": 1049, "memory_kb": 3148}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s603093228", "group_id": "codeNet:p02706", "input_text": "program main;\nvar\n n : LongInt;\n m, i, a : integer;\nbegin\n readln(n, m);\n for i := 1 to m do begin\n read(a);\n n := n - a;\n end;\n\n if n < 0 then\n writeln(-1)\n else\n writeln(n);\nend.", "language": "Pascal", "metadata": {"date": 1596466518, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s603093228.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603093228", "user_id": "u766932905"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main;\nvar\n n : LongInt;\n m, i, a : integer;\nbegin\n readln(n, m);\n for i := 1 to m do begin\n read(a);\n n := n - a;\n end;\n\n if n < 0 then\n writeln(-1)\n else\n writeln(n);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s349327939", "group_id": "codeNet:p02706", "input_text": "var\n\tn, m, k : integer;\n\ti : integer;\n ok : boolean;\n \nbegin\n\tok := true;\n\treadln(n, m);\n\tfor i := 1 to m do \n begin\n \t\tread(k);\n \tn := n - k;\n if n < 0\n \tthen ok := false;\n end;\n if ok then\n \twriteln(n)\n else\n \twriteln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1596168964, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s349327939.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s349327939", "user_id": "u838994261"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "var\n\tn, m, k : integer;\n\ti : integer;\n ok : boolean;\n \nbegin\n\tok := true;\n\treadln(n, m);\n\tfor i := 1 to m do \n begin\n \t\tread(k);\n \tn := n - k;\n if n < 0\n \tthen ok := false;\n end;\n if ok then\n \twriteln(n)\n else\n \twriteln(-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s822140507", "group_id": "codeNet:p02706", "input_text": "program main;\nvar\n\tn, m, i, free, total : int64;\n\ta : array[1..100000] of int64;\nbegin\n\tread(n, m);\n total := 0;\n for i := 1 to m do begin\n \tread(a[i]);\n total := total + a[i];\n end;\n\tfree := n - total;\n if free >= 0\n \tthen writeln(free)\n \telse writeln('-1');\nend.\n \n ", "language": "Pascal", "metadata": {"date": 1595299386, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s822140507.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s822140507", "user_id": "u522723337"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main;\nvar\n\tn, m, i, free, total : int64;\n\ta : array[1..100000] of int64;\nbegin\n\tread(n, m);\n total := 0;\n for i := 1 to m do begin\n \tread(a[i]);\n total := total + a[i];\n end;\n\tfree := n - total;\n if free >= 0\n \tthen writeln(free)\n \telse writeln('-1');\nend.\n \n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 306, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s090009245", "group_id": "codeNet:p02706", "input_text": "uses math;\nvar n, i, m, a, sm : longint;\n\nbegin\n readln(m, n);\n sm := 0;\n for i := 1 to n do\n begin\n read(a); \n sm := sm + a;\n end;\n writeln(max(m - sm, -1));\nend.", "language": "Pascal", "metadata": {"date": 1587346531, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Pascal/s090009245.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s090009245", "user_id": "u366795445"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "uses math;\nvar n, i, m, a, sm : longint;\n\nbegin\n readln(m, n);\n sm := 0;\n for i := 1 to n do\n begin\n read(a); \n sm := sm + a;\n end;\n writeln(max(m - sm, -1));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 6, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s099320338", "group_id": "codeNet:p02707", "input_text": "program main;\nvar \n n, i, temp : integer;\n a : array[1..200000] of integer;\n\nbegin\n readln(n);\n\n for i := 1 to n do \n a[i] := 0;\n\n for i := 2 to n do begin\n read(temp);\n a[temp] := a[temp] + 1;\n end;\n\n for i := 1 to n do \n writeln(a[i]);\nend.\n", "language": "Pascal", "metadata": {"date": 1597334464, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s099320338.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s099320338", "user_id": "u151858600"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main;\nvar \n n, i, temp : integer;\n a : array[1..200000] of integer;\n\nbegin\n readln(n);\n\n for i := 1 to n do \n a[i] := 0;\n\n for i := 2 to n do begin\n read(temp);\n a[temp] := a[temp] + 1;\n end;\n\n for i := 1 to n do \n writeln(a[i]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 40, "memory_kb": 1392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s628843399", "group_id": "codeNet:p02707", "input_text": "program management;\nvar\n n, i, x : longint;\n list : array[1..200000] of longint;\n\nbegin\n readln(n);\n for i in list do\n list[i] := 0;\n for i := 2 to n do begin\n read(x);\n list[x] += 1;\n end;\n for i := 1 to n do begin\n writeln(list[i]);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1596600188, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s628843399.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s628843399", "user_id": "u583992857"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program management;\nvar\n n, i, x : longint;\n list : array[1..200000] of longint;\n\nbegin\n readln(n);\n for i in list do\n list[i] := 0;\n for i := 2 to n do begin\n read(x);\n list[x] += 1;\n end;\n for i := 1 to n do begin\n writeln(list[i]);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 297, "cpu_time_ms": 43, "memory_kb": 1396}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s508312332", "group_id": "codeNet:p02707", "input_text": "var N,I,A:Longint;S:Array[1..200000]of Longint;\nbegin\nread(N);\nfor i:=2 to N do begin\nread(A);\ninc(S[A]);\nend;\nfor i:=1 to N do writeln(S[i]);\nend.", "language": "Pascal", "metadata": {"date": 1587533466, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Pascal/s508312332.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s508312332", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "var N,I,A:Longint;S:Array[1..200000]of Longint;\nbegin\nread(N);\nfor i:=2 to N do begin\nread(A);\ninc(S[A]);\nend;\nfor i:=1 to N do writeln(S[i]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 38, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s147273694", "group_id": "codeNet:p02708", "input_text": "program Sum_of_Large_Numbers;\nvar\n n, k, x: int64;\nbegin\n read(n, k);\n x := (n+1)*(n+k+1)*(n-k+2) div 2+(n-k+2)-(n+1)*(n+2)*(2*n+3) div 6+(k-1)*k*(2*k-1) div 6;\n writeln(x mod 1000000007);\nend.", "language": "Pascal", "metadata": {"date": 1587360163, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Pascal/s147273694.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s147273694", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program Sum_of_Large_Numbers;\nvar\n n, k, x: int64;\nbegin\n read(n, k);\n x := (n+1)*(n+k+1)*(n-k+2) div 2+(n-k+2)-(n+1)*(n+2)*(2*n+3) div 6+(k-1)*k*(2*k-1) div 6;\n writeln(x mod 1000000007);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 197, "cpu_time_ms": 1, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s434366121", "group_id": "codeNet:p02708", "input_text": "program Sum_of_Large_Numbers;\nconst\n m: int64 = 1000000007;\n h: int64 = 500000004;\n s: int64 = 166666668;\nvar\n n, k: int64;\nfunction f(i: int64): int64;\nbegin\n f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);\nend;\nbegin\n read(n, k);\n writeln((m+(f(n+1)-f(k-1)) mod m) mod m);\nend.", "language": "Pascal", "metadata": {"date": 1587359906, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Pascal/s434366121.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s434366121", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program Sum_of_Large_Numbers;\nconst\n m: int64 = 1000000007;\n h: int64 = 500000004;\n s: int64 = 166666668;\nvar\n n, k: int64;\nfunction f(i: int64): int64;\nbegin\n f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);\nend;\nbegin\n read(n, k);\n writeln((m+(f(n+1)-f(k-1)) mod m) mod m);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 312, "cpu_time_ms": 1, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s923042231", "group_id": "codeNet:p02708", "input_text": "program Sum_of_Large_Numbers;\nuses math;\nconst\n m: int64 = 1000000007;\n h: int64 = 500000004;\n s: int64 = 166666668;\nvar\n n, k: int64;\nfunction f(i: int64): int64;\nbegin\n f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);\nend;\nbegin\n read(n, k);\n writeln((m+(f(n+1)-f(k-1)) mod m) mod m);\nend.", "language": "Pascal", "metadata": {"date": 1587359696, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Pascal/s923042231.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s923042231", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program Sum_of_Large_Numbers;\nuses math;\nconst\n m: int64 = 1000000007;\n h: int64 = 500000004;\n s: int64 = 166666668;\nvar\n n, k: int64;\nfunction f(i: int64): int64;\nbegin\n f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);\nend;\nbegin\n read(n, k);\n writeln((m+(f(n+1)-f(k-1)) mod m) mod m);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 323, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s599400077", "group_id": "codeNet:p02709", "input_text": "uses crt,math;\nconst fi='';\n nmax=1000;\n vc=100000000;\ntype data=int64;\nvar\n f:text;\n A:array[0..nmax+1,0..nmax+1] of data;\n Fx,Fy,MatchX,MatchY,tr:array[0..nmax+1] of data;\n Q:array[0..nmax*nmax] of data;\n ddx,ddy:array[0..nmax+1] of boolean;\n dau,cuoi,start,finish:data;\n n:longint;\n mm :data;\n\nprocedure docfile;\nvar u,v,c:data;\n i,j:longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n begin\n read(u);\n for j:=1 to n do begin a[i,j] := u*abs(i-j); mm := max(mm,a[i,j]); end;\n end;\n for i:=1 to n do\n begin\n for j:=1 to n do a[i,j] := mm - a[i,j];\n end;\nend;\n\nprocedure init;\nvar i,j:longint;\nbegin\n fillchar(MatchX,sizeof(matchx),0);\n MatchY:=MatchX;\n\n for i:=1 to n do\n begin\n fx[i]:=vc;\n for j:=1 to n do\n if fx[i]>a[i,j] then\n fx[i]:=a[i,j];\n end;\n for i:=1 to n do\n begin\n fy[i]:=vc;\n for j:=1 to n do\n if a[i,j]-fx[i]0 then\n begin\n ddx[MatchY[i]]:=true;\n ddy[i]:=true;\n end;\n delta:=vc;\n for i:=1 to n do\n if ddx[i] then\n for j:=1 to n do\n if (not ddy[j]) and (delta>get(i,j)) then\n delta:=get(i,j);\n for i:=1 to n do\n begin\n if ddx[i] then fx[i]:=fx[i]+delta;\n if ddy[i] then fy[i]:=fy[i]-delta;\n end;\nend;\n\nprocedure xuli;\nvar res:data;\n i,j:longint;\nbegin\n for i:=1 to n do\n begin\n start:=i;\n finish:=0;\n repeat\n bfs;\n if finish=0 then subx_addy;\n until finish<>0;\n enlager(finish);\n end;\n res:=0;\n for i:=1 to n do\n if MatchX[i]<>0 then\n inc(res,a[i,Matchx[i]]);\n writeln(mm*n - res);\n {for i:=1 to n do\n if MatchX[i]<>0 then\n writeln(i, ' ',MatchX[i]); }\n\nend;\n\nbegin\n docfile;\n init;\n xuli;\nend.\n", "language": "Pascal", "metadata": {"date": 1587430025, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02709.html", "problem_id": "p02709", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02709/input.txt", "sample_output_relpath": "derived/input_output/data/p02709/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02709/Pascal/s599400077.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s599400077", "user_id": "u840460038"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "uses crt,math;\nconst fi='';\n nmax=1000;\n vc=100000000;\ntype data=int64;\nvar\n f:text;\n A:array[0..nmax+1,0..nmax+1] of data;\n Fx,Fy,MatchX,MatchY,tr:array[0..nmax+1] of data;\n Q:array[0..nmax*nmax] of data;\n ddx,ddy:array[0..nmax+1] of boolean;\n dau,cuoi,start,finish:data;\n n:longint;\n mm :data;\n\nprocedure docfile;\nvar u,v,c:data;\n i,j:longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n begin\n read(u);\n for j:=1 to n do begin a[i,j] := u*abs(i-j); mm := max(mm,a[i,j]); end;\n end;\n for i:=1 to n do\n begin\n for j:=1 to n do a[i,j] := mm - a[i,j];\n end;\nend;\n\nprocedure init;\nvar i,j:longint;\nbegin\n fillchar(MatchX,sizeof(matchx),0);\n MatchY:=MatchX;\n\n for i:=1 to n do\n begin\n fx[i]:=vc;\n for j:=1 to n do\n if fx[i]>a[i,j] then\n fx[i]:=a[i,j];\n end;\n for i:=1 to n do\n begin\n fy[i]:=vc;\n for j:=1 to n do\n if a[i,j]-fx[i]0 then\n begin\n ddx[MatchY[i]]:=true;\n ddy[i]:=true;\n end;\n delta:=vc;\n for i:=1 to n do\n if ddx[i] then\n for j:=1 to n do\n if (not ddy[j]) and (delta>get(i,j)) then\n delta:=get(i,j);\n for i:=1 to n do\n begin\n if ddx[i] then fx[i]:=fx[i]+delta;\n if ddy[i] then fy[i]:=fy[i]-delta;\n end;\nend;\n\nprocedure xuli;\nvar res:data;\n i,j:longint;\nbegin\n for i:=1 to n do\n begin\n start:=i;\n finish:=0;\n repeat\n bfs;\n if finish=0 then subx_addy;\n until finish<>0;\n enlager(finish);\n end;\n res:=0;\n for i:=1 to n do\n if MatchX[i]<>0 then\n inc(res,a[i,Matchx[i]]);\n writeln(mm*n - res);\n {for i:=1 to n do\n if MatchX[i]<>0 then\n writeln(i, ' ',MatchX[i]); }\n\nend;\n\nbegin\n docfile;\n init;\n xuli;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "sample_input": "4\n1 3 4 2\n"}, "reference_outputs": ["20\n"], "source_document_id": "p02709", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4322, "cpu_time_ms": 2205, "memory_kb": 16196}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s572776443", "group_id": "codeNet:p02709", "input_text": "uses crt,math;\nconst fi='';\n nmax=2000;\n vc=100000000;\ntype data=int64;\nvar\n f:text;\n A:array[0..nmax+1,0..nmax+1] of data;\n Fx,Fy,MatchX,MatchY,tr:array[0..nmax+1] of data;\n Q:array[0..nmax*nmax] of data;\n ddx,ddy:array[0..nmax+1] of boolean;\n dau,cuoi,start,finish:data;\n n:longint;\n mm :data;\n\nprocedure docfile;\nvar u,v,c:data;\n i,j:longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n begin\n read(u);\n for j:=1 to n do begin a[i,j] := u*abs(i-j); mm := max(mm,a[i,j]); end;\n end;\n for i:=1 to n do\n begin\n for j:=1 to n do a[i,j] := mm - a[i,j];\n end;\nend;\n\nprocedure init;\nvar i,j:longint;\nbegin\n fillchar(MatchX,sizeof(matchx),0);\n MatchY:=MatchX;\n\n for i:=1 to n do\n begin\n fx[i]:=vc;\n for j:=1 to n do\n if fx[i]>a[i,j] then\n fx[i]:=a[i,j];\n end;\n for i:=1 to n do\n begin\n fy[i]:=vc;\n for j:=1 to n do\n if a[i,j]-fx[i]0 then\n begin\n ddx[MatchY[i]]:=true;\n ddy[i]:=true;\n end;\n delta:=vc;\n for i:=1 to n do\n if ddx[i] then\n for j:=1 to n do\n if (not ddy[j]) and (delta>get(i,j)) then\n delta:=get(i,j);\n for i:=1 to n do\n begin\n if ddx[i] then fx[i]:=fx[i]+delta;\n if ddy[i] then fy[i]:=fy[i]-delta;\n end;\nend;\n\nprocedure xuli;\nvar res:data;\n i,j:longint;\nbegin\n for i:=1 to n do\n begin\n start:=i;\n finish:=0;\n repeat\n bfs;\n if finish=0 then subx_addy;\n until finish<>0;\n enlager(finish);\n end;\n res:=0;\n for i:=1 to n do\n if MatchX[i]<>0 then\n inc(res,a[i,Matchx[i]]);\n writeln(mm*n - res);\n {for i:=1 to n do\n if MatchX[i]<>0 then\n writeln(i, ' ',MatchX[i]); }\n\nend;\n\nbegin\n docfile;\n init;\n xuli;\nend.\n", "language": "Pascal", "metadata": {"date": 1587429884, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02709.html", "problem_id": "p02709", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02709/input.txt", "sample_output_relpath": "derived/input_output/data/p02709/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02709/Pascal/s572776443.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s572776443", "user_id": "u840460038"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "uses crt,math;\nconst fi='';\n nmax=2000;\n vc=100000000;\ntype data=int64;\nvar\n f:text;\n A:array[0..nmax+1,0..nmax+1] of data;\n Fx,Fy,MatchX,MatchY,tr:array[0..nmax+1] of data;\n Q:array[0..nmax*nmax] of data;\n ddx,ddy:array[0..nmax+1] of boolean;\n dau,cuoi,start,finish:data;\n n:longint;\n mm :data;\n\nprocedure docfile;\nvar u,v,c:data;\n i,j:longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n begin\n read(u);\n for j:=1 to n do begin a[i,j] := u*abs(i-j); mm := max(mm,a[i,j]); end;\n end;\n for i:=1 to n do\n begin\n for j:=1 to n do a[i,j] := mm - a[i,j];\n end;\nend;\n\nprocedure init;\nvar i,j:longint;\nbegin\n fillchar(MatchX,sizeof(matchx),0);\n MatchY:=MatchX;\n\n for i:=1 to n do\n begin\n fx[i]:=vc;\n for j:=1 to n do\n if fx[i]>a[i,j] then\n fx[i]:=a[i,j];\n end;\n for i:=1 to n do\n begin\n fy[i]:=vc;\n for j:=1 to n do\n if a[i,j]-fx[i]0 then\n begin\n ddx[MatchY[i]]:=true;\n ddy[i]:=true;\n end;\n delta:=vc;\n for i:=1 to n do\n if ddx[i] then\n for j:=1 to n do\n if (not ddy[j]) and (delta>get(i,j)) then\n delta:=get(i,j);\n for i:=1 to n do\n begin\n if ddx[i] then fx[i]:=fx[i]+delta;\n if ddy[i] then fy[i]:=fy[i]-delta;\n end;\nend;\n\nprocedure xuli;\nvar res:data;\n i,j:longint;\nbegin\n for i:=1 to n do\n begin\n start:=i;\n finish:=0;\n repeat\n bfs;\n if finish=0 then subx_addy;\n until finish<>0;\n enlager(finish);\n end;\n res:=0;\n for i:=1 to n do\n if MatchX[i]<>0 then\n inc(res,a[i,Matchx[i]]);\n writeln(mm*n - res);\n {for i:=1 to n do\n if MatchX[i]<>0 then\n writeln(i, ' ',MatchX[i]); }\n\nend;\n\nbegin\n docfile;\n init;\n xuli;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "sample_input": "4\n1 3 4 2\n"}, "reference_outputs": ["20\n"], "source_document_id": "p02709", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4322, "cpu_time_ms": 2206, "memory_kb": 31896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s830859649", "group_id": "codeNet:p02709", "input_text": "uses crt,math;\nconst fi='';\n nmax=200;\n vc=100000000;\ntype data=longint;\nvar\n f:text;\n A:array[0..nmax+1,0..nmax+1] of data;\n Fx,Fy,MatchX,MatchY,tr:array[0..nmax+1] of data;\n Q:array[0..nmax*nmax] of data;\n ddx,ddy:array[0..nmax+1] of boolean;\n dau,cuoi,start,finish:data;\n n:data;\n mm :data;\n\nprocedure docfile;\nvar i,j,u,v,c:data;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n begin\n read(u);\n for j:=1 to n do begin a[i,j] := u*abs(i-j); mm := max(mm,a[i,j]); end;\n end;\n for i:=1 to n do\n begin\n for j:=1 to n do a[i,j] := mm - a[i,j];\n end;\nend;\n\nprocedure init;\nvar i,j:data;\nbegin\n fillchar(MatchX,sizeof(matchx),0);\n MatchY:=MatchX;\n\n for i:=1 to n do\n begin\n fx[i]:=vc;\n for j:=1 to n do\n if fx[i]>a[i,j] then\n fx[i]:=a[i,j];\n end;\n for i:=1 to n do\n begin\n fy[i]:=vc;\n for j:=1 to n do\n if a[i,j]-fx[i]0 then\n begin\n ddx[MatchY[i]]:=true;\n ddy[i]:=true;\n end;\n delta:=vc;\n for i:=1 to n do\n if ddx[i] then\n for j:=1 to n do\n if (not ddy[j]) and (delta>get(i,j)) then\n delta:=get(i,j);\n for i:=1 to n do\n begin\n if ddx[i] then fx[i]:=fx[i]+delta;\n if ddy[i] then fy[i]:=fy[i]-delta;\n end;\nend;\n\nprocedure xuli;\nvar i,j,res:data;\nbegin\n for i:=1 to n do\n begin\n start:=i;\n finish:=0;\n repeat\n bfs;\n if finish=0 then subx_addy;\n until finish<>0;\n enlager(finish);\n end;\n res:=0;\n for i:=1 to n do\n if MatchX[i]<>0 then\n inc(res,a[i,Matchx[i]]);\n writeln(mm*n - res);\n {for i:=1 to n do\n if MatchX[i]<>0 then\n writeln(i, ' ',MatchX[i]); }\n\nend;\n\nbegin\n docfile;\n init;\n xuli;\nend.\n", "language": "Pascal", "metadata": {"date": 1587347770, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02709.html", "problem_id": "p02709", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02709/input.txt", "sample_output_relpath": "derived/input_output/data/p02709/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02709/Pascal/s830859649.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s830859649", "user_id": "u840460038"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "uses crt,math;\nconst fi='';\n nmax=200;\n vc=100000000;\ntype data=longint;\nvar\n f:text;\n A:array[0..nmax+1,0..nmax+1] of data;\n Fx,Fy,MatchX,MatchY,tr:array[0..nmax+1] of data;\n Q:array[0..nmax*nmax] of data;\n ddx,ddy:array[0..nmax+1] of boolean;\n dau,cuoi,start,finish:data;\n n:data;\n mm :data;\n\nprocedure docfile;\nvar i,j,u,v,c:data;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n begin\n read(u);\n for j:=1 to n do begin a[i,j] := u*abs(i-j); mm := max(mm,a[i,j]); end;\n end;\n for i:=1 to n do\n begin\n for j:=1 to n do a[i,j] := mm - a[i,j];\n end;\nend;\n\nprocedure init;\nvar i,j:data;\nbegin\n fillchar(MatchX,sizeof(matchx),0);\n MatchY:=MatchX;\n\n for i:=1 to n do\n begin\n fx[i]:=vc;\n for j:=1 to n do\n if fx[i]>a[i,j] then\n fx[i]:=a[i,j];\n end;\n for i:=1 to n do\n begin\n fy[i]:=vc;\n for j:=1 to n do\n if a[i,j]-fx[i]0 then\n begin\n ddx[MatchY[i]]:=true;\n ddy[i]:=true;\n end;\n delta:=vc;\n for i:=1 to n do\n if ddx[i] then\n for j:=1 to n do\n if (not ddy[j]) and (delta>get(i,j)) then\n delta:=get(i,j);\n for i:=1 to n do\n begin\n if ddx[i] then fx[i]:=fx[i]+delta;\n if ddy[i] then fy[i]:=fy[i]-delta;\n end;\nend;\n\nprocedure xuli;\nvar i,j,res:data;\nbegin\n for i:=1 to n do\n begin\n start:=i;\n finish:=0;\n repeat\n bfs;\n if finish=0 then subx_addy;\n until finish<>0;\n enlager(finish);\n end;\n res:=0;\n for i:=1 to n do\n if MatchX[i]<>0 then\n inc(res,a[i,Matchx[i]]);\n writeln(mm*n - res);\n {for i:=1 to n do\n if MatchX[i]<>0 then\n writeln(i, ' ',MatchX[i]); }\n\nend;\n\nbegin\n docfile;\n init;\n xuli;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "sample_input": "4\n1 3 4 2\n"}, "reference_outputs": ["20\n"], "source_document_id": "p02709", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4255, "cpu_time_ms": 100, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s944877803", "group_id": "codeNet:p02712", "input_text": "program main;\nvar n, i: longint;\nsum : int64;\n\nbegin\n readln(n);\n sum := 0;\n for i := 1 to n do\n if not ((i mod 3 = 0) or (i mod 5 = 0))\n then sum := sum + i;\n writeln(sum);\nend.\n", "language": "Pascal", "metadata": {"date": 1596251779, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s944877803.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s944877803", "user_id": "u196718449"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar n, i: longint;\nsum : int64;\n\nbegin\n readln(n);\n sum := 0;\n for i := 1 to n do\n if not ((i mod 3 = 0) or (i mod 5 = 0))\n then sum := sum + i;\n writeln(sum);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 21, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s270012671", "group_id": "codeNet:p02712", "input_text": "program main;\nvar \n\tn : longint;\nbegin\n\treadln(n);\n\twriteln(((1 + n) * n div 2) - (((3 * (n div 3)) + 3) * (n div 3) div 2) -(((5 * (n div 5)) + 5) * (n div 5) div 2) + (((15 * (n div 15)) + 15) * (n div 15) div 2));\nend.", "language": "Pascal", "metadata": {"date": 1596129653, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s270012671.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s270012671", "user_id": "u068203622"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar \n\tn : longint;\nbegin\n\treadln(n);\n\twriteln(((1 + n) * n div 2) - (((3 * (n div 3)) + 3) * (n div 3) div 2) -(((5 * (n div 5)) + 5) * (n div 5) div 2) + (((15 * (n div 15)) + 15) * (n div 15) div 2));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 221, "cpu_time_ms": 7, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s484338143", "group_id": "codeNet:p02712", "input_text": "program train;\nvar \n n, i : longint;\n sum : Int64;\nbegin\n read(n);\n sum := 0;\n for i := 1 to n do \n if not ((i mod 3) = 0) and not ((i mod 5) = 0)\n then sum := sum + i;\n write(sum);\nend. ", "language": "Pascal", "metadata": {"date": 1595959939, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s484338143.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s484338143", "user_id": "u999320099"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program train;\nvar \n n, i : longint;\n sum : Int64;\nbegin\n read(n);\n sum := 0;\n for i := 1 to n do \n if not ((i mod 3) = 0) and not ((i mod 5) = 0)\n then sum := sum + i;\n write(sum);\nend. ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 29, "memory_kb": 1344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s566911311", "group_id": "codeNet:p02712", "input_text": "program FizzBuzzSum;\nvar\n\tn, sum, i : int64; \nbegin\t\n\tsum := 0;\n\treadln(n);\n\ti := 1;\n\twhile i <> n do begin\n\t\tif ( i mod 3 <> 0 )\n\t\t\tthen if ( i mod 5 <> 0 )\n\t\t\t\t\tthen sum := sum + i;\n\t\ti := i + 1;\n\tend;\n\t\t\n\twriteln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595440318, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s566911311.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s566911311", "user_id": "u204635765"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program FizzBuzzSum;\nvar\n\tn, sum, i : int64; \nbegin\t\n\tsum := 0;\n\treadln(n);\n\ti := 1;\n\twhile i <> n do begin\n\t\tif ( i mod 3 <> 0 )\n\t\t\tthen if ( i mod 5 <> 0 )\n\t\t\t\t\tthen sum := sum + i;\n\t\ti := i + 1;\n\tend;\n\t\t\n\twriteln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 29, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s837682129", "group_id": "codeNet:p02712", "input_text": "program main;\nvar N, i, sum : Longint;\n c, b : real;\n A : array[1..1000000] of LongInt;\nbegin\n\tread(N);\n sum := 0;\n for i := 1 to N do begin\n c := frac(i / 3);\n b := frac(i / 5);\n if (c = 0) or (b = 0)\n then A[i] := 0\n else A[i] := i;\n sum := sum + A[i];\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595440313, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s837682129.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s837682129", "user_id": "u384260326"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar N, i, sum : Longint;\n c, b : real;\n A : array[1..1000000] of LongInt;\nbegin\n\tread(N);\n sum := 0;\n for i := 1 to N do begin\n c := frac(i / 3);\n b := frac(i / 5);\n if (c = 0) or (b = 0)\n then A[i] := 0\n else A[i] := i;\n sum := sum + A[i];\n end;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 70, "memory_kb": 4100}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s912788868", "group_id": "codeNet:p02712", "input_text": "program main;\nvar\n n, i : LongInt;\n sum : Int64; \nbegin\n readln(n);\n\n sum := 0;\n for i := 1 to n do\n if not ((i mod 3 = 0) or (i mod 5 = 0)) then\n sum := sum + i;\n\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595383436, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s912788868.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s912788868", "user_id": "u085059942"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar\n n, i : LongInt;\n sum : Int64; \nbegin\n readln(n);\n\n sum := 0;\n for i := 1 to n do\n if not ((i mod 3 = 0) or (i mod 5 = 0)) then\n sum := sum + i;\n\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 27, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s449229360", "group_id": "codeNet:p02712", "input_text": "program main;\nvar\n i,j,k:longint;\n n:longint;\n sum:Int64;\nbegin\n readln(n);\n sum:=0;\n for i:=1 to n do if ((i mod 3) <> 0) and ((i mod 5) <> 0) then sum:=sum+i;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1594879168, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s449229360.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s449229360", "user_id": "u678829637"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar\n i,j,k:longint;\n n:longint;\n sum:Int64;\nbegin\n readln(n);\n sum:=0;\n for i:=1 to n do if ((i mod 3) <> 0) and ((i mod 5) <> 0) then sum:=sum+i;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 22, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s130195728", "group_id": "codeNet:p02712", "input_text": "program main;\nvar\n i,j,k:integer;\n n:integer;\n sum:longint;\nbegin\n readln(n);\n sum:=0;\n for i:=1 to n do if ((i mod 3) <> 0) and ((i mod 5) <> 0) then sum:=sum+i;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1594878731, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s130195728.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s130195728", "user_id": "u678829637"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program main;\nvar\n i,j,k:integer;\n n:integer;\n sum:longint;\nbegin\n readln(n);\n sum:=0;\n for i:=1 to n do if ((i mod 3) <> 0) and ((i mod 5) <> 0) then sum:=sum+i;\n writeln(sum);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 25, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s063104284", "group_id": "codeNet:p02712", "input_text": "var ans,n,i:int64;\n\nbegin\n readln(n);\n ans:=0;\n for i:=1 to n do begin\n if not((i mod 3 =0)or(i mod 5 =0))\n then inc(ans,i);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1586740357, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Pascal/s063104284.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s063104284", "user_id": "u805277811"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "var ans,n,i:int64;\n\nbegin\n readln(n);\n ans:=0;\n for i:=1 to n do begin\n if not((i mod 3 =0)or(i mod 5 =0))\n then inc(ans,i);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 161, "cpu_time_ms": 18, "memory_kb": 1260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s540803042", "group_id": "codeNet:p02715", "input_text": "const M=1000000007;\nfunction power(a,b:int64):int64;\nvar t:int64;\nbegin\nif b=0 then power:=1 else begin\nt:=power(a*a mod M,b div 2);\nif b mod 2=1 then t:=t*a mod M;\npower:=t;\nend;\nend;\nvar\nN,K,i,j:Longint;\nnow,ans:int64;\nmemo:Array[1..100000]of Longint;\nbegin\nread(N,K);\nfor i:=K downto 1 do begin\nnow:=power(K div i,N);\nj:=i+i;\nwhile j<=K do begin\ndec(now,memo[j]);\ninc(j,i);\nend;\nmemo[i]:=(now mod M+M)mod M;\ninc(ans,now*i mod M);\nend;\nwriteln(ans mod M);\nend.", "language": "Pascal", "metadata": {"date": 1586951931, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02715.html", "problem_id": "p02715", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02715/input.txt", "sample_output_relpath": "derived/input_output/data/p02715/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02715/Pascal/s540803042.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s540803042", "user_id": "u657913472"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "const M=1000000007;\nfunction power(a,b:int64):int64;\nvar t:int64;\nbegin\nif b=0 then power:=1 else begin\nt:=power(a*a mod M,b div 2);\nif b mod 2=1 then t:=t*a mod M;\npower:=t;\nend;\nend;\nvar\nN,K,i,j:Longint;\nnow,ans:int64;\nmemo:Array[1..100000]of Longint;\nbegin\nread(N,K);\nfor i:=K downto 1 do begin\nnow:=power(K div i,N);\nj:=i+i;\nwhile j<=K do begin\ndec(now,memo[j]);\ninc(j,i);\nend;\nmemo[i]:=(now mod M+M)mod M;\ninc(ans,now*i mod M);\nend;\nwriteln(ans mod M);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nConsider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).\n\nThere are K^N such sequences. Find the sum of \\gcd(A_1, ..., A_N) over all of them.\n\nSince this sum can be enormous, print the value modulo (10^9+7).\n\nHere \\gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1, ..., A_N.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the sum of \\gcd(A_1, ..., A_N) over all K^N sequences, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)\n=1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\nSample Input 2\n\n3 200\n\nSample Output 2\n\n10813692\n\nSample Input 3\n\n100000 100000\n\nSample Output 3\n\n742202979\n\nBe sure to print the sum modulo (10^9+7).", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02715", "source_text": "Score : 500 points\n\nProblem Statement\n\nConsider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).\n\nThere are K^N such sequences. Find the sum of \\gcd(A_1, ..., A_N) over all of them.\n\nSince this sum can be enormous, print the value modulo (10^9+7).\n\nHere \\gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1, ..., A_N.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the sum of \\gcd(A_1, ..., A_N) over all K^N sequences, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)\n=1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\nSample Input 2\n\n3 200\n\nSample Output 2\n\n10813692\n\nSample Input 3\n\n100000 100000\n\nSample Output 3\n\n742202979\n\nBe sure to print the sum modulo (10^9+7).", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 462, "cpu_time_ms": 53, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s555224877", "group_id": "codeNet:p02716", "input_text": "var\n\tN,i,a,j,ni,nj:Longint;\n\tdp:Array[0..200000,0..3]of int64;\nbegin\nread(N);\nfor i:=0 to N do for j:=0 to 2 do dp[i,j]:=-1000000000000000000;\ndp[0,0]:=0;\nfor i:=0 to N-1 do begin\nread(a);\nfor j:=0 to 2 do begin\nif dp[i+1,j+1]N then ni:=N;\nnj:=j;if i+2=N then inc(nj);\nif dp[ni,nj]N then ni:=N;\nnj:=j;if i+2=N then inc(nj);\nif dp[ni,nj] K - result \n \t\tthen result := K - result;\n writeln(result);\nend.", "language": "Pascal", "metadata": {"date": 1596510377, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s435976559.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s435976559", "user_id": "u303822545"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program hihi;\nvar \n\tN, K, result : int64;\nbegin\n\treadln(N, K);\n result := N mod K;\n if K > K - result \n \t\tthen result := K - result;\n writeln(result);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 166, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s306723579", "group_id": "codeNet:p02719", "input_text": "var\n n,k : integer;\nbegin\n readln(n,k);\n if (n mod k) < (k-(n mod k)) then\n writeln(n mod k)\n else\n writeln(k-(n mod k));\nend.", "language": "Pascal", "metadata": {"date": 1596153231, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s306723579.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s306723579", "user_id": "u678829637"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,k : integer;\nbegin\n readln(n,k);\n if (n mod k) < (k-(n mod k)) then\n writeln(n mod k)\n else\n writeln(k-(n mod k));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 5, "memory_kb": 1364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s220767207", "group_id": "codeNet:p02719", "input_text": "program ReplacingInteger;\nvar\n x, y, z : int64;\nbegin\n readln(x, y);\n if (x mod y < (y - x mod y)) then \n writeln(x mod y)\n else\n writeln((y - x mod y));\nend.", "language": "Pascal", "metadata": {"date": 1596040043, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s220767207.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s220767207", "user_id": "u583992857"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program ReplacingInteger;\nvar\n x, y, z : int64;\nbegin\n readln(x, y);\n if (x mod y < (y - x mod y)) then \n writeln(x mod y)\n else\n writeln((y - x mod y));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 1, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s735451905", "group_id": "codeNet:p02719", "input_text": "program ReplacingInteger;\nvar\n x, y, z : int64;\nbegin\n readln(x, y);\n if (x > y) then begin\n if (x mod y = 0) then \n writeln(0)\n else begin\n z := x div y;\n if (x mod y < abs(x mod y - y)) then \n writeln(x mod y)\n else\n writeln(abs(x mod y - y));\n end;\n end\n else begin\n if (x < y) then\n writeln(abs(x))\n else if (x = y) then\n writeln(0);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1596033708, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s735451905.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s735451905", "user_id": "u583992857"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program ReplacingInteger;\nvar\n x, y, z : int64;\nbegin\n readln(x, y);\n if (x > y) then begin\n if (x mod y = 0) then \n writeln(0)\n else begin\n z := x div y;\n if (x mod y < abs(x mod y - y)) then \n writeln(x mod y)\n else\n writeln(abs(x mod y - y));\n end;\n end\n else begin\n if (x < y) then\n writeln(abs(x))\n else if (x = y) then\n writeln(0);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 545, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s566425494", "group_id": "codeNet:p02719", "input_text": "program main;\n\nvar\n\tx, y : int64;\n \nfunction min(x : int64; y : int64) : int64;\nbegin\n\tif x <= y then min := x\n else min := y;\nend;\n \nbegin\n\treadln(x, y);\n x := x mod y;\n writeln(min(x, y - x));\nend.", "language": "Pascal", "metadata": {"date": 1595991628, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Pascal/s566425494.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s566425494", "user_id": "u838994261"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main;\n\nvar\n\tx, y : int64;\n \nfunction min(x : int64; y : int64) : int64;\nbegin\n\tif x <= y then min := x\n else min := y;\nend;\n \nbegin\n\treadln(x, y);\n x := x mod y;\n writeln(min(x, y - x));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 214, "cpu_time_ms": 7, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s200539946", "group_id": "codeNet:p02720", "input_text": "program main;\n \nvar\n\tn, i, sum : int64;\n \nbegin\n\tsum := 0;\n\treadln(n);\n for i := 1 to n do begin\n \tif (i mod 3 <> 0) and (i mod 5 <> 0)\n \t\tthen sum := sum + i;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1595990486, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Pascal/s200539946.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s200539946", "user_id": "u838994261"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program main;\n \nvar\n\tn, i, sum : int64;\n \nbegin\n\tsum := 0;\n\treadln(n);\n for i := 1 to n do begin\n \tif (i mod 3 <> 0) and (i mod 5 <> 0)\n \t\tthen sum := sum + i;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 202, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s857393400", "group_id": "codeNet:p02720", "input_text": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..12,0..1,0..9]of Longint;\n\tdpz:Array[1..12,0..1]of Longint;\n\tS:String;\n\tls,i,j,k,l,nj,lim,sum,llim,rlim:Longint;\nbegin\n\tS:='';\n\twhile T>0 do begin\n\t\tS:=Chr(T mod 10+48)+S;\n\t\tT:=T div 10;\n\tend;\n\tls:=length(S);\n\tfor i:=1 to ls+1 do for j:=0 to 1 do begin\n\t\tfor k:=0 to 9 do dp[i,j,k]:=0;\n\t\tdpz[i,j]:=0;\n\tend;\n\tdpz[1,0]:=1;\n\tfor i:=1 to ls do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tinc(dpz[i+1,1],dpz[i,j]);\n\t\t\tfor l:=1 to lim do begin\n\t\t\t\tnj:=j;\n\t\t\t\tif llim then rlim:=lim;\n\t\t\t\tfor l:=llim to rlim do begin\n\t\t\t\t\tnj:=j;\n\t\t\t\t\tif l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "language": "Pascal", "metadata": {"date": 1586054342, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Pascal/s857393400.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s857393400", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..12,0..1,0..9]of Longint;\n\tdpz:Array[1..12,0..1]of Longint;\n\tS:String;\n\tls,i,j,k,l,nj,lim,sum,llim,rlim:Longint;\nbegin\n\tS:='';\n\twhile T>0 do begin\n\t\tS:=Chr(T mod 10+48)+S;\n\t\tT:=T div 10;\n\tend;\n\tls:=length(S);\n\tfor i:=1 to ls+1 do for j:=0 to 1 do begin\n\t\tfor k:=0 to 9 do dp[i,j,k]:=0;\n\t\tdpz[i,j]:=0;\n\tend;\n\tdpz[1,0]:=1;\n\tfor i:=1 to ls do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tinc(dpz[i+1,1],dpz[i,j]);\n\t\t\tfor l:=1 to lim do begin\n\t\t\t\tnj:=j;\n\t\t\t\tif llim then rlim:=lim;\n\t\t\t\tfor l:=llim to rlim do begin\n\t\t\t\t\tnj:=j;\n\t\t\t\t\tif l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1109, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s549609479", "group_id": "codeNet:p02720", "input_text": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..15,0..1,0..1,0..9]of Longint;\n\tS:String;\n\ti,j,k,l,nj,lim,sum,z,llim,rlim:Longint;\nbegin\n\tS:='';\n\twhile T>0 do begin\n\t\tS:=Chr(T mod 10+48)+S;\n\t\tT:=T div 10;\n\tend;\n\tfor i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;\n\tdp[1,0,1,0]:=1;\n\tfor i:=1 to length(S) do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tinc(dp[i+1,1,1,0],dp[i,j,1,0]);\n\t\t\tfor l:=1 to lim do begin\n\t\t\t\tnj:=j;\n\t\t\t\tif llim then rlim:=lim;\n\t\t\t\tfor l:=llim to rlim do begin\n\t\t\t\t\tnj:=j;\n\t\t\t\t\tif l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "language": "Pascal", "metadata": {"date": 1586054113, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Pascal/s549609479.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549609479", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..15,0..1,0..1,0..9]of Longint;\n\tS:String;\n\ti,j,k,l,nj,lim,sum,z,llim,rlim:Longint;\nbegin\n\tS:='';\n\twhile T>0 do begin\n\t\tS:=Chr(T mod 10+48)+S;\n\t\tT:=T div 10;\n\tend;\n\tfor i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;\n\tdp[1,0,1,0]:=1;\n\tfor i:=1 to length(S) do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tinc(dp[i+1,1,1,0],dp[i,j,1,0]);\n\t\t\tfor l:=1 to lim do begin\n\t\t\t\tnj:=j;\n\t\t\t\tif llim then rlim:=lim;\n\t\t\t\tfor l:=llim to rlim do begin\n\t\t\t\t\tnj:=j;\n\t\t\t\t\tif l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1094, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s833674324", "group_id": "codeNet:p02720", "input_text": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..15,0..1,0..1,0..9]of Longint;\n\tS:String;\n\ti,j,k,l,nj,lim,sum,z,llim,rlim:Longint;\nbegin\n\tStr(T,S);\n\tfor i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;\n\tdp[1,0,1,0]:=1;\n\tfor i:=1 to length(S) do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tinc(dp[i+1,1,1,0],dp[i,j,1,0]);\n\t\t\tfor l:=1 to lim do begin\n\t\t\t\tnj:=j;\n\t\t\t\tif llim then rlim:=lim;\n\t\t\t\tfor l:=llim to rlim do begin\n\t\t\t\t\tnj:=j;\n\t\t\t\t\tif l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "language": "Pascal", "metadata": {"date": 1586054030, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Pascal/s833674324.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s833674324", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..15,0..1,0..1,0..9]of Longint;\n\tS:String;\n\ti,j,k,l,nj,lim,sum,z,llim,rlim:Longint;\nbegin\n\tStr(T,S);\n\tfor i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;\n\tdp[1,0,1,0]:=1;\n\tfor i:=1 to length(S) do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tinc(dp[i+1,1,1,0],dp[i,j,1,0]);\n\t\t\tfor l:=1 to lim do begin\n\t\t\t\tnj:=j;\n\t\t\t\tif llim then rlim:=lim;\n\t\t\t\tfor l:=llim to rlim do begin\n\t\t\t\t\tnj:=j;\n\t\t\t\t\tif l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1031, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s085977613", "group_id": "codeNet:p02720", "input_text": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..15,0..1,0..1,0..9]of Longint;\n\tS:String;\n\ti,j,k,l,nj,lim,sum,z,nz:Longint;\nbegin\n\tStr(T,S);\n\tfor i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;\n\tdp[1,0,1,0]:=1;\n\tfor i:=1 to length(S) do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tfor z:=0 to 1 do for k:=0 to 9 do begin\n\t\t\t\tfor l:=0 to lim do begin\n\t\t\t\t\tif(z<>1)and((k1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "language": "Pascal", "metadata": {"date": 1586053756, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Pascal/s085977613.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s085977613", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "var\n\tK:Longint;\n\tL,R,M:int64;\nfunction check(T:int64):Longint;\nvar\n\tdp:Array[1..15,0..1,0..1,0..9]of Longint;\n\tS:String;\n\ti,j,k,l,nj,lim,sum,z,nz:Longint;\nbegin\n\tStr(T,S);\n\tfor i:=1 to length(S)+1 do for j:=0 to 1 do for z:=0 to 1 do for k:=0 to 9 do dp[i,j,z,k]:=0;\n\tdp[1,0,1,0]:=1;\n\tfor i:=1 to length(S) do begin\n\t\tfor j:=0 to 1 do begin\n\t\t\tif j=0 then lim:=ord(S[i])-48 else lim:=9;\n\t\t\tfor z:=0 to 1 do for k:=0 to 9 do begin\n\t\t\t\tfor l:=0 to lim do begin\n\t\t\t\t\tif(z<>1)and((k1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif check(M)>=K then R:=M else L:=M;\n\tend;\n\twriteln(R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 907, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s721616263", "group_id": "codeNet:p02721", "input_text": "var\n\tS:String;\n\tN,K,C,i,now:Longint;\n\tL:Array[1..200000]of Longint;\n\tX:Array[1..200000]of Boolean;\nbegin\n\treadln(N,K,C);\n\treadln(S);\n\ti:=1;now:=0;\n\twhile i<=N do begin\n\t\tif S[i]='o'then begin\n\t\t\tinc(now);\n\t\t\tL[now]:=i;\n\t\t\tinc(i,C);\n\t\tend;\n\t\tinc(i);\n\tend;\n\ti:=N;now:=0;\n\twhile i>=1 do begin\n\t\tif S[i]='o'then begin\n\t\t\tinc(now);\n\t\t\tif L[now]=i then X[i]:=True;\n\t\t\tdec(i,C);\n\t\tend;\n\t\tdec(i);\n\tend;\n\tfor i:=1 to N do if X[i]then writeln(i);\nend.\n", "language": "Pascal", "metadata": {"date": 1586063069, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02721.html", "problem_id": "p02721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02721/input.txt", "sample_output_relpath": "derived/input_output/data/p02721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02721/Pascal/s721616263.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s721616263", "user_id": "u657913472"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\tS:String;\n\tN,K,C,i,now:Longint;\n\tL:Array[1..200000]of Longint;\n\tX:Array[1..200000]of Boolean;\nbegin\n\treadln(N,K,C);\n\treadln(S);\n\ti:=1;now:=0;\n\twhile i<=N do begin\n\t\tif S[i]='o'then begin\n\t\t\tinc(now);\n\t\t\tL[now]:=i;\n\t\t\tinc(i,C);\n\t\tend;\n\t\tinc(i);\n\tend;\n\ti:=N;now:=0;\n\twhile i>=1 do begin\n\t\tif S[i]='o'then begin\n\t\t\tinc(now);\n\t\t\tif L[now]=i then X[i]:=True;\n\t\t\tdec(i,C);\n\t\tend;\n\t\tdec(i);\n\tend;\n\tfor i:=1 to N do if X[i]then writeln(i);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "sample_input": "11 3 2\nooxxxoxxxoo\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02721", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 2, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s448539315", "group_id": "codeNet:p02722", "input_text": "function check(N,x:int64):Boolean;\nbegin\nif x=1 then check:=False else begin\nwhile N mod x=0 do N:=N div x;\ncheck:=N mod x=1;\nend;\nend;\nfunction calc(N,M:int64):Longint;\nvar cnt:Longint;i:int64;\nbegin\ni:=1;\nwhile i*i<=M do begin\nif M mod i=0 then begin\nif check(N,i)then inc(cnt);\nif(i*ix[b];\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(x[i],d[i]);\n\t\tid[i]:=i;\n\tend;\n\tsort(id,n);\n\tj:=1;\n\tv[1]:=2000000000;\n\tw[1]:=1;\n\tr:=1;\n\tfor i:=1 to n do begin\n\t\twhile v[j]x[b];\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(x[i],d[i]);\n\t\tid[i]:=i;\n\tend;\n\tsort(id,n);\n\tj:=1;\n\tv[1]:=2000000000;\n\tw[1]:=1;\n\tr:=1;\n\tfor i:=1 to n do begin\n\t\twhile v[j]uf.pr[b] then begin\n\t\t\tinc(uf.pr[b],uf.pr[a]);\n\t\t\tuf.pr[a]:=b;\n\t\tend else begin\n\t\t\tinc(uf.pr[a],uf.pr[b]);\n\t\t\tuf.pr[b]:=a;\n\t\tend;\n\t\tunite:=true;\n\tend;\nend;\nfunction size(var uf:UnionFind;a:Longint):Longint;\nbegin\n\tsize:=-uf.pr[find(uf,a)];\nend;\nvar\n\tU,V,suc,beg:Array[1..400000]of Longint;\n\tN,M,K,i,id,a,b,ec,ans:Longint;\n\tuf:UnionFind;\nprocedure add_edge(a,b:Longint);\nbegin\n\tinc(ec);\n\tU[ec]:=a;\n\tV[ec]:=b;\n\tsuc[ec]:=beg[a];\n\tbeg[a]:=ec;\nend;\nbegin\n\tread(N,M,K);\n\tinit(uf,N);\n\tfor i:=1 to M do begin\n\t\tread(a,b);\n\t\tadd_edge(a,b);\n\t\tadd_edge(b,a);\n\t\tunite(uf,a,b);\n\tend;\n\tfor i:=1 to K do begin\n\t\tread(a,b);\n\t\tadd_edge(a,b);\n\t\tadd_edge(b,a);\n\tend;\n\tfor i:=1 to N do begin\n\t\tans:=size(uf,i)-1;\n\t\tid:=beg[i];\n\t\twhile id>0 do begin\n\t\t\tif same(uf,i,V[id]) then dec(ans);\n\t\t\tid:=suc[id];\n\t\tend;\n\t\twriteln(ans);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1583238808, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02762.html", "problem_id": "p02762", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02762/input.txt", "sample_output_relpath": "derived/input_output/data/p02762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02762/Pascal/s109155738.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s109155738", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0 1 0 1\n", "input_to_evaluate": "type UnionFind=record n:Longint;pr:Array of Longint;end;\nprocedure init(var uf:UnionFind;N:Longint);\nvar i:Longint;\nbegin\n\tuf.n:=N;\n\tsetlength(uf.pr,N);\n\tfor i:=1 to N do uf.pr[i]:=-1;\nend;\nfunction find(var uf:UnionFind;a:Longint):Longint;\nbegin\n\tif uf.pr[a]<0 then find:=a else begin\n\t\tuf.pr[a]:=find(uf,uf.pr[a]);\n\t\tfind:=uf.pr[a];\n\tend;\nend;\nfunction same(var uf:UnionFind;a,b:Longint):Boolean;\nbegin\n\tsame:=find(uf,a)=find(uf,b);\nend;\nfunction unite(var uf:UnionFind;a,b:Longint):Boolean;\nbegin\n\ta:=find(uf,a);\n\tb:=find(uf,b);\n\tif a=b then unite:=false else begin\n\t\tif uf.pr[a]>uf.pr[b] then begin\n\t\t\tinc(uf.pr[b],uf.pr[a]);\n\t\t\tuf.pr[a]:=b;\n\t\tend else begin\n\t\t\tinc(uf.pr[a],uf.pr[b]);\n\t\t\tuf.pr[b]:=a;\n\t\tend;\n\t\tunite:=true;\n\tend;\nend;\nfunction size(var uf:UnionFind;a:Longint):Longint;\nbegin\n\tsize:=-uf.pr[find(uf,a)];\nend;\nvar\n\tU,V,suc,beg:Array[1..400000]of Longint;\n\tN,M,K,i,id,a,b,ec,ans:Longint;\n\tuf:UnionFind;\nprocedure add_edge(a,b:Longint);\nbegin\n\tinc(ec);\n\tU[ec]:=a;\n\tV[ec]:=b;\n\tsuc[ec]:=beg[a];\n\tbeg[a]:=ec;\nend;\nbegin\n\tread(N,M,K);\n\tinit(uf,N);\n\tfor i:=1 to M do begin\n\t\tread(a,b);\n\t\tadd_edge(a,b);\n\t\tadd_edge(b,a);\n\t\tunite(uf,a,b);\n\tend;\n\tfor i:=1 to K do begin\n\t\tread(a,b);\n\t\tadd_edge(a,b);\n\t\tadd_edge(b,a);\n\tend;\n\tfor i:=1 to N do begin\n\t\tans:=size(uf,i)-1;\n\t\tid:=beg[i];\n\t\twhile id>0 do begin\n\t\t\tif same(uf,i,V[id]) then dec(ans);\n\t\t\tid:=suc[id];\n\t\tend;\n\t\twriteln(ans);\n\tend;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "sample_input": "4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n"}, "reference_outputs": ["0 1 0 1\n"], "source_document_id": "p02762", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1400, "cpu_time_ms": 78, "memory_kb": 7040}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s197378975", "group_id": "codeNet:p02764", "input_text": "uses Math;\nvar\n\tN,K,i,j:Longint;\n\tx,y,c:Array[1..60]of Longint;\n\trr:Array[1..60]of double;\n\tL,R,M,a,t,d,ri,rj,yy:double;\n\tflag:Boolean;\nfunction count(tx,ty:double):Boolean;\nvar i,cnt:Longint;\nbegin\n\tcnt:=0;\n\tfor i:=1 to N do if sqr(X[i]-tx)+sqr(Y[i]-ty)=K;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(x[i],y[i],c[i]);\n\tL:=0;\n\tR:=100000;\n\twhile R-L>0.000001 do begin\n\t\tM:=(L+R)/2;\n\t\tfor i:=1 to N do rr[i]:=M/c[i];\n\t\tflag:=False;\n\t\tfor i:=1 to N do begin\n\t\t\tif count(X[i],Y[i])then begin\n\t\t\t\tflag:=True;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then begin\n\t\t\tfor i:=2 to N do begin\n\t\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\t\td:=sqr(X[i]-X[j])+sqr(Y[i]-Y[j]);\n\t\t\t\t\tri:=rr[i];\n\t\t\t\t\trj:=rr[j];\n\t\t\t\t\tyy:=4*sqr(ri)*d-sqr(sqr(ri)+d-sqr(rj));\n\t\t\t\t\tif yy<0 then continue;\n\t\t\t\t\ta:=arctan2(sqrt(yy),sqr(ri)+d-sqr(rj));\n\t\t\t\t\tt:=arctan2(Y[j]-Y[i],X[j]-X[i]);\n\t\t\t\t\tif count(X[i]+ri*cos(t+a),Y[i]+ri*sin(t+a)) then flag:=True\n\t\t\t\t\telse if count(X[i]+ri*cos(t-a),Y[i]+ri*sin(t-a))then flag:=True;\n\t\t\t\t\tif flag then break;\n\t\t\t\tend;\n\t\t\t\tif flag then break;\n\t\t\tend;\n\t\tend;\n\t\tif flag then R:=M else L:=M;\n\tend;\n\twriteln(R:0:9);\nend.\n", "language": "Pascal", "metadata": {"date": 1583239672, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02764.html", "problem_id": "p02764", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02764/input.txt", "sample_output_relpath": "derived/input_output/data/p02764/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02764/Pascal/s197378975.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s197378975", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2.4\n", "input_to_evaluate": "uses Math;\nvar\n\tN,K,i,j:Longint;\n\tx,y,c:Array[1..60]of Longint;\n\trr:Array[1..60]of double;\n\tL,R,M,a,t,d,ri,rj,yy:double;\n\tflag:Boolean;\nfunction count(tx,ty:double):Boolean;\nvar i,cnt:Longint;\nbegin\n\tcnt:=0;\n\tfor i:=1 to N do if sqr(X[i]-tx)+sqr(Y[i]-ty)=K;\nend;\nbegin\n\tread(N,K);\n\tfor i:=1 to N do read(x[i],y[i],c[i]);\n\tL:=0;\n\tR:=100000;\n\twhile R-L>0.000001 do begin\n\t\tM:=(L+R)/2;\n\t\tfor i:=1 to N do rr[i]:=M/c[i];\n\t\tflag:=False;\n\t\tfor i:=1 to N do begin\n\t\t\tif count(X[i],Y[i])then begin\n\t\t\t\tflag:=True;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then begin\n\t\t\tfor i:=2 to N do begin\n\t\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\t\td:=sqr(X[i]-X[j])+sqr(Y[i]-Y[j]);\n\t\t\t\t\tri:=rr[i];\n\t\t\t\t\trj:=rr[j];\n\t\t\t\t\tyy:=4*sqr(ri)*d-sqr(sqr(ri)+d-sqr(rj));\n\t\t\t\t\tif yy<0 then continue;\n\t\t\t\t\ta:=arctan2(sqrt(yy),sqr(ri)+d-sqr(rj));\n\t\t\t\t\tt:=arctan2(Y[j]-Y[i],X[j]-X[i]);\n\t\t\t\t\tif count(X[i]+ri*cos(t+a),Y[i]+ri*sin(t+a)) then flag:=True\n\t\t\t\t\telse if count(X[i]+ri*cos(t-a),Y[i]+ri*sin(t-a))then flag:=True;\n\t\t\t\t\tif flag then break;\n\t\t\t\tend;\n\t\t\t\tif flag then break;\n\t\t\tend;\n\t\tend;\n\t\tif flag then R:=M else L:=M;\n\tend;\n\twriteln(R:0:9);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "sample_input": "4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n"}, "reference_outputs": ["2.4\n"], "source_document_id": "p02764", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1157, "cpu_time_ms": 33, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s380574775", "group_id": "codeNet:p02775", "input_text": "var\n a:array[0..10] of longint=(0,1,2,3,4,5,5,4,3,2,1);\n str:ansistring;\n f,ff,ans,anss:array[-100..1000005] of longint;\n i,len:longint;\nfunction min(x,y:int64):int64;\nbegin\n if (x=10) and (B<=10) and (S<>T) then begin\nif U=S then A:=A-1;\nif T=S then B:=B-1;\nend;\n\nwriteln (A,B);\n\nend.", "language": "Pascal", "metadata": {"date": 1600267884, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s480612965.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s480612965", "user_id": "u529554074"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar S,T,U : string;\nvar A,B : integer;\nbegin\nreadln (S,T);\nreadln (A,B);\nreadln (U);\n\nif (A>=10) and (B<=10) and (S<>T) then begin\nif U=S then A:=A-1;\nif T=S then B:=B-1;\nend;\n\nwriteln (A,B);\n\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 211, "cpu_time_ms": 4, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s667177693", "group_id": "codeNet:p02777", "input_text": "program main;\nvar S,T,U : string;\nvar A,B : integer;\nbegin\nreadln (S,T);\nreadln (A,B);\nreadln (U);\n\nif (A>=10) and (B<=10) then begin\nif U=S then A:=A-1;\nif T=S then B:=B-1;\nend;\n\nwriteln (A,B);\n\nend.", "language": "Pascal", "metadata": {"date": 1600267806, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s667177693.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s667177693", "user_id": "u529554074"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar S,T,U : string;\nvar A,B : integer;\nbegin\nreadln (S,T);\nreadln (A,B);\nreadln (U);\n\nif (A>=10) and (B<=10) then begin\nif U=S then A:=A-1;\nif T=S then B:=B-1;\nend;\n\nwriteln (A,B);\n\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 200, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s818119073", "group_id": "codeNet:p02777", "input_text": "program main;\nvar s,t,u: string ;\na,b : integer;\n \nbegin\nreadln(s,t);\nreadln(a,b);\nreadln(u);\n \nif (u=s) then \na:=a-1;\n \nif (u=t) then \nb:=b-1;\n \nwriteln(a,b);\n \nend. \n ", "language": "Pascal", "metadata": {"date": 1600267731, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s818119073.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s818119073", "user_id": "u880893396"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar s,t,u: string ;\na,b : integer;\n \nbegin\nreadln(s,t);\nreadln(a,b);\nreadln(u);\n \nif (u=s) then \na:=a-1;\n \nif (u=t) then \nb:=b-1;\n \nwriteln(a,b);\n \nend. \n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 3, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s926077339", "group_id": "codeNet:p02777", "input_text": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u) then\n a := a - 1;\n if(s <> u) then \n b := b - 1;\n write(a,' ');\n writeln(b);\nend. ", "language": "Pascal", "metadata": {"date": 1600267689, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s926077339.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s926077339", "user_id": "u212944395"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u) then\n a := a - 1;\n if(s <> u) then \n b := b - 1;\n write(a,' ');\n writeln(b);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s823795344", "group_id": "codeNet:p02777", "input_text": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u) then begin\n a := a - 1;\n end;\n if(t = u) then begin\n b := b - 1;\n end;\n write(a,' ');\n writeln(b);\nend. ", "language": "Pascal", "metadata": {"date": 1600267566, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s823795344.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s823795344", "user_id": "u212944395"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u) then begin\n a := a - 1;\n end;\n if(t = u) then begin\n b := b - 1;\n end;\n write(a,' ');\n writeln(b);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 250, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s685170812", "group_id": "codeNet:p02777", "input_text": "program main;\nvar \n r,b,i : string;\n rn,bn,j : integer;\nbegin \n readln(r);\n for j := 1 to length(r) do \n if r[j] = ' ' then \n begin\n r := copy(r,1,j-1);\n b := copy(r,j,(length(r)-j));\n end;\n readln(rn,bn);\n readln(i);\n if ( i = r ) then \n writeln(rn-1,' ',bn)\n else \n writeln(rn,' ',bn-1);\nend.", "language": "Pascal", "metadata": {"date": 1600267256, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s685170812.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s685170812", "user_id": "u743163683"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar \n r,b,i : string;\n rn,bn,j : integer;\nbegin \n readln(r);\n for j := 1 to length(r) do \n if r[j] = ' ' then \n begin\n r := copy(r,1,j-1);\n b := copy(r,j,(length(r)-j));\n end;\n readln(rn,bn);\n readln(i);\n if ( i = r ) then \n writeln(rn-1,' ',bn)\n else \n writeln(rn,' ',bn-1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 391, "cpu_time_ms": 2, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s510432272", "group_id": "codeNet:p02777", "input_text": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u)\n \tthen a := a - 1;\n if(t = u)\n \tthen b := b - 1;\n write(a,b);\nend. ", "language": "Pascal", "metadata": {"date": 1600267232, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s510432272.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s510432272", "user_id": "u212944395"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar a,b : integer;\n\ts,t,u : string;\nbegin\n\treadln(s,t);\n readln(a,b);\n readln(u);\n if(s = u)\n \tthen a := a - 1;\n if(t = u)\n \tthen b := b - 1;\n write(a,b);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 4, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s503119410", "group_id": "codeNet:p02777", "input_text": "program main;\nvar\n n, c, s, t : string;\n a, b : longint;\n\n\nbegin\n readln(n);\n readln(a, b);\n readln(c);\n s := copy(n, 1, pos(' ', n)-1); \n t := copy(n, pos(' ', n)+1, length(n));\n if (c = s) then dec(a)\n else if (c = t) then dec(b);\n writeln(a, ' ', b);\nend.", "language": "Pascal", "metadata": {"date": 1600265607, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Pascal/s503119410.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503119410", "user_id": "u122156580"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main;\nvar\n n, c, s, t : string;\n a, b : longint;\n\n\nbegin\n readln(n);\n readln(a, b);\n readln(c);\n s := copy(n, 1, pos(' ', n)-1); \n t := copy(n, pos(' ', n)+1, length(n));\n if (c = s) then dec(a)\n else if (c = t) then dec(b);\n writeln(a, ' ', b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 6, "memory_kb": 1292}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s504074306", "group_id": "codeNet:p02779", "input_text": "Var n,i,x:longint;\n a:array[0..1000000000] of boolean;\nBegin{main}\n read(n);\n for i:=1 to n do\n begin\n read(x);\n if a[x] then begin write('NO');exit;end;\n a[x]:=true;\n end; \n write('YES');\nEnd.", "language": "Pascal", "metadata": {"date": 1583862655, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Pascal/s504074306.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504074306", "user_id": "u519460719"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "Var n,i,x:longint;\n a:array[0..1000000000] of boolean;\nBegin{main}\n read(n);\n for i:=1 to n do\n begin\n read(x);\n if a[x] then begin write('NO');exit;end;\n a[x]:=true;\n end; \n write('YES');\nEnd.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 450, "memory_kb": 975104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s461757405", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x :integer;\nbegin\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "language": "Pascal", "metadata": {"date": 1600268284, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s461757405.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s461757405", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x :integer;\nbegin\n readln(H,A);\n x:=H div A;\n if H mod A=0 then \n writeln(x)\n else writeln(x+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 138, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s326154230", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x :integer;\nbegin\n x:=0;\n readln(H,A);\n if H mod A=0 then \n writeln(H div A)\n else writeln((H div A)+1);\nend.", "language": "Pascal", "metadata": {"date": 1600268013, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s326154230.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s326154230", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x :integer;\nbegin\n x:=0;\n readln(H,A);\n if H mod A=0 then \n writeln(H div A)\n else writeln((H div A)+1);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s354574714", "group_id": "codeNet:p02783", "input_text": "program main;\nvar H,A,x :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=(H div A)+1;\n writeln(x);\nend.\n ", "language": "Pascal", "metadata": {"date": 1600267084, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s354574714.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s354574714", "user_id": "u728129883"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar H,A,x :integer;\nbegin\n x:=0;\n readln(H,A);\n x:=(H div A)+1;\n writeln(x);\nend.\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 112, "cpu_time_ms": 5, "memory_kb": 1340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s857682365", "group_id": "codeNet:p02783", "input_text": "program main;\nvar h , a , count : integer;\nbegin\n\treadln(h,a);\n repeat\n \th := h - a;\n count := count + 1;\n until(h < 0);\n writeln(count);\nend. ", "language": "Pascal", "metadata": {"date": 1600266912, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s857682365.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s857682365", "user_id": "u212944395"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar h , a , count : integer;\nbegin\n\treadln(h,a);\n repeat\n \th := h - a;\n count := count + 1;\n until(h < 0);\n writeln(count);\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 7, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s712479134", "group_id": "codeNet:p02783", "input_text": "program hi;\nvar\n\th, a, n : longint;\n\nbegin\n readln(h, a);\n n := h div a;\n if (h mod a <> 0) then \n \tinc(n);\n writeln(n);\nend.", "language": "Pascal", "metadata": {"date": 1600266635, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s712479134.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s712479134", "user_id": "u051422473"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program hi;\nvar\n\th, a, n : longint;\n\nbegin\n readln(h, a);\n n := h div a;\n if (h mod a <> 0) then \n \tinc(n);\n writeln(n);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 3, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s238587721", "group_id": "codeNet:p02783", "input_text": "program main;\nvar \n a,b : integer;\nbegin \n readln(a,b);\n if ( a mod b ) <> 0 then\n writeln((a div b) + 1)\n else\n if ( a > b ) then \n writeln('1')\n else\n writeln( a mod b );\nend. ", "language": "Pascal", "metadata": {"date": 1600266532, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s238587721.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s238587721", "user_id": "u743163683"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar \n a,b : integer;\nbegin \n readln(a,b);\n if ( a mod b ) <> 0 then\n writeln((a div b) + 1)\n else\n if ( a > b ) then \n writeln('1')\n else\n writeln( a mod b );\nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s442866784", "group_id": "codeNet:p02783", "input_text": "program main;\nvar h,a,output: integer;\n\nbegin \nreadln(h,a);\noutput:=0;\nrepeat \nh:=h-a;\noutput:=output+1;\nuntil (h<=0);\nend.", "language": "Pascal", "metadata": {"date": 1600265682, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Pascal/s442866784.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s442866784", "user_id": "u880893396"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main;\nvar h,a,output: integer;\n\nbegin \nreadln(h,a);\noutput:=0;\nrepeat \nh:=h-a;\noutput:=output+1;\nuntil (h<=0);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 1, "memory_kb": 1292}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s805725293", "group_id": "codeNet:p02784", "input_text": "var\n\tsum,i,h,a:longint;\n arr:array of Integer;\nbegin\n\tread(h,a);\n\tSetLength(arr, a);\n sum := 0;\n for i := Low(arr) to High(arr) do begin\n read(arr[i]); \n sum := sum + arr[i];\n end;\n \n begin\n if sum > h then\n \twrite('Yes')\n else\n write('No');\n end;\nend.", "language": "Pascal", "metadata": {"date": 1581270951, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s805725293.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s805725293", "user_id": "u663819790"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tsum,i,h,a:longint;\n arr:array of Integer;\nbegin\n\tread(h,a);\n\tSetLength(arr, a);\n sum := 0;\n for i := Low(arr) to High(arr) do begin\n read(arr[i]); \n sum := sum + arr[i];\n end;\n \n begin\n if sum > h then\n \twrite('Yes')\n else\n write('No');\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 311, "cpu_time_ms": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s652289227", "group_id": "codeNet:p02784", "input_text": "var\n\tsum,i,h,a:longint;\n arr:array of Integer;\nbegin\n\tread(h,a);\n\tSetLength(arr, a);\n sum := 0;\n for i := Low(arr) to High(arr) do begin\n read(arr[i]); // 値を入れ込む\n sum := sum + arr[i]; // 配列の値の 合計値\n end;\n \n begin\n if sum > h then\n \twriteln('Yes')\n else\n writeln('No');\n end;\n\nend.", "language": "Pascal", "metadata": {"date": 1581270774, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s652289227.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s652289227", "user_id": "u663819790"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tsum,i,h,a:longint;\n arr:array of Integer;\nbegin\n\tread(h,a);\n\tSetLength(arr, a);\n sum := 0;\n for i := Low(arr) to High(arr) do begin\n read(arr[i]); // 値を入れ込む\n sum := sum + arr[i]; // 配列の値の 合計値\n end;\n \n begin\n if sum > h then\n \twriteln('Yes')\n else\n writeln('No');\n end;\n\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 368, "cpu_time_ms": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s242357381", "group_id": "codeNet:p02784", "input_text": "var i, n, k, S, v:Longint;\nbegin\n S := 0;\n read(k, n);\n for i := 1 to K do\n begin\n read(v);\n S := S + v;\n if S >= k then\n begin\n writeln('Yes');\n exit;\n end;\n end;\n writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1580073979, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Pascal/s242357381.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s242357381", "user_id": "u394853232"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i, n, k, S, v:Longint;\nbegin\n S := 0;\n read(k, n);\n for i := 1 to K do\n begin\n read(v);\n S := S + v;\n if S >= k then\n begin\n writeln('Yes');\n exit;\n end;\n end;\n writeln('No');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s078829271", "group_id": "codeNet:p02791", "input_text": "var N,i,p,a,c:Longint;\nbegin\nread(N);\np:=N+1;\nfor i:=1 to N do begin\nread(a);\nif p>a then begin\np:=a;\ninc(c);\nend;\nend;\nwriteln(c);\nend.\n", "language": "Pascal", "metadata": {"date": 1582009410, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Pascal/s078829271.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s078829271", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var N,i,p,a,c:Longint;\nbegin\nread(N);\np:=N+1;\nfor i:=1 to N do begin\nread(a);\nif p>a then begin\np:=a;\ninc(c);\nend;\nend;\nwriteln(c);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 24, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s969360994", "group_id": "codeNet:p02806", "input_text": "var\n\tN,ans,i,id:Longint;\n\tt:Array[1..50]of Longint;\n\ts:Array[1..50]of String;\n\tx,inp:String;\n\tflag:Boolean;\nbegin\n\treadln(N);\n\tfor i:=1 to N do begin\n\t\treadln(inp);\n\t\tid:=1;\n\t\twhile inp[id]<>' 'do inc(id);\n\t\ts[i]:=copy(inp,1,id-1);\n\t\tt[i]:=0;\n\t\tinc(id);\n\t\twhile id<=length(inp)do begin\n\t\t\tt[i]:=t[i]*10+ord(inp[id])-48;\n\t\t\tinc(id);\n\t\tend;\n\tend;\n\treadln(x);\n\tfor i:=1 to N do begin\n\t\tif flag then inc(ans,t[i]);\n\t\tif s[i]=x then flag:=True;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1578791215, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02806.html", "problem_id": "p02806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02806/input.txt", "sample_output_relpath": "derived/input_output/data/p02806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02806/Pascal/s969360994.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s969360994", "user_id": "u657913472"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "var\n\tN,ans,i,id:Longint;\n\tt:Array[1..50]of Longint;\n\ts:Array[1..50]of String;\n\tx,inp:String;\n\tflag:Boolean;\nbegin\n\treadln(N);\n\tfor i:=1 to N do begin\n\t\treadln(inp);\n\t\tid:=1;\n\t\twhile inp[id]<>' 'do inc(id);\n\t\ts[i]:=copy(inp,1,id-1);\n\t\tt[i]:=0;\n\t\tinc(id);\n\t\twhile id<=length(inp)do begin\n\t\t\tt[i]:=t[i]*10+ord(inp[id])-48;\n\t\t\tinc(id);\n\t\tend;\n\tend;\n\treadln(x);\n\tfor i:=1 to N do begin\n\t\tif flag then inc(ans,t[i]);\n\t\tif s[i]=x then flag:=True;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "sample_input": "3\ndwango 2\nsixth 5\nprelims 25\ndwango\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02806", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 466, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s040112677", "group_id": "codeNet:p02811", "input_text": "program main;\nvar x,k : integer;\nbegin\nreadln (k,x);\n\n\nif (k*500=x) then writeln ('Yes')\nelse writeln ('No');\n\n\nend.", "language": "Pascal", "metadata": {"date": 1599596865, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s040112677.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s040112677", "user_id": "u529554074"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar x,k : integer;\nbegin\nreadln (k,x);\n\n\nif (k*500=x) then writeln ('Yes')\nelse writeln ('No');\n\n\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 1, "memory_kb": 1300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s692256914", "group_id": "codeNet:p02811", "input_text": "program main;\nvar x,k : integer;\nbegin\nreadln (k,x);\n\nif (k>=1) and (k<=100) then begin\nif (x>=1) and (x<=50000) then begin\nif (k*500=x) then writeln ('Yes')\nelse writeln ('No');\nend;\nend;\n\nend.\n\n", "language": "Pascal", "metadata": {"date": 1599596452, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s692256914.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s692256914", "user_id": "u529554074"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar x,k : integer;\nbegin\nreadln (k,x);\n\nif (k>=1) and (k<=100) then begin\nif (x>=1) and (x<=50000) then begin\nif (k*500=x) then writeln ('Yes')\nelse writeln ('No');\nend;\nend;\n\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s873478215", "group_id": "codeNet:p02811", "input_text": "program main;\nvar K,N : integer;\nbegin\n\treadln(K,N);\n if(K * 500 >= N)\n \tthen writeln('Yes')\n \telse if(K * 500 < N)\n \t\tthen writeln('No'); \nend. ", "language": "Pascal", "metadata": {"date": 1599595849, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s873478215.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s873478215", "user_id": "u212944395"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar K,N : integer;\nbegin\n\treadln(K,N);\n if(K * 500 >= N)\n \tthen writeln('Yes')\n \telse if(K * 500 < N)\n \t\tthen writeln('No'); \nend. ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 3, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s433201940", "group_id": "codeNet:p02811", "input_text": "program main;\nvar \n a, b : integer;\nbegin\n readln(a,b);\n if ( a*500 >= b ) then \n writeln('Yes')\n else \n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1599594175, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Pascal/s433201940.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s433201940", "user_id": "u743163683"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main;\nvar \n a, b : integer;\nbegin\n readln(a,b);\n if ( a*500 >= b ) then \n writeln('Yes')\n else \n writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s840359939", "group_id": "codeNet:p02812", "input_text": "program main;\nvar n,x,y:integer;\n s:string;\nbegin\nreadln(n);\nreadln(s);\nx:=0;\nfor y:=1 to n do begin\n if(s[y]+s[y+1]+s[y+2]='ABC') then x:=x+1;\n end;\n writeln(x);\n end.", "language": "Pascal", "metadata": {"date": 1599598680, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Pascal/s840359939.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s840359939", "user_id": "u324512947"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar n,x,y:integer;\n s:string;\nbegin\nreadln(n);\nreadln(s);\nx:=0;\nfor y:=1 to n do begin\n if(s[y]+s[y+1]+s[y+2]='ABC') then x:=x+1;\n end;\n writeln(x);\n end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 171, "cpu_time_ms": 5, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s260796706", "group_id": "codeNet:p02812", "input_text": "program main;\nvar n,i,count: integer;\ns:string;\n \nbegin\nreadln(n);\nreadln(s);\ncount:=0;\nfor i:=1 to n do\nif S[i]+s[i+1]+s[i+2]='ABC' then count:=count+1;\n \nwriteln(count);\n \nend.", "language": "Pascal", "metadata": {"date": 1599597373, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Pascal/s260796706.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s260796706", "user_id": "u880893396"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main;\nvar n,i,count: integer;\ns:string;\n \nbegin\nreadln(n);\nreadln(s);\ncount:=0;\nfor i:=1 to n do\nif S[i]+s[i+1]+s[i+2]='ABC' then count:=count+1;\n \nwriteln(count);\n \nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 3, "memory_kb": 1388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s414713696", "group_id": "codeNet:p02817", "input_text": "program main;\nvar a,b,k :integer;\n \nbegin \nreadln(a,b,k);\nrepeat \nrepeat \nif (a>=1) then begin a:=a-1;k:=k-1;end;\nuntil (a=0);\nif (a=0) and (b>=1) then begin b:=b-1;k:=k-1;end;\nuntil (k=0); \n \nwriteln(a,b);\n \nend.", "language": "Pascal", "metadata": {"date": 1599598441, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s414713696.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s414713696", "user_id": "u880893396"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar a,b,k :integer;\n \nbegin \nreadln(a,b,k);\nrepeat \nrepeat \nif (a>=1) then begin a:=a-1;k:=k-1;end;\nuntil (a=0);\nif (a=0) and (b>=1) then begin b:=b-1;k:=k-1;end;\nuntil (k=0); \n \nwriteln(a,b);\n \nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 213, "cpu_time_ms": 2, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s683058886", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s,t,output : string;\nbegin\nreadln (s,t);\noutput:=concat(t,s);\nwriteln (output);\nend.", "language": "Pascal", "metadata": {"date": 1599598327, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s683058886.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s683058886", "user_id": "u529554074"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s,t,output : string;\nbegin\nreadln (s,t);\noutput:=concat(t,s);\nwriteln (output);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 3, "memory_kb": 1312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s961442887", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s,t : string;\nbegin\nreadln (s,t);\nwriteln (t+s);\nend.", "language": "Pascal", "metadata": {"date": 1599598114, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s961442887.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s961442887", "user_id": "u529554074"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s,t : string;\nbegin\nreadln (s,t);\nwriteln (t+s);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 71, "cpu_time_ms": 2, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s243187905", "group_id": "codeNet:p02817", "input_text": "program main;\nvar s,t,output:string;\n\nbegin \nreadln(s,t);\noutput:=t+s;\nwriteln(output);\nend.\n\n\n\n\n\n", "language": "Pascal", "metadata": {"date": 1599596406, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s243187905.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s243187905", "user_id": "u880893396"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar s,t,output:string;\n\nbegin \nreadln(s,t);\noutput:=t+s;\nwriteln(output);\nend.\n\n\n\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 3, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s091235641", "group_id": "codeNet:p02817", "input_text": "program main;\nvar x,y:string;\nbegin\nwrite('Input : '); readln(x,y);\nwriteln(y+x);\nend.", "language": "Pascal", "metadata": {"date": 1599596211, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s091235641.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s091235641", "user_id": "u324512947"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program main;\nvar x,y:string;\nbegin\nwrite('Input : '); readln(x,y);\nwriteln(y+x);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 3, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s354487527", "group_id": "codeNet:p02817", "input_text": "uses crt;\nvar\n t,s:string;\ni,j:integer;\nbegin\n clrscr;\nreadln(s);\nfor i:= 1 to length(s) do if(s[i]=' ') then break;\nfor j:= i to length(s) do begin\nt[j]:=s[j];\ns[j]:=' ';\nend;\n writeln(t,s); \n \nreadln;\nend.", "language": "Pascal", "metadata": {"date": 1577759693, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Pascal/s354487527.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s354487527", "user_id": "u918341086"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "uses crt;\nvar\n t,s:string;\ni,j:integer;\nbegin\n clrscr;\nreadln(s);\nfor i:= 1 to length(s) do if(s[i]=' ') then break;\nfor j:= i to length(s) do begin\nt[j]:=s[j];\ns[j]:=' ';\nend;\n writeln(t,s); \n \nreadln;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s496102224", "group_id": "codeNet:p02818", "input_text": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if ( a >= k ) then \n a := a-k\n else \n begin\n k := k-a;\n a := 0;\n if ( b > k ) then \n b := b-k\n else \n b := 0; \n end;\n writeln(a,' ',b);\nend.", "language": "Pascal", "metadata": {"date": 1599596292, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s496102224.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s496102224", "user_id": "u743163683"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program main;\nvar \n a,b,k : QWord;\nbegin\n readln(a,b,k);\n if ( a >= k ) then \n a := a-k\n else \n begin\n k := k-a;\n a := 0;\n if ( b > k ) then \n b := b-k\n else \n b := 0; \n end;\n writeln(a,' ',b);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 296, "cpu_time_ms": 3, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s724548975", "group_id": "codeNet:p02818", "input_text": "program hi;\nvar a, b, k: int64;\nbegin\n readln(a, b, k);\n if a >= k then \n writeln(a - k, ' ', b)\n else if a + b >= k then \n writeln(0, ' ', a + b - k)\n else \n writeln('0 0');\nend.", "language": "Pascal", "metadata": {"date": 1599594716, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Pascal/s724548975.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s724548975", "user_id": "u051422473"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program hi;\nvar a, b, k: int64;\nbegin\n readln(a, b, k);\n if a >= k then \n writeln(a - k, ' ', b)\n else if a + b >= k then \n writeln(0, ' ', a + b - k)\n else \n writeln('0 0');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 5, "memory_kb": 1372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s672847092", "group_id": "codeNet:p02819", "input_text": "program main;\nconst\n max = 100010;\n\nvar\n n, ans, i, j : longint;\n prime : array [1..max] of boolean;\n\nbegin\n readln(n);\n for i := 2 to max do\n prime[i] := true;\n for i := 2 to trunc(sqrt(max)) do\n if prime[i] then\n for j := 2 to (max div i) do\n prime[i*j] := false;\n for i := 1 to max do\n if (i >= n) and prime[i] then begin\n ans := i;\n break;\n end;\n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1599597059, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02819.html", "problem_id": "p02819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02819/input.txt", "sample_output_relpath": "derived/input_output/data/p02819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02819/Pascal/s672847092.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s672847092", "user_id": "u122156580"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program main;\nconst\n max = 100010;\n\nvar\n n, ans, i, j : longint;\n prime : array [1..max] of boolean;\n\nbegin\n readln(n);\n for i := 2 to max do\n prime[i] := true;\n for i := 2 to trunc(sqrt(max)) do\n if prime[i] then\n for j := 2 to (max div i) do\n prime[i*j] := false;\n for i := 1 to max do\n if (i >= n) and prime[i] then begin\n ans := i;\n break;\n end;\n writeln(ans);\nend.\n\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "sample_input": "20\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02819", "source_text": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 413, "cpu_time_ms": 6, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s096689644", "group_id": "codeNet:p02819", "input_text": "uses crt;\nvar\n so,k,i:longint;\nfunction check(so:longint):boolean;\nbegin\n if (so = 2 ) or (so = 3) then exit(true);\n if (so = 1) or (so = 0) or (so mod 2 = 0) or (so mod 3 = 0) then exit(false);\n k:=-1;\n repeat\n inc(k,6);\n if (so mod k = 0) or (so mod k+2=0) then break;\n until (k>trunc(sqrt(so)));\n exit(k>trunc(sqrt(so)));\nend;\nbegin\n clrscr;\n readln(so);\n for i:=so to so*10 do\n begin\n if check(i) then\n begin\n write(i);\n break;\n end;\n end;\n readln;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577670664, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02819.html", "problem_id": "p02819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02819/input.txt", "sample_output_relpath": "derived/input_output/data/p02819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02819/Pascal/s096689644.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s096689644", "user_id": "u129576229"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "uses crt;\nvar\n so,k,i:longint;\nfunction check(so:longint):boolean;\nbegin\n if (so = 2 ) or (so = 3) then exit(true);\n if (so = 1) or (so = 0) or (so mod 2 = 0) or (so mod 3 = 0) then exit(false);\n k:=-1;\n repeat\n inc(k,6);\n if (so mod k = 0) or (so mod k+2=0) then break;\n until (k>trunc(sqrt(so)));\n exit(k>trunc(sqrt(so)));\nend;\nbegin\n clrscr;\n readln(so);\n for i:=so to so*10 do\n begin\n if check(i) then\n begin\n write(i);\n break;\n end;\n end;\n readln;\nend.\n\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "sample_input": "20\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02819", "source_text": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 551, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s630087123", "group_id": "codeNet:p02821", "input_text": "\nvar n,m,count,i,j,j1,sum,x,tam,k: longint;\na: array[1..10000] of longint;\n procedure qs(l,r: longint);\nBEGIN\ni:=l;\nj:=r;\nx:=a[(i+j) div 2];\nrepeat\nwhile a[i]>x do inc(i);\nwhile a[j]j;\nif li then qs(i,r);\nend;\nbegin\n\nread(n,k);\nfor i:=1 to n do read(a[i]);\nqs(1,n);\nfor i:=1 to n do\nfor j:=i to n do\nbegin\nif i=j then begin\nsum:=sum+a[i]+a[j];\ninc(count); if count=k then begin write(sum); exit; end;\nend else begin sum:=sum+(a[i]+a[j])*2; inc(count); if\ncount=k then begin write(sum); exit; end; end;\nend;\n\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577680203, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02821.html", "problem_id": "p02821", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02821/input.txt", "sample_output_relpath": "derived/input_output/data/p02821/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02821/Pascal/s630087123.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s630087123", "user_id": "u398406871"}, "prompt_components": {"gold_output": "202\n", "input_to_evaluate": "\nvar n,m,count,i,j,j1,sum,x,tam,k: longint;\na: array[1..10000] of longint;\n procedure qs(l,r: longint);\nBEGIN\ni:=l;\nj:=r;\nx:=a[(i+j) div 2];\nrepeat\nwhile a[i]>x do inc(i);\nwhile a[j]j;\nif li then qs(i,r);\nend;\nbegin\n\nread(n,k);\nfor i:=1 to n do read(a[i]);\nqs(1,n);\nfor i:=1 to n do\nfor j:=i to n do\nbegin\nif i=j then begin\nsum:=sum+a[i]+a[j];\ninc(count); if count=k then begin write(sum); exit; end;\nend else begin sum:=sum+(a[i]+a[j])*2; inc(count); if\ncount=k then begin write(sum); exit; end; end;\nend;\n\n\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "sample_input": "5 3\n10 14 19 34 33\n"}, "reference_outputs": ["202\n"], "source_document_id": "p02821", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 637, "cpu_time_ms": 101, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s365220886", "group_id": "codeNet:p02830", "input_text": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n readln(n);\n readln(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,n+1);\n for i:=1 to length(a) do\n write(b[i],a[i]);\n readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1577313632, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02830.html", "problem_id": "p02830", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02830/input.txt", "sample_output_relpath": "derived/input_output/data/p02830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02830/Pascal/s365220886.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s365220886", "user_id": "u684763923"}, "prompt_components": {"gold_output": "icpc\n", "input_to_evaluate": "uses crt;\nvar a,b:string;\n i,n:longint;\nbegin\n clrscr;\n readln(n);\n readln(a);\n for i:=1 to pos(' ',a) do\n begin\n b:=b+a[i];\n end;\n delete(a,1,n+1);\n for i:=1 to length(a) do\n write(b[i],a[i]);\n readln;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "sample_input": "2\nip cc\n"}, "reference_outputs": ["icpc\n"], "source_document_id": "p02830", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s437803895", "group_id": "codeNet:p02830", "input_text": "var i,n: integer;\nsum: string;\na,b: array[1..100] of char;\nbegin\nreadln(n);\nfor i:=1 to n do readln(a[i]); for i:=1 to n do readln(b[i]);\nfor i:=1 to n do\nsum:=sum+a[i]+b[i];\nwriteln(sum);\nend.\n", "language": "Pascal", "metadata": {"date": 1577311854, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02830.html", "problem_id": "p02830", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02830/input.txt", "sample_output_relpath": "derived/input_output/data/p02830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02830/Pascal/s437803895.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s437803895", "user_id": "u398406871"}, "prompt_components": {"gold_output": "icpc\n", "input_to_evaluate": "var i,n: integer;\nsum: string;\na,b: array[1..100] of char;\nbegin\nreadln(n);\nfor i:=1 to n do readln(a[i]); for i:=1 to n do readln(b[i]);\nfor i:=1 to n do\nsum:=sum+a[i]+b[i];\nwriteln(sum);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "sample_input": "2\nip cc\n"}, "reference_outputs": ["icpc\n"], "source_document_id": "p02830", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s801271189", "group_id": "codeNet:p02831", "input_text": "var a,b:longint;\ntmp:int64;\nbegin\n readln(a, b);\n if b>a then begin\n tmp:=a;\n a:=b;\n b:=tmp;\n end;\n tmp:=a;\n while true do begin\n if tmp mod b = 0 then begin\n writeln(tmp);\n break;\n end;\n tmp:=tmp+a;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1577312138, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Pascal/s801271189.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s801271189", "user_id": "u635762866"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var a,b:longint;\ntmp:int64;\nbegin\n readln(a, b);\n if b>a then begin\n tmp:=a;\n a:=b;\n b:=tmp;\n end;\n tmp:=a;\n while true do begin\n if tmp mod b = 0 then begin\n writeln(tmp);\n break;\n end;\n tmp:=tmp+a;\n end;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s546777039", "group_id": "codeNet:p02831", "input_text": "var a,b:longint;\ntmp:int64;\nbegin\n readln(a, b);\n if b>a then begin\n tmp:=a;\n a:=b;\n b:=tmp;\n end;\n tmp:=a;\n while true do begin\n tmp:=tmp+a;\n if tmp mod b = 0 then begin\n writeln(tmp);\n break;\n end;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1577311822, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Pascal/s546777039.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s546777039", "user_id": "u635762866"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var a,b:longint;\ntmp:int64;\nbegin\n readln(a, b);\n if b>a then begin\n tmp:=a;\n a:=b;\n b:=tmp;\n end;\n tmp:=a;\n while true do begin\n tmp:=tmp+a;\n if tmp mod b = 0 then begin\n writeln(tmp);\n break;\n end;\n end;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s701931151", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..1000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n d:=1;\n for i:=1 to n do\n if (a[i]=d)then inc(d);\n if (d=1)then write(-1) else write(n-d+1);\n readln;\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577377663, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s701931151.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s701931151", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..1000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n d:=1;\n for i:=1 to n do\n if (a[i]=d)then inc(d);\n if (d=1)then write(-1) else write(n-d+1);\n readln;\n readln\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 99, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s957187914", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..1000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n if (a[i+1]-a[i]=1)and(a[i]-d=1)then inc(d)else\n if (a[i+1]-d=1)or(a[i]-d=1)then inc(d);\n if (d<>0)then write(n-d)else write(d);\n readln;\n readln\nend.\n\n\n\n", "language": "Pascal", "metadata": {"date": 1577377213, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s957187914.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s957187914", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar n,d,i,j:longint;\n a:array[1..1000]of longint;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n if (a[i+1]-a[i]=1)and(a[i]-d=1)then inc(d)else\n if (a[i+1]-d=1)or(a[i]-d=1)then inc(d);\n if (d<>0)then write(n-d)else write(d);\n readln;\n readln\nend.\n\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 365, "cpu_time_ms": 96, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s874916234", "group_id": "codeNet:p02832", "input_text": "\nvar\n min,d,n,i,j,t:longint;\n a:array[1..200000] of longint;\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n min:=a[1];\n for i:=2 to n do if min>a[i] then min:=a[i];\n i:=1;\n t:=1;\n if min<>i then begin write(-1); exit; end else\n while j<>n do\n begin\n for j:=1 to n do\n if a[j]<>i then begin inc(d); a[j]:=-1; end\n else if a[j]=i then inc(i);\n end;\n if d>=0 then write(d) else write(-1);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577376998, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s874916234.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874916234", "user_id": "u344153701"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "\nvar\n min,d,n,i,j,t:longint;\n a:array[1..200000] of longint;\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n min:=a[1];\n for i:=2 to n do if min>a[i] then min:=a[i];\n i:=1;\n t:=1;\n if min<>i then begin write(-1); exit; end else\n while j<>n do\n begin\n for j:=1 to n do\n if a[j]<>i then begin inc(d); a[j]:=-1; end\n else if a[j]=i then inc(i);\n end;\n if d>=0 then write(d) else write(-1);\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 544, "cpu_time_ms": 24, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s924003986", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar n,d:longint;\n a:array[1..1000]of longint;\n i,j:integer;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n if (a[i+1]-a[i]=1)and(a[i]-d=1)then inc(d)else\n if (a[i+1]-d=1)then inc(d);\n if (d<>0)then write(n-d)else write(d);\n readln;\n readln\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577376636, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s924003986.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s924003986", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar n,d:longint;\n a:array[1..1000]of longint;\n i,j:integer;\nbegin\n clrscr;\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n if (a[i+1]-a[i]=1)and(a[i]-d=1)then inc(d)else\n if (a[i+1]-d=1)then inc(d);\n if (d<>0)then write(n-d)else write(d);\n readln;\n readln\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 100, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s646195888", "group_id": "codeNet:p02832", "input_text": "var n,d:longint;\n a:array[1..1000]of longint;\n i,j:integer;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n-1 do\n if (a[j]-a[i]=1)and(a[i]-d<=1)then inc(d);\n if n>5 then write(n-d) else write(d);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577375930, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s646195888.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s646195888", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,d:longint;\n a:array[1..1000]of longint;\n i,j:integer;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n-1 do\n if (a[j]-a[i]=1)and(a[i]-d<=1)then inc(d);\n if n>5 then write(n-d) else write(d);\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 295, "cpu_time_ms": 98, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s327930272", "group_id": "codeNet:p02832", "input_text": "var n,d:longint;\n a:array[1..1000]of longint;\n i,j:integer;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if (a[j]-a[i]=1)and(a[i]-d<=1)then inc(d);\n if n>5 then write(n-1-d) else write(d);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577375869, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s327930272.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s327930272", "user_id": "u684763923"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,d:longint;\n a:array[1..1000]of longint;\n i,j:integer;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if (a[j]-a[i]=1)and(a[i]-d<=1)then inc(d);\n if n>5 then write(n-1-d) else write(d);\nend.\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 295, "cpu_time_ms": 99, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s913800007", "group_id": "codeNet:p02832", "input_text": "const max=200000;\nvar\n a:array[1..max] of longint;\n s,n,i,j,min,d,tam:longint;\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do s:=s+a[i];\n if s=a[i]*n then begin write('-1'); exit; end else\n for i:=1 to n do\n min:=a[1];\n for i:=2 to n do if a[i]min) and (min+1<>tam) then inc(d)\n else if a[i]<=min then begin min:=a[i]; inc(tam); end;\n end;\n if d>=0 then write(d) else write(-1);\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1577317577, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s913800007.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s913800007", "user_id": "u322930761"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const max=200000;\nvar\n a:array[1..max] of longint;\n s,n,i,j,min,d,tam:longint;\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do s:=s+a[i];\n if s=a[i]*n then begin write('-1'); exit; end else\n for i:=1 to n do\n min:=a[1];\n for i:=2 to n do if a[i]min) and (min+1<>tam) then inc(d)\n else if a[i]<=min then begin min:=a[i]; inc(tam); end;\n end;\n if d>=0 then write(d) else write(-1);\nend.\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 599, "cpu_time_ms": 24, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s542775937", "group_id": "codeNet:p02832", "input_text": "const max=200000;\nvar\n a:array[1..max] of longint;\n n,i,j,min,d,tam:longint;\n ok:boolean;\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n for j:=i+1 to n do if a[i]=a[j] then ok:=true else ok:=false;\n if ok=true then begin write(-1); exit; end;\n min:=a[1];\n for i:=2 to n do if a[i]min) and (min+1<>tam) then inc(d)\n else if a[i]<=min then begin min:=a[i]; inc(tam); end;\n end;\n if d>=0 then write(d) else write(-1);\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1577316366, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s542775937.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s542775937", "user_id": "u322930761"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const max=200000;\nvar\n a:array[1..max] of longint;\n n,i,j,min,d,tam:longint;\n ok:boolean;\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n for j:=i+1 to n do if a[i]=a[j] then ok:=true else ok:=false;\n if ok=true then begin write(-1); exit; end;\n min:=a[1];\n for i:=2 to n do if a[i]min) and (min+1<>tam) then inc(d)\n else if a[i]<=min then begin min:=a[i]; inc(tam); end;\n end;\n if d>=0 then write(d) else write(-1);\nend.\n\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 644, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s957216750", "group_id": "codeNet:p02832", "input_text": "var n,i:longint;\na:array[1..200000] of longint;\nprocedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if li then begin write(n-i+1); exit; end;\n write(0);\nend.\n", "language": "Pascal", "metadata": {"date": 1577314944, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s957216750.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s957216750", "user_id": "u005436314"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,i:longint;\na:array[1..200000] of longint;\nprocedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if li then begin write(n-i+1); exit; end;\n write(0);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 779, "cpu_time_ms": 41, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s085250626", "group_id": "codeNet:p02832", "input_text": "uses crt;\nvar i,n,count,j: longint;\na: array[1..100000] of integer;\nbegin\nclrscr;\nread(n);\nFOR i:=1 TO n do read(a[i]);\ni:=1; j:=1;\nwhile (i<=n) and(j<=n) do\nbegin\nwhile (a[j]<>i) and (j<=n) do begin inc(count); inc(j); end;\ninc(j);\ninc(i);\nend;\nif count=n then write('-1') else write(count);\nreadln;\nreadln;\nend.\n", "language": "Pascal", "metadata": {"date": 1577314876, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s085250626.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s085250626", "user_id": "u398406871"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses crt;\nvar i,n,count,j: longint;\na: array[1..100000] of integer;\nbegin\nclrscr;\nread(n);\nFOR i:=1 TO n do read(a[i]);\ni:=1; j:=1;\nwhile (i<=n) and(j<=n) do\nbegin\nwhile (a[j]<>i) and (j<=n) do begin inc(count); inc(j); end;\ninc(j);\ninc(i);\nend;\nif count=n then write('-1') else write(count);\nreadln;\nreadln;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 316, "cpu_time_ms": 109, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s348971765", "group_id": "codeNet:p02832", "input_text": "Var a,i,n,rem:Longint;\nBegin\n Readln(n); rem:=1;\n For i:=1 to n do begin\n Read(a);\n If a=rem then inc(rem);\n End;\n If rem=1 then writeln(-1) else writeln(n-rem+1);\nEnd.", "language": "Pascal", "metadata": {"date": 1577066959, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Pascal/s348971765.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s348971765", "user_id": "u866155170"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "Var a,i,n,rem:Longint;\nBegin\n Readln(n); rem:=1;\n For i:=1 to n do begin\n Read(a);\n If a=rem then inc(rem);\n End;\n If rem=1 then writeln(-1) else writeln(n-rem+1);\nEnd.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 24, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s246052878", "group_id": "codeNet:p02837", "input_text": "var\n a, now: array [1..15] of longint;\n p, s: array [1..15, 1..14] of longint;\n n, i, j, cnt, ans: longint;\nfunction max(x, y: longint): longint; inline;\nbegin\n if x > y then exit(x) else exit(y);\nend;\nfunction check: boolean; inline;\nvar\n i, j, unkind: longint;\nbegin\n for i := 1 to n do\n begin\n unkind := 1;\n for j := 1 to a[i] do\n if now[p[i, j]] <> s[i, j] then\n begin\n unkind := 0;\n break;\n end;\n if now[i] <> unkind then exit(false);\n end;\n exit(true);\nend;\nprocedure dfs(d: longint);\nbegin\n if d = n + 1 then\n begin\n if check then ans := max(ans, cnt);\n exit;\n end;\n now[d] := 0;\n dfs(d + 1);\n now[d] := 1;\n inc(cnt);\n dfs(d + 1);\n dec(cnt);\nend;\nbegin\n read(n);\n for i := 1 to n do\n begin\n read(a[i]);\n for j := 1 to a[i] do read(p[i, j], s[i, j]);\n end;\n dfs(1);\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1581515758, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02837.html", "problem_id": "p02837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02837/input.txt", "sample_output_relpath": "derived/input_output/data/p02837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02837/Pascal/s246052878.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s246052878", "user_id": "u214724132"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a, now: array [1..15] of longint;\n p, s: array [1..15, 1..14] of longint;\n n, i, j, cnt, ans: longint;\nfunction max(x, y: longint): longint; inline;\nbegin\n if x > y then exit(x) else exit(y);\nend;\nfunction check: boolean; inline;\nvar\n i, j, unkind: longint;\nbegin\n for i := 1 to n do\n begin\n unkind := 1;\n for j := 1 to a[i] do\n if now[p[i, j]] <> s[i, j] then\n begin\n unkind := 0;\n break;\n end;\n if now[i] <> unkind then exit(false);\n end;\n exit(true);\nend;\nprocedure dfs(d: longint);\nbegin\n if d = n + 1 then\n begin\n if check then ans := max(ans, cnt);\n exit;\n end;\n now[d] := 0;\n dfs(d + 1);\n now[d] := 1;\n inc(cnt);\n dfs(d + 1);\n dec(cnt);\nend;\nbegin\n read(n);\n for i := 1 to n do\n begin\n read(a[i]);\n for j := 1 to a[i] do read(p[i, j], s[i, j]);\n end;\n dfs(1);\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "sample_input": "3\n1\n2 1\n1\n1 1\n1\n2 0\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02837", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 865, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s598033557", "group_id": "codeNet:p02837", "input_text": "//uses crt;\nvar n,i,o,p,k,l,j,m,x,z,count,max:longint;\nused:array[1..16] of boolean;\ntype persoana = record\n testi:integer;\n saidabout:array[1..16] of integer;\n heis:array[1..16] of boolean;\n sincere:boolean;\n someonesaid:boolean;\n used:boolean;\n end;\nvar om:array[1..16] of persoana;\nprocedure backtrack(step:longint);\nvar i,o,p,k,j,curent:longint;\ncontradiction:boolean;\nbegin\nif step=n+1 then begin\n contradiction:=false;\n k:=0;\n for i:=1 to n do\n om[i].sincere:=false;\n om[i].someonesaid:=false;\n for i:=1 to n do\n if used[i] then begin\n inc(k);\n om[i].sincere:=true;\n om[i].someonesaid:=true;\n //write(i,' ');\n end;\n // writeln;\n for i:=1 to n do begin\n if contradiction then break;\n if om[i].sincere then\n for j:=1 to om[i].testi do begin\n curent:=om[i].saidabout[j];\n // writeln(curent);\n if (om[curent].someonesaid) and (om[i].heis[j] <> om[curent].sincere) then begin\n // writeln('omul',curent,' nu a zis nimeni si omul', i,' spune ca el este ',om[i].heis[j],' ceea ce este diferit de ',om[curent].sincere);\n contradiction:=true;\n break;\n end;\n if (om[curent].someonesaid=false) and (om[curent].sincere <> om[i].heis[j]) then begin\n om[curent].sincere:=om[i].heis[j];\n // writeln(curent);\n inc(K);\n end;\n end;\n end;\n // writeln(k,contradiction);\n if not contradiction then if k>max then max:=k;\n end\nelse begin\n used[step]:=true;\n backtrack(step+1);\n used[step]:=false;\n backtrack(step+1);\n end;\nend;\nbegin\nread(n);\nfor i:=1 to n do begin\n read(l);\n for j:=1 to l do begin\n read(x,z);\n om[i].saidabout[j]:=x;\n if z=1 then om[i].heis[j]:=true\n else om[i].heis[j]:=false;\n // writeln(om[i].saidabout[j],' ',om[i].heis[j]);\n om[i].testi:=l;\n end;\n end;\nbacktrack(1);\nwriteln(max);\nreadln;\nreadln;\nend.\n", "language": "Pascal", "metadata": {"date": 1577577129, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02837.html", "problem_id": "p02837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02837/input.txt", "sample_output_relpath": "derived/input_output/data/p02837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02837/Pascal/s598033557.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s598033557", "user_id": "u448096745"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "//uses crt;\nvar n,i,o,p,k,l,j,m,x,z,count,max:longint;\nused:array[1..16] of boolean;\ntype persoana = record\n testi:integer;\n saidabout:array[1..16] of integer;\n heis:array[1..16] of boolean;\n sincere:boolean;\n someonesaid:boolean;\n used:boolean;\n end;\nvar om:array[1..16] of persoana;\nprocedure backtrack(step:longint);\nvar i,o,p,k,j,curent:longint;\ncontradiction:boolean;\nbegin\nif step=n+1 then begin\n contradiction:=false;\n k:=0;\n for i:=1 to n do\n om[i].sincere:=false;\n om[i].someonesaid:=false;\n for i:=1 to n do\n if used[i] then begin\n inc(k);\n om[i].sincere:=true;\n om[i].someonesaid:=true;\n //write(i,' ');\n end;\n // writeln;\n for i:=1 to n do begin\n if contradiction then break;\n if om[i].sincere then\n for j:=1 to om[i].testi do begin\n curent:=om[i].saidabout[j];\n // writeln(curent);\n if (om[curent].someonesaid) and (om[i].heis[j] <> om[curent].sincere) then begin\n // writeln('omul',curent,' nu a zis nimeni si omul', i,' spune ca el este ',om[i].heis[j],' ceea ce este diferit de ',om[curent].sincere);\n contradiction:=true;\n break;\n end;\n if (om[curent].someonesaid=false) and (om[curent].sincere <> om[i].heis[j]) then begin\n om[curent].sincere:=om[i].heis[j];\n // writeln(curent);\n inc(K);\n end;\n end;\n end;\n // writeln(k,contradiction);\n if not contradiction then if k>max then max:=k;\n end\nelse begin\n used[step]:=true;\n backtrack(step+1);\n used[step]:=false;\n backtrack(step+1);\n end;\nend;\nbegin\nread(n);\nfor i:=1 to n do begin\n read(l);\n for j:=1 to l do begin\n read(x,z);\n om[i].saidabout[j]:=x;\n if z=1 then om[i].heis[j]:=true\n else om[i].heis[j]:=false;\n // writeln(om[i].saidabout[j],' ',om[i].heis[j]);\n om[i].testi:=l;\n end;\n end;\nbacktrack(1);\nwriteln(max);\nreadln;\nreadln;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "sample_input": "3\n1\n2 1\n1\n1 1\n1\n2 0\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02837", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2702, "cpu_time_ms": 5, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s862492610", "group_id": "codeNet:p02837", "input_text": "var\n\tN,A,x,y,i,j,out,ans,nowt,nowf,ccc:Longint;\n\tF,T,gF,gT:Array[1..15]of Longint;\nprocedure dfs(id,nt,nf:Longint);\nvar\ncnt,i:Longint;\nbegin\n\tif id=N+1 then begin\n\t\tcnt:=0;\n\t\tfor i:=1 to N do if((nt>>(i-1))and 1)=1 then inc(cnt);\n\t\tif ans>(id-1))and 1)=0)and(((nf or gF[id])and(nt or gT[id]))=0)then dfs(id+1,nt or gT[id],nf or gF[id]);\n\t\tdfs(id+1,nt,nf);\n\tend;\nend;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(A);\n\t\tfor j:=1 to A do begin\n\t\t\tread(x,y);\n\t\t\tdec(x);\n\t\t\tif y=0 then F[i]:=F[i] or (1<>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\tend;\n\tdfs(1,0,0);\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1575865973, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02837.html", "problem_id": "p02837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02837/input.txt", "sample_output_relpath": "derived/input_output/data/p02837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02837/Pascal/s862492610.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s862492610", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tN,A,x,y,i,j,out,ans,nowt,nowf,ccc:Longint;\n\tF,T,gF,gT:Array[1..15]of Longint;\nprocedure dfs(id,nt,nf:Longint);\nvar\ncnt,i:Longint;\nbegin\n\tif id=N+1 then begin\n\t\tcnt:=0;\n\t\tfor i:=1 to N do if((nt>>(i-1))and 1)=1 then inc(cnt);\n\t\tif ans>(id-1))and 1)=0)and(((nf or gF[id])and(nt or gT[id]))=0)then dfs(id+1,nt or gT[id],nf or gF[id]);\n\t\tdfs(id+1,nt,nf);\n\tend;\nend;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(A);\n\t\tfor j:=1 to A do begin\n\t\t\tread(x,y);\n\t\t\tdec(x);\n\t\t\tif y=0 then F[i]:=F[i] or (1<>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\tend;\n\tdfs(1,0,0);\n\twriteln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "sample_input": "3\n1\n2 1\n1\n1 1\n1\n2 0\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02837", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 886, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s200144810", "group_id": "codeNet:p02837", "input_text": "var\n\tN,A,x,y,i,j,out,ans,nowt,nowf,ccc:Longint;\n\tF,T,gF,gT:Array[1..15]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(A);\n\t\tfor j:=1 to A do begin\n\t\t\tread(x,y);\n\t\t\tdec(x);\n\t\t\tif y=0 then F[i]:=F[i] or (1<>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\t\tif(nowt and nowf)<>0 then out:=out or(1<<(i-1));\n\tend;\n\ti:=((1<0 do begin\n\t\tccc:=0;\n\t\tnowt:=i;\n\t\tnowf:=0;\n\t\tfor j:=1 to N do begin\n\t\t\tif ((nowt>>(j-1))and 1)=1 then begin\n\t\t\t\tinc(ccc);\n\t\t\t\tnowt:=nowt or gT[j];\n\t\t\t\tnowf:=nowf or gF[j];\n\t\t\tend;\n\t\tend;\n\t\tif((nowt and nowf)=0)and(ans>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\t\tif(nowt and nowf)<>0 then out:=out or(1<<(i-1));\n\tend;\n\ti:=((1<0 do begin\n\t\tccc:=0;\n\t\tnowt:=i;\n\t\tnowf:=0;\n\t\tfor j:=1 to N do begin\n\t\t\tif ((nowt>>(j-1))and 1)=1 then begin\n\t\t\t\tinc(ccc);\n\t\t\t\tnowt:=nowt or gT[j];\n\t\t\t\tnowf:=nowf or gF[j];\n\t\t\tend;\n\t\tend;\n\t\tif((nowt and nowf)=0)and(ans>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\t\tif((out and nowt)<>0)or((nowt and nowf)<>0)then out:=out or(1<<(i-1));\n\tend;\n\ti:=((1<0 do begin\n\t\tccc:=0;\n\t\tnowt:=i;\n\t\tnowf:=0;\n\t\tfor j:=1 to N do begin\n\t\t\tif ((nowt>>(j-1))and 1)=1 then begin\n\t\t\t\tinc(ccc);\n\t\t\t\tnowt:=nowt and gT[j];\n\t\t\t\tnowf:=nowf and gF[j];\n\t\t\tend;\n\t\tend;\n\t\tif((nowt and nowf)=0)and(ans>(j-1))and 1)=1 then begin\n\t\t\t\t\tnowt:=nowt or T[j];\n\t\t\t\t\tnowf:=nowf or F[j];\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tgF[i]:=nowf;\n\t\tgT[i]:=nowt;\n\t\tif((out and nowt)<>0)or((nowt and nowf)<>0)then out:=out or(1<<(i-1));\n\tend;\n\ti:=((1<0 do begin\n\t\tccc:=0;\n\t\tnowt:=i;\n\t\tnowf:=0;\n\t\tfor j:=1 to N do begin\n\t\t\tif ((nowt>>(j-1))and 1)=1 then begin\n\t\t\t\tinc(ccc);\n\t\t\t\tnowt:=nowt and gT[j];\n\t\t\t\tnowf:=nowf and gF[j];\n\t\t\tend;\n\t\tend;\n\t\tif((nowt and nowf)=0)and(ans> 1\n end;\n for j := 1 to n do\n begin \n flag := true;\n if (check[j] = 1) then\n begin\n for l := 1 to people[j].a do \n if check[people[j].t[l].x] <> people[j].t[l].y then \n begin\n flag := false;\n break\n end\n end;\n if not (flag) then break;\n end;\n store:=0;\n if flag then\n for l := 1 to n do\n if check[l] = 1 then inc(store);\n if ans < store then ans := store;\nend;\n\nwrite(ans)\n\nend.", "language": "Pascal", "metadata": {"date": 1575863881, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02837.html", "problem_id": "p02837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02837/input.txt", "sample_output_relpath": "derived/input_output/data/p02837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02837/Pascal/s475255157.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s475255157", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "type xy = record x,y:int64; \n end;\n p = record a:int64;\n t:array[1..20] of xy;\n end;\nvar i,j,l,maker,power,ans,n,store:int64;\n people:array[1..20] of p;\n check:array[1..20] of int64;\n flag :boolean;\n \nfunction power2(q:int64):int64;\nvar po,k:int64;\nbegin\n po:=1;\n for k := 1 to q do po := po *2;\n power2 := po\nend;\n\nbegin\nread(n);\nfor i := 1 to n do\n begin\n read(people[i].a);\n for j := 1 to people[i].a do read(people[i].t[j].x,people[i].t[j].y)\n end;\n\npower := power2(n);\nans:=0;\nfor i := power-1 downto 0 do\n begin\n maker := i;\n for j := 1 to n do\n begin \n if odd(maker) then check[j] := 1\n else check[j]:=0;\n maker := maker >> 1\n end;\n for j := 1 to n do\n begin \n flag := true;\n if (check[j] = 1) then\n begin\n for l := 1 to people[j].a do \n if check[people[j].t[l].x] <> people[j].t[l].y then \n begin\n flag := false;\n break\n end\n end;\n if not (flag) then break;\n end;\n store:=0;\n if flag then\n for l := 1 to n do\n if check[l] = 1 then inc(store);\n if ans < store then ans := store;\nend;\n\nwrite(ans)\n\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "sample_input": "3\n1\n2 1\n1\n1 1\n1\n2 0\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02837", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1154, "cpu_time_ms": 8, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s568881663", "group_id": "codeNet:p02842", "input_text": "Uses math;\nVar n:Longint;\nBegin\n Readln(n);\n Writeln(ceil(n/1.08));\nEnd.", "language": "Pascal", "metadata": {"date": 1575252246, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Pascal/s568881663.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s568881663", "user_id": "u866155170"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "Uses math;\nVar n:Longint;\nBegin\n Readln(n);\n Writeln(ceil(n/1.08));\nEnd.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s166249573", "group_id": "codeNet:p02848", "input_text": "var\n n, i: longint;\n s: ansistring;\nfunction c2n(c: char): longint; inline;\nbegin\n exit(ord(c) - ord('A'));\nend;\nfunction n2c(n: longint): char; inline;\nbegin\n exit(chr(n + ord('A')));\nend;\nbegin\n readln(n);\n readln(s);\n for i := 1 to length(s) do s[i] := n2c((c2n(s[i]) + n) mod 26);\n writeln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1581516027, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Pascal/s166249573.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s166249573", "user_id": "u214724132"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "var\n n, i: longint;\n s: ansistring;\nfunction c2n(c: char): longint; inline;\nbegin\n exit(ord(c) - ord('A'));\nend;\nfunction n2c(n: longint): char; inline;\nbegin\n exit(chr(n + ord('A')));\nend;\nbegin\n readln(n);\n readln(s);\n for i := 1 to length(s) do s[i] := n2c((c2n(s[i]) + n) mod 26);\n writeln(s);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 311, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s365480653", "group_id": "codeNet:p02848", "input_text": "var i,n,t:Longint;s:String;\nbegin\nreadln(n);\nn:=n-65;\nreadln(s);\nfor i:=1 to length(s)do begin\n\tt:=ord(s[i])+n;\n\tif t>=26 then t:=t-26;\n\ts[i]:=chr(t+65);\nend;\nwriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1574650663, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Pascal/s365480653.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s365480653", "user_id": "u657913472"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "var i,n,t:Longint;s:String;\nbegin\nreadln(n);\nn:=n-65;\nreadln(s);\nfor i:=1 to length(s)do begin\n\tt:=ord(s[i])+n;\n\tif t>=26 then t:=t-26;\n\ts[i]:=chr(t+65);\nend;\nwriteln(s);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s793487204", "group_id": "codeNet:p02848", "input_text": "var i,n:Longint;s:String;\nbegin\nreadln(n);\nreadln(s);\nfor i:=1 to length(s)do begin\n\ts[i]:=chr((ord(s[i])-65+n)mod 26+65);\nend;\nwriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1574648492, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Pascal/s793487204.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s793487204", "user_id": "u657913472"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "var i,n:Longint;s:String;\nbegin\nreadln(n);\nreadln(s);\nfor i:=1 to length(s)do begin\n\ts[i]:=chr((ord(s[i])-65+n)mod 26+65);\nend;\nwriteln(s);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 144, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s104108666", "group_id": "codeNet:p02848", "input_text": "var i,n:Longint;s:String;\nbegin\nreadln(n);\nreadln(s);\nfor i:=1 to length(s)do begin\n\twrite(chr((ord(s[i])-65+n)mod 26+65));\nend;\nwriteln;\nend.", "language": "Pascal", "metadata": {"date": 1574647561, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Pascal/s104108666.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s104108666", "user_id": "u657913472"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "var i,n:Longint;s:String;\nbegin\nreadln(n);\nreadln(s);\nfor i:=1 to length(s)do begin\n\twrite(chr((ord(s[i])-65+n)mod 26+65));\nend;\nwriteln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s938288792", "group_id": "codeNet:p02853", "input_text": "program DDCC_Finals;\nuses math;\nvar\n x, y, m: integer;\nbegin\n read(x, y);\n x := min(x, 4);\n y := min(y, 4);\n m := 4-x+4-y;\n if m = 6 then\n m := 10;\n writeln(m*100000);\nend.", "language": "Pascal", "metadata": {"date": 1574567037, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02853.html", "problem_id": "p02853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02853/input.txt", "sample_output_relpath": "derived/input_output/data/p02853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02853/Pascal/s938288792.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s938288792", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1000000\n", "input_to_evaluate": "program DDCC_Finals;\nuses math;\nvar\n x, y, m: integer;\nbegin\n read(x, y);\n x := min(x, 4);\n y := min(y, 4);\n m := 4-x+4-y;\n if m = 6 then\n m := 10;\n writeln(m*100000);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.\n\nDISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver.\nFind the total amount of money he earned.\n\nConstraints\n\n1 \\leq X \\leq 205\n\n1 \\leq Y \\leq 205\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the amount of money DISCO-Kun earned, as an integer.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n1000000\n\nIn this case, he earned 300000 yen in Coding Contest and another 300000 yen in Robot Maneuver. Furthermore, as he won both competitions, he got an additional 400000 yen.\nIn total, he made 300000 + 300000 + 400000 = 1000000 yen.\n\nSample Input 2\n\n3 101\n\nSample Output 2\n\n100000\n\nIn this case, he earned 100000 yen in Coding Contest.\n\nSample Input 3\n\n4 4\n\nSample Output 3\n\n0\n\nIn this case, unfortunately, he was the highest-ranked contestant without prize money in both competitions.", "sample_input": "1 1\n"}, "reference_outputs": ["1000000\n"], "source_document_id": "p02853", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.\n\nDISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver.\nFind the total amount of money he earned.\n\nConstraints\n\n1 \\leq X \\leq 205\n\n1 \\leq Y \\leq 205\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the amount of money DISCO-Kun earned, as an integer.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n1000000\n\nIn this case, he earned 300000 yen in Coding Contest and another 300000 yen in Robot Maneuver. Furthermore, as he won both competitions, he got an additional 400000 yen.\nIn total, he made 300000 + 300000 + 400000 = 1000000 yen.\n\nSample Input 2\n\n3 101\n\nSample Output 2\n\n100000\n\nIn this case, he earned 100000 yen in Coding Contest.\n\nSample Input 3\n\n4 4\n\nSample Output 3\n\n0\n\nIn this case, unfortunately, he was the highest-ranked contestant without prize money in both competitions.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 182, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s276674485", "group_id": "codeNet:p02855", "input_text": "type pair=record x,y:int64 end;\n ary1=array[1..920] of pair;\n ary2=array[1..310,1..310] of int64;\nvar h,w,k,i,j,n,last:int64;\n marker:pair;\n s:ary1;\n ans:ary2;\n c:char;\n \nprocedure update(a,b,c,d,e: int64);\nvar i1,j1:int64;\nbegin\n for i1 := a to c do\n for j1 := b to d do\n ans[i1][j1]:=e;\nend;\n\nbegin\nreadln(h,w,k);\nn:=1;\nfor i := 1 to h do\n begin\n for j := 1 to w do\n begin\n read(c);\n write(c);\n if c='#' then \n begin\n s[n].y:=i;\n s[n].x:=j;\n last:=i;\n inc(n)\n end;\n if n=k+1 then break;\n end;\n writeln;\n readln;\n end;\nn:=1;\nupdate(1,1,s[1].y,s[1].x,n);\nmarker.y:=1;marker.x:=s[1].x+1;\ninc(n);\nfor i := 2 to k do\n if s[i-1].y = s[i].y then\n begin\n if s[i].y= last then update(marker.y,marker.x,h,s[i].x,n)\n else update(marker.y,marker.x,s[i].y,s[i].x,n);\n marker.x:=s[i].x+1;\n inc(n)\n end\n else \n begin\n update(marker.y,marker.x,s[i-1].y,w,n-1);\n if s[i].y= last then update(s[i-1].y+1,1,h,s[i].x,n)\n else update(s[i-1].y+1,1,s[i].y,s[i].x,n);\n marker.y:=s[i-1].y+1;marker.x:=s[i].x+1;\n inc(n)\n end;\n\nupdate(marker.y,s[i].x+1,h,w,n-1);\n\nfor i := 1 to h do\n begin\n for j := 1 to w do\n write(ans[i][j],' ');\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1574570655, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02855.html", "problem_id": "p02855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02855/input.txt", "sample_output_relpath": "derived/input_output/data/p02855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02855/Pascal/s276674485.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s276674485", "user_id": "u655683235"}, "prompt_components": {"gold_output": "1 2 2\n1 3 4\n5 5 4\n", "input_to_evaluate": "type pair=record x,y:int64 end;\n ary1=array[1..920] of pair;\n ary2=array[1..310,1..310] of int64;\nvar h,w,k,i,j,n,last:int64;\n marker:pair;\n s:ary1;\n ans:ary2;\n c:char;\n \nprocedure update(a,b,c,d,e: int64);\nvar i1,j1:int64;\nbegin\n for i1 := a to c do\n for j1 := b to d do\n ans[i1][j1]:=e;\nend;\n\nbegin\nreadln(h,w,k);\nn:=1;\nfor i := 1 to h do\n begin\n for j := 1 to w do\n begin\n read(c);\n write(c);\n if c='#' then \n begin\n s[n].y:=i;\n s[n].x:=j;\n last:=i;\n inc(n)\n end;\n if n=k+1 then break;\n end;\n writeln;\n readln;\n end;\nn:=1;\nupdate(1,1,s[1].y,s[1].x,n);\nmarker.y:=1;marker.x:=s[1].x+1;\ninc(n);\nfor i := 2 to k do\n if s[i-1].y = s[i].y then\n begin\n if s[i].y= last then update(marker.y,marker.x,h,s[i].x,n)\n else update(marker.y,marker.x,s[i].y,s[i].x,n);\n marker.x:=s[i].x+1;\n inc(n)\n end\n else \n begin\n update(marker.y,marker.x,s[i-1].y,w,n-1);\n if s[i].y= last then update(s[i-1].y+1,1,h,s[i].x,n)\n else update(s[i-1].y+1,1,s[i].y,s[i].x,n);\n marker.y:=s[i-1].y+1;marker.x:=s[i].x+1;\n inc(n)\n end;\n\nupdate(marker.y,s[i].x+1,h,w,n-1);\n\nfor i := 1 to h do\n begin\n for j := 1 to w do\n write(ans[i][j],' ');\n writeln;\n end;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "sample_input": "3 3 5\n#.#\n.#.\n#.#\n"}, "reference_outputs": ["1 2 2\n1 3 4\n5 5 4\n"], "source_document_id": "p02855", "source_text": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1232, "cpu_time_ms": 107, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s144306602", "group_id": "codeNet:p02856", "input_text": "program AT5668;\n const\n sqrnd=1008208820;\n var\n i,m,n:longint;\n ssum,spum,x,y:int64;\n begin\n readln(m);\n ssum:=0;\n spum:=0;\n for i:=1 to m do\n begin\n readln(x,y);\n inc(ssum,x*y);\n inc(spum,y);\n end;\n writeln((ssum-1) div 9+spum-1);\n end.\n", "language": "Pascal", "metadata": {"date": 1593477898, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02856.html", "problem_id": "p02856", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02856/input.txt", "sample_output_relpath": "derived/input_output/data/p02856/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02856/Pascal/s144306602.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s144306602", "user_id": "u678141519"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program AT5668;\n const\n sqrnd=1008208820;\n var\n i,m,n:longint;\n ssum,spum,x,y:int64;\n begin\n readln(m);\n ssum:=0;\n spum:=0;\n for i:=1 to m do\n begin\n readln(x,y);\n inc(ssum,x*y);\n inc(spum,y);\n end;\n writeln((ssum-1) div 9+spum-1);\n end.\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\nAll the N contestants will participate in the first round.\n\nWhen X contestants participate in some round, the number of contestants advancing to the next round will be decided as follows:\n\nThe organizer will choose two consecutive digits in the decimal notation of X, and replace them with the sum of these digits. The number resulted will be the number of contestants advancing to the next round.\n\nFor example, when X = 2378, the number of contestants advancing to the next round will be 578 (if 2 and 3 are chosen), 2108 (if 3 and 7 are chosen), or 2315 (if 7 and 8 are chosen).\n\nWhen X = 100, the number of contestants advancing to the next round will be 10, no matter which two digits are chosen.\n\nThe preliminary stage ends when 9 or fewer contestants remain.\n\nRingo, the chief organizer, wants to hold as many rounds as possible.\nFind the maximum possible number of rounds in the preliminary stage.\n\nSince the number of contestants, N, can be enormous, it is given to you as two integer sequences d_1, \\ldots, d_M and c_1, \\ldots, c_M, which means the following: the decimal notation of N consists of c_1 + c_2 + \\ldots + c_M digits, whose first c_1 digits are all d_1, the following c_2 digits are all d_2, \\ldots, and the last c_M digits are all d_M.\n\nConstraints\n\n1 \\leq M \\leq 200000\n\n0 \\leq d_i \\leq 9\n\nd_1 \\neq 0\n\nd_i \\neq d_{i+1}\n\nc_i \\geq 1\n\n2 \\leq c_1 + \\ldots + c_M \\leq 10^{15}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\nd_1 c_1\nd_2 c_2\n:\nd_M c_M\n\nOutput\n\nPrint the maximum possible number of rounds in the preliminary stage.\n\nSample Input 1\n\n2\n2 2\n9 1\n\nSample Output 1\n\n3\n\nIn this case, N = 229 contestants will participate in the first round. One possible progression of the preliminary stage is as follows:\n\n229 contestants participate in Round 1, 49 contestants participate in Round 2, 13 contestants participate in Round 3, and 4 contestants advance to the finals.\n\nHere, three rounds take place in the preliminary stage, which is the maximum possible number.\n\nSample Input 2\n\n3\n1 1\n0 8\n7 1\n\nSample Output 2\n\n9\n\nIn this case, 1000000007 will participate in the first round.", "sample_input": "2\n2 2\n9 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02856", "source_text": "Score: 500 points\n\nProblem Statement\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\nAll the N contestants will participate in the first round.\n\nWhen X contestants participate in some round, the number of contestants advancing to the next round will be decided as follows:\n\nThe organizer will choose two consecutive digits in the decimal notation of X, and replace them with the sum of these digits. The number resulted will be the number of contestants advancing to the next round.\n\nFor example, when X = 2378, the number of contestants advancing to the next round will be 578 (if 2 and 3 are chosen), 2108 (if 3 and 7 are chosen), or 2315 (if 7 and 8 are chosen).\n\nWhen X = 100, the number of contestants advancing to the next round will be 10, no matter which two digits are chosen.\n\nThe preliminary stage ends when 9 or fewer contestants remain.\n\nRingo, the chief organizer, wants to hold as many rounds as possible.\nFind the maximum possible number of rounds in the preliminary stage.\n\nSince the number of contestants, N, can be enormous, it is given to you as two integer sequences d_1, \\ldots, d_M and c_1, \\ldots, c_M, which means the following: the decimal notation of N consists of c_1 + c_2 + \\ldots + c_M digits, whose first c_1 digits are all d_1, the following c_2 digits are all d_2, \\ldots, and the last c_M digits are all d_M.\n\nConstraints\n\n1 \\leq M \\leq 200000\n\n0 \\leq d_i \\leq 9\n\nd_1 \\neq 0\n\nd_i \\neq d_{i+1}\n\nc_i \\geq 1\n\n2 \\leq c_1 + \\ldots + c_M \\leq 10^{15}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\nd_1 c_1\nd_2 c_2\n:\nd_M c_M\n\nOutput\n\nPrint the maximum possible number of rounds in the preliminary stage.\n\nSample Input 1\n\n2\n2 2\n9 1\n\nSample Output 1\n\n3\n\nIn this case, N = 229 contestants will participate in the first round. One possible progression of the preliminary stage is as follows:\n\n229 contestants participate in Round 1, 49 contestants participate in Round 2, 13 contestants participate in Round 3, and 4 contestants advance to the finals.\n\nHere, three rounds take place in the preliminary stage, which is the maximum possible number.\n\nSample Input 2\n\n3\n1 1\n0 8\n7 1\n\nSample Output 2\n\n9\n\nIn this case, 1000000007 will participate in the first round.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 259, "cpu_time_ms": 50, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s577404140", "group_id": "codeNet:p02856", "input_text": "program AT5668;\n const\n sqrnd=1008208820;\n var\n i,m,n:longint;\n ssum,spum,x,y:int64;\n begin\n readln(m);\n ssum:=0;\n spum:=0;\n for i:=1 to m do\n begin\n readln(x,y);\n inc(ssum,x*y);\n inc(spum,y);\n end;\n writeln(ssum div 9+spum-1);\n end.\n", "language": "Pascal", "metadata": {"date": 1593477365, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02856.html", "problem_id": "p02856", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02856/input.txt", "sample_output_relpath": "derived/input_output/data/p02856/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02856/Pascal/s577404140.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s577404140", "user_id": "u678141519"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program AT5668;\n const\n sqrnd=1008208820;\n var\n i,m,n:longint;\n ssum,spum,x,y:int64;\n begin\n readln(m);\n ssum:=0;\n spum:=0;\n for i:=1 to m do\n begin\n readln(x,y);\n inc(ssum,x*y);\n inc(spum,y);\n end;\n writeln(ssum div 9+spum-1);\n end.\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\nAll the N contestants will participate in the first round.\n\nWhen X contestants participate in some round, the number of contestants advancing to the next round will be decided as follows:\n\nThe organizer will choose two consecutive digits in the decimal notation of X, and replace them with the sum of these digits. The number resulted will be the number of contestants advancing to the next round.\n\nFor example, when X = 2378, the number of contestants advancing to the next round will be 578 (if 2 and 3 are chosen), 2108 (if 3 and 7 are chosen), or 2315 (if 7 and 8 are chosen).\n\nWhen X = 100, the number of contestants advancing to the next round will be 10, no matter which two digits are chosen.\n\nThe preliminary stage ends when 9 or fewer contestants remain.\n\nRingo, the chief organizer, wants to hold as many rounds as possible.\nFind the maximum possible number of rounds in the preliminary stage.\n\nSince the number of contestants, N, can be enormous, it is given to you as two integer sequences d_1, \\ldots, d_M and c_1, \\ldots, c_M, which means the following: the decimal notation of N consists of c_1 + c_2 + \\ldots + c_M digits, whose first c_1 digits are all d_1, the following c_2 digits are all d_2, \\ldots, and the last c_M digits are all d_M.\n\nConstraints\n\n1 \\leq M \\leq 200000\n\n0 \\leq d_i \\leq 9\n\nd_1 \\neq 0\n\nd_i \\neq d_{i+1}\n\nc_i \\geq 1\n\n2 \\leq c_1 + \\ldots + c_M \\leq 10^{15}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\nd_1 c_1\nd_2 c_2\n:\nd_M c_M\n\nOutput\n\nPrint the maximum possible number of rounds in the preliminary stage.\n\nSample Input 1\n\n2\n2 2\n9 1\n\nSample Output 1\n\n3\n\nIn this case, N = 229 contestants will participate in the first round. One possible progression of the preliminary stage is as follows:\n\n229 contestants participate in Round 1, 49 contestants participate in Round 2, 13 contestants participate in Round 3, and 4 contestants advance to the finals.\n\nHere, three rounds take place in the preliminary stage, which is the maximum possible number.\n\nSample Input 2\n\n3\n1 1\n0 8\n7 1\n\nSample Output 2\n\n9\n\nIn this case, 1000000007 will participate in the first round.", "sample_input": "2\n2 2\n9 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02856", "source_text": "Score: 500 points\n\nProblem Statement\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\nAll the N contestants will participate in the first round.\n\nWhen X contestants participate in some round, the number of contestants advancing to the next round will be decided as follows:\n\nThe organizer will choose two consecutive digits in the decimal notation of X, and replace them with the sum of these digits. The number resulted will be the number of contestants advancing to the next round.\n\nFor example, when X = 2378, the number of contestants advancing to the next round will be 578 (if 2 and 3 are chosen), 2108 (if 3 and 7 are chosen), or 2315 (if 7 and 8 are chosen).\n\nWhen X = 100, the number of contestants advancing to the next round will be 10, no matter which two digits are chosen.\n\nThe preliminary stage ends when 9 or fewer contestants remain.\n\nRingo, the chief organizer, wants to hold as many rounds as possible.\nFind the maximum possible number of rounds in the preliminary stage.\n\nSince the number of contestants, N, can be enormous, it is given to you as two integer sequences d_1, \\ldots, d_M and c_1, \\ldots, c_M, which means the following: the decimal notation of N consists of c_1 + c_2 + \\ldots + c_M digits, whose first c_1 digits are all d_1, the following c_2 digits are all d_2, \\ldots, and the last c_M digits are all d_M.\n\nConstraints\n\n1 \\leq M \\leq 200000\n\n0 \\leq d_i \\leq 9\n\nd_1 \\neq 0\n\nd_i \\neq d_{i+1}\n\nc_i \\geq 1\n\n2 \\leq c_1 + \\ldots + c_M \\leq 10^{15}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\nd_1 c_1\nd_2 c_2\n:\nd_M c_M\n\nOutput\n\nPrint the maximum possible number of rounds in the preliminary stage.\n\nSample Input 1\n\n2\n2 2\n9 1\n\nSample Output 1\n\n3\n\nIn this case, N = 229 contestants will participate in the first round. One possible progression of the preliminary stage is as follows:\n\n229 contestants participate in Round 1, 49 contestants participate in Round 2, 13 contestants participate in Round 3, and 4 contestants advance to the finals.\n\nHere, three rounds take place in the preliminary stage, which is the maximum possible number.\n\nSample Input 2\n\n3\n1 1\n0 8\n7 1\n\nSample Output 2\n\n9\n\nIn this case, 1000000007 will participate in the first round.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 48, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s980343045", "group_id": "codeNet:p02861", "input_text": "uses crt;\nvar n : int64;\ns : string;\ni,j : longint;\ncheck : array[0..10] of boolean;\na : array[0..10] of extended;\nb : array[0..10] of extended;\nkq,cnt : extended;\nfunction kc(i,j : integer) : extended;\nbegin\n if (i=0) or (j=0) then exit(0);\n exit(sqrt(sqr(a[i]-a[j]) + sqr(b[i]-b[j])));\nend;\n\nprocedure process(m,k : integer);\nvar j : integer;\nbegin\n if (m=n+1) then begin cnt := cnt + kq; exit; end;\n for j := 1 to n do\n if (check[j]=true) then begin\n kq := kq + kc(j,k);\n check[j]:=false;\n process(m+1,j);\n kq := kq - kc(j,k);\n check[j]:=true;\n end;\nend;\n\nbegin\n clrscr;\n { assign(input,'test.inp');reset(input); }\n readln(n);\n for i := 1 to n do begin readln(a[i],b[i]); check[i]:=true; end;\n { assign(output,'test.out');rewrite(output);\n clrscr; } \n process(1,0);\n kq := 1;\n for j := 1 to n do kq := kq * j;\n write(cnt/kq : 0 : 10);\n { readln;\n close(output);}\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577392369, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02861.html", "problem_id": "p02861", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02861/input.txt", "sample_output_relpath": "derived/input_output/data/p02861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02861/Pascal/s980343045.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s980343045", "user_id": "u102904647"}, "prompt_components": {"gold_output": "2.2761423749\n", "input_to_evaluate": "uses crt;\nvar n : int64;\ns : string;\ni,j : longint;\ncheck : array[0..10] of boolean;\na : array[0..10] of extended;\nb : array[0..10] of extended;\nkq,cnt : extended;\nfunction kc(i,j : integer) : extended;\nbegin\n if (i=0) or (j=0) then exit(0);\n exit(sqrt(sqr(a[i]-a[j]) + sqr(b[i]-b[j])));\nend;\n\nprocedure process(m,k : integer);\nvar j : integer;\nbegin\n if (m=n+1) then begin cnt := cnt + kq; exit; end;\n for j := 1 to n do\n if (check[j]=true) then begin\n kq := kq + kc(j,k);\n check[j]:=false;\n process(m+1,j);\n kq := kq - kc(j,k);\n check[j]:=true;\n end;\nend;\n\nbegin\n clrscr;\n { assign(input,'test.inp');reset(input); }\n readln(n);\n for i := 1 to n do begin readln(a[i],b[i]); check[i]:=true; end;\n { assign(output,'test.out');rewrite(output);\n clrscr; } \n process(1,0);\n kq := 1;\n for j := 1 to n do kq := kq * j;\n write(cnt/kq : 0 : 10);\n { readln;\n close(output);}\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "sample_input": "3\n0 0\n1 0\n0 1\n"}, "reference_outputs": ["2.2761423749\n"], "source_document_id": "p02861", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s956583243", "group_id": "codeNet:p02881", "input_text": "uses crt;\nvar\n s,i,j,n:longint;\n min,a:qword;\nbegin\n clrscr;\n read(n);\n for i:=1 to n div 2 do\n for j:=1 to n div 2 do if i*j=n then\n begin\n min:=(i-1)+(j-1);\n break;\n break;\n end;\n for i:=1 to n div 2 do\n for j:=1 to n div 2 do if i*j=n then\n begin\n a:=(i-1)+(j-1);\n if min>a then min:=a;\n end;\n write(min);\n readln;\n readln;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1577460755, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Pascal/s956583243.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s956583243", "user_id": "u344153701"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "uses crt;\nvar\n s,i,j,n:longint;\n min,a:qword;\nbegin\n clrscr;\n read(n);\n for i:=1 to n div 2 do\n for j:=1 to n div 2 do if i*j=n then\n begin\n min:=(i-1)+(j-1);\n break;\n break;\n end;\n for i:=1 to n div 2 do\n for j:=1 to n div 2 do if i*j=n then\n begin\n a:=(i-1)+(j-1);\n if min>a then min:=a;\n end;\n write(min);\n readln;\n readln;\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 523, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s034952341", "group_id": "codeNet:p02885", "input_text": "program A;\n\nvar\n a : integer;\n b : integer;\n ans : integer;\n\nbegin\n read(a);\n read(b);\n ans := a-b*2;\n if ans>=0 then\n\twrite(ans)\n else\n\twrite(0);\n\t\nend.", "language": "Pascal", "metadata": {"date": 1571967371, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02885.html", "problem_id": "p02885", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02885/input.txt", "sample_output_relpath": "derived/input_output/data/p02885/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02885/Pascal/s034952341.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s034952341", "user_id": "u423656246"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program A;\n\nvar\n a : integer;\n b : integer;\n ans : integer;\n\nbegin\n read(a);\n read(b);\n ans := a-b*2;\n if ans>=0 then\n\twrite(ans)\n else\n\twrite(0);\n\t\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "sample_input": "12 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02885", "source_text": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 153, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s820133658", "group_id": "codeNet:p02887", "input_text": "var\n n,i,sum:longint;\n x,y:char;\nbegin\n readln(n);\n read(x);\n y:=x;\n sum:=1;\nfor i:=2 to n do\n begin\n read(x);\n if x<>y then inc(sum);\n y:=x;\n end;\n write(sum);\nend.", "language": "Pascal", "metadata": {"date": 1571964272, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02887.html", "problem_id": "p02887", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02887/input.txt", "sample_output_relpath": "derived/input_output/data/p02887/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02887/Pascal/s820133658.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820133658", "user_id": "u929274582"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n n,i,sum:longint;\n x,y:char;\nbegin\n readln(n);\n read(x);\n y:=x;\n sum:=1;\nfor i:=2 to n do\n begin\n read(x);\n if x<>y then inc(sum);\n y:=x;\n end;\n write(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.\n\nAdjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.\n\nUltimately, how many slimes will be there?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the final number of slimes.\n\nSample Input 1\n\n10\naabbbbaaca\n\nSample Output 1\n\n5\n\nUltimately, these slimes will fuse into abaca.\n\nSample Input 2\n\n5\naaaaa\n\nSample Output 2\n\n1\n\nAll the slimes will fuse into one.\n\nSample Input 3\n\n20\nxxzaffeeeeddfkkkkllq\n\nSample Output 3\n\n10", "sample_input": "10\naabbbbaaca\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02887", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.\n\nAdjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.\n\nUltimately, how many slimes will be there?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the final number of slimes.\n\nSample Input 1\n\n10\naabbbbaaca\n\nSample Output 1\n\n5\n\nUltimately, these slimes will fuse into abaca.\n\nSample Input 2\n\n5\naaaaa\n\nSample Output 2\n\n1\n\nAll the slimes will fuse into one.\n\nSample Input 3\n\n20\nxxzaffeeeeddfkkkkllq\n\nSample Output 3\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s650172301", "group_id": "codeNet:p02899", "input_text": "VAR\n n, i, j : longint ;\n a, b : array [0..10000] of longint ;\nprocedure swap(var x,y : longint) ;\n var t : longint ;\n begin\n t := x ;\n x := y ;\n y :=t ;\n end ;\nBEGIN\n readln(n) ;\n for i := 1 to n do\n begin\n read(a[i]) ;\n b[i] := i ;\n end ;\n for i := 1 to n - 1 do\n for j := i + 1 to n do\n if a[i] > a[j] then\n begin\n swap(a[i],a[j]) ;\n swap(b[i],b[j]) ;\n end ;\n for i := 1 to n do write(b[i],#32) ;\n writeln ;\nEND.", "language": "Pascal", "metadata": {"date": 1569722521, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Pascal/s650172301.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s650172301", "user_id": "u731409129"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "VAR\n n, i, j : longint ;\n a, b : array [0..10000] of longint ;\nprocedure swap(var x,y : longint) ;\n var t : longint ;\n begin\n t := x ;\n x := y ;\n y :=t ;\n end ;\nBEGIN\n readln(n) ;\n for i := 1 to n do\n begin\n read(a[i]) ;\n b[i] := i ;\n end ;\n for i := 1 to n - 1 do\n for j := i + 1 to n do\n if a[i] > a[j] then\n begin\n swap(a[i],a[j]) ;\n swap(b[i],b[j]) ;\n end ;\n for i := 1 to n do write(b[i],#32) ;\n writeln ;\nEND.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 479, "cpu_time_ms": 98, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s201542469", "group_id": "codeNet:p02902", "input_text": "var\n\tN,M,i,u,v,id:Longint;\n\tGv,Gp:Array[1..2000]of Longint;\n\tGi:Array[1..1000]of Longint;\n\tcnt:Array[1..1000]of Longint;\n\tQ:Array[1..1000]of Longint;\n\tQs:Longint;\nbegin\n\tread(N,M);if (N=1000)and(00 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs990 then begin writeln(0);exit;end;\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tGv[i]:=v;\n\t\tif Gi[u]>0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs990 then begin writeln(0);exit;end;\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tGv[i]:=v;\n\t\tif Gi[u]>0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs900 then begin writeln(0);exit;end;\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tGv[i]:=v;\n\t\tif Gi[u]>0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs900 then begin writeln(0);exit;end;\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tGv[i]:=v;\n\t\tif Gi[u]>0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;Qs:=0;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile (id<=Qs)and(Qs0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;Qs:=0;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile (id<=Qs)and(Qs0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then begin\n\t\t\tGp[i]:=Gi[u];\n\t\tend;\n\t\tGi[u]:=i;\n\t\tinc(cnt[v]);\n\tend;\n\tfor i:=1 to N do begin\n\t\tif cnt[i]=0 then begin\n\t\t\tinc(Qs);\n\t\t\tQ[Qs]:=i;\n\t\tend;\n\tend;\n\tid:=1;\n\twhile id<=Qs do begin\n\t\tu:=Q[id];\n\t\tinc(id);\n\t\ti:=Gi[u];\n\t\twhile i<>0 do begin\n\t\t\tdec(cnt[Gv[i]]);\n\t\t\tif cnt[Gv[i]]=0 then begin\n\t\t\t\tinc(Qs);\n\t\t\t\tQ[Qs]:=Gv[i];\n\t\t\tend;\n\t\t\ti:=Gp[i];\n\t\tend;\n\tend;\n\tif Qs0 then writeln('Yes')else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1576443699, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Pascal/s987638797.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s987638797", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "var i,x,N,K,Q:Longint;\nA:Array[1..100000]of Longint;\nbegin\nread(N,K,Q);\nfor i:=1 to N do A[i]:=K-Q;\nfor i:=1 to Q do begin\nread(x);\ninc(A[x]);\nend;\nfor i:=1 to N do if A[i]>0 then writeln('Yes')else writeln('No');\nend.", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 17, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s499462776", "group_id": "codeNet:p02914", "input_text": "var\n i:longint;\n n,x,s:qword;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(x);\n s:=s xor x;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1582237279, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02914.html", "problem_id": "p02914", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02914/input.txt", "sample_output_relpath": "derived/input_output/data/p02914/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02914/Pascal/s499462776.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s499462776", "user_id": "u723721005"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var\n i:longint;\n n,x,s:qword;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(x);\n s:=s xor x;\n end;\n writeln(s);\nend.", "problem_context": "Score: 600 points\n\nProblem Statement\n\nWe have N non-negative integers: A_1, A_2, ..., A_N.\n\nConsider painting at least one and at most N-1 integers among them in red, and painting the rest in blue.\n\nLet the beauty of the painting be the \\mbox{XOR} of the integers painted in red, plus the \\mbox{XOR} of the integers painted in blue.\n\nFind the maximum possible beauty of the painting.\n\nWhat is \\mbox{XOR}?\n\nThe bitwise \\mbox{XOR} x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\nWhen x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i < 2^{60}\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible beauty of the painting.\n\nSample Input 1\n\n3\n3 6 5\n\nSample Output 1\n\n12\n\nIf we paint 3, 6, 5 in blue, red, blue, respectively, the beauty will be (6) + (3 \\oplus 5) = 12.\n\nThere is no way to paint the integers resulting in greater beauty than 12, so the answer is 12.\n\nSample Input 2\n\n4\n23 36 66 65\n\nSample Output 2\n\n188\n\nSample Input 3\n\n20\n1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272829 792625803473366909 972333547668684797 467386965442856573 755861732751878143 1151846447448561405 467257771752201853 683930041385277311 432010719984459389 319104378117934975 611451291444233983 647509226592964607 251832107792119421 827811265410084479 864032478037725181\n\nSample Output 3\n\n2012721721873704572\n\nA_i and the answer may not fit into a 32-bit integer type.", "sample_input": "3\n3 6 5\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02914", "source_text": "Score: 600 points\n\nProblem Statement\n\nWe have N non-negative integers: A_1, A_2, ..., A_N.\n\nConsider painting at least one and at most N-1 integers among them in red, and painting the rest in blue.\n\nLet the beauty of the painting be the \\mbox{XOR} of the integers painted in red, plus the \\mbox{XOR} of the integers painted in blue.\n\nFind the maximum possible beauty of the painting.\n\nWhat is \\mbox{XOR}?\n\nThe bitwise \\mbox{XOR} x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\nWhen x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i < 2^{60}\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible beauty of the painting.\n\nSample Input 1\n\n3\n3 6 5\n\nSample Output 1\n\n12\n\nIf we paint 3, 6, 5 in blue, red, blue, respectively, the beauty will be (6) + (3 \\oplus 5) = 12.\n\nThere is no way to paint the integers resulting in greater beauty than 12, so the answer is 12.\n\nSample Input 2\n\n4\n23 36 66 65\n\nSample Output 2\n\n188\n\nSample Input 3\n\n20\n1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272829 792625803473366909 972333547668684797 467386965442856573 755861732751878143 1151846447448561405 467257771752201853 683930041385277311 432010719984459389 319104378117934975 611451291444233983 647509226592964607 251832107792119421 827811265410084479 864032478037725181\n\nSample Output 3\n\n2012721721873704572\n\nA_i and the answer may not fit into a 32-bit integer type.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 78, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s153838661", "group_id": "codeNet:p02921", "input_text": " var a, b: longint;\n\n begin\n read(a, b);\n write(b div a + ord(b mod a > 0));\n end.\n", "language": "Pascal", "metadata": {"date": 1595451506, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02921.html", "problem_id": "p02921", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02921/input.txt", "sample_output_relpath": "derived/input_output/data/p02921/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02921/Pascal/s153838661.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s153838661", "user_id": "u685831175"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " var a, b: longint;\n\n begin\n read(a, b);\n write(b div a + ord(b mod a > 0));\n end.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "sample_input": "CSS\nCSR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02921", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 3, "memory_kb": 1376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s754533082", "group_id": "codeNet:p02923", "input_text": "var\n n,i,x,y:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n x:=i;y:=i+1;\n while h[x]>=h[y] do\n begin\n a[i]:=a[i]+1;x:=y;y:=y+1;\n end;\n end;\n x:=0;\n for i:=1 to n do\n if a[i]>x then x:=a[i];\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570225583, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s754533082.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s754533082", "user_id": "u018679195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,x,y:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n x:=i;y:=i+1;\n while h[x]>=h[y] do\n begin\n a[i]:=a[i]+1;x:=y;y:=y+1;\n end;\n end;\n x:=0;\n for i:=1 to n do\n if a[i]>x then x:=a[i];\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 335, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s141199248", "group_id": "codeNet:p02923", "input_text": "var\n n,i,x,y:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n x:=i;y:=i+1;\n while h[x]>=h[y] do\n begin\n a[i]:=a[i]+1;x:=y;y:=y+1;\n end;\n end;\n x:=0;\n for i:=1 to n do\n if a[i]>x then x:=a[i];\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570224285, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s141199248.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s141199248", "user_id": "u018679195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,x,y:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n x:=i;y:=i+1;\n while h[x]>=h[y] do\n begin\n a[i]:=a[i]+1;x:=y;y:=y+1;\n end;\n end;\n x:=0;\n for i:=1 to n do\n if a[i]>x then x:=a[i];\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 335, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s871384616", "group_id": "codeNet:p02923", "input_text": "var\n n,i,j:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n j:=i+1;\n while h[i]>=h[j] do\n begin\n a[i]:=a[i]+1;\n end;\n end;\n j:=0;\n for i:=1 to n do\n if a[i]>j then j:=a[i];\n writeln(j);\nend.", "language": "Pascal", "metadata": {"date": 1570220808, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s871384616.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s871384616", "user_id": "u018679195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,j:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n j:=i+1;\n while h[i]>=h[j] do\n begin\n a[i]:=a[i]+1;\n end;\n end;\n j:=0;\n for i:=1 to n do\n if a[i]>j then j:=a[i];\n writeln(j);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 317, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s160343661", "group_id": "codeNet:p02923", "input_text": "var\n n,i,j:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n for j:=i+1 to n do\n if h[i]>=h[j] then a[i]:=a[i]+1\n else break;\n end;\n j:=0;\n for i:=1 to n do\n if a[i]>j then j:=a[i];\n writeln(j);\nend.", "language": "Pascal", "metadata": {"date": 1570220391, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Pascal/s160343661.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s160343661", "user_id": "u089230684"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,i,j:longint;\n h,a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(h[i]);a[i]:=0;\n end;\n for i:=1 to n-1 do\n begin\n for j:=i+1 to n do\n if h[i]>=h[j] then a[i]:=a[i]+1\n else break;\n end;\n j:=0;\n for i:=1 to n do\n if a[i]>j then j:=a[i];\n writeln(j);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 310, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s026109227", "group_id": "codeNet:p02924", "input_text": "var n:int64;\nbegin\nreadln(n);\nwriteln((n*(n-1)) div 2)\nend.", "language": "Pascal", "metadata": {"date": 1599057875, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Pascal/s026109227.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s026109227", "user_id": "u984276646"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n:int64;\nbegin\nreadln(n);\nwriteln((n*(n-1)) div 2)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 59, "cpu_time_ms": 3, "memory_kb": 1320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s422662122", "group_id": "codeNet:p02928", "input_text": "const md = 1000000007;\ntype ary=array[0..2010] of int64;\nvar n,k,i,j,ans,save,count1,count2,sum1,sum2,save1,save2:int64;\n a:ary;\n \n\nbegin\nread(n,k);\nans:=0;\nsum2:=((k+1)*k div 2) mod md;\nsum1:=((k-1)*k div 2) mod md;\nfor i := 0 to n-1 do read(a[i]);\nfor i := 0 to n-1 do\nbegin\n count1:=0;count2:=0;\n for j := 0 to i-1 do\n if a[i]>a[j] then inc(count1);\n for j := i+1 to n-1 do\n if a[i]>a[j] then inc(count2);\n if (count1=0)and(count2=0) then continue;\n save1:=sum1*count1 mod md;\n save2:=sum2*count2 mod md;\n ans:=(ans+save1) mod md;\n ans:=(ans+save2) mod md;\nend;\n\n\nwrite(ans)\nend.", "language": "Pascal", "metadata": {"date": 1566699881, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02928.html", "problem_id": "p02928", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02928/input.txt", "sample_output_relpath": "derived/input_output/data/p02928/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02928/Pascal/s422662122.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s422662122", "user_id": "u655683235"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const md = 1000000007;\ntype ary=array[0..2010] of int64;\nvar n,k,i,j,ans,save,count1,count2,sum1,sum2,save1,save2:int64;\n a:ary;\n \n\nbegin\nread(n,k);\nans:=0;\nsum2:=((k+1)*k div 2) mod md;\nsum1:=((k-1)*k div 2) mod md;\nfor i := 0 to n-1 do read(a[i]);\nfor i := 0 to n-1 do\nbegin\n count1:=0;count2:=0;\n for j := 0 to i-1 do\n if a[i]>a[j] then inc(count1);\n for j := i+1 to n-1 do\n if a[i]>a[j] then inc(count2);\n if (count1=0)and(count2=0) then continue;\n save1:=sum1*count1 mod md;\n save2:=sum2*count2 mod md;\n ans:=(ans+save1) mod md;\n ans:=(ans+save2) mod md;\nend;\n\n\nwrite(ans)\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 588, "cpu_time_ms": 18, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s789810409", "group_id": "codeNet:p02935", "input_text": "var n,i,j,tmp:Longint;\nA:array[1..50]of Longint;\nans:real;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(A[i]);\nfor j:=i-1 downto 1 do begin\nif A[j]>A[j+1]then begin\ntmp:=A[j];\nA[j]:=A[j+1];\nA[j+1]:=tmp;\nend else break;\nend;\nend;\nans:=A[1];\nfor i:=2 to n do begin\nans:=(ans+A[i])/2;\nend;\nwriteln(ans:0:9);\nend.", "language": "Pascal", "metadata": {"date": 1566176854, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02935.html", "problem_id": "p02935", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02935/input.txt", "sample_output_relpath": "derived/input_output/data/p02935/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02935/Pascal/s789810409.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s789810409", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3.5\n", "input_to_evaluate": "var n,i,j,tmp:Longint;\nA:array[1..50]of Longint;\nans:real;\nbegin\nread(n);\nfor i:=1 to n do begin\nread(A[i]);\nfor j:=i-1 downto 1 do begin\nif A[j]>A[j+1]then begin\ntmp:=A[j];\nA[j]:=A[j+1];\nA[j+1]:=tmp;\nend else break;\nend;\nend;\nans:=A[1];\nfor i:=2 to n do begin\nans:=(ans+A[i])/2;\nend;\nwriteln(ans:0:9);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \\leq i \\leq N) is v_i.\n\nWhen you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.\n\nAfter you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq v_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nv_1 v_2 \\ldots v_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n3 4\n\nSample Output 1\n\n3.5\n\nIf you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.\n\nPrinting 3.50001, 3.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n500 300 200\n\nSample Output 2\n\n375\n\nYou start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:\n\nUse the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.\n\nUse the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.\n\nUse the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.\n\nThus, the maximum possible value of the last ingredient remaining is 375.\n\nPrinting 375.0 and so on will also be accepted.\n\nSample Input 3\n\n5\n138 138 138 138 138\n\nSample Output 3\n\n138", "sample_input": "2\n3 4\n"}, "reference_outputs": ["3.5\n"], "source_document_id": "p02935", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \\leq i \\leq N) is v_i.\n\nWhen you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.\n\nAfter you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq v_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nv_1 v_2 \\ldots v_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n3 4\n\nSample Output 1\n\n3.5\n\nIf you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.\n\nPrinting 3.50001, 3.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n500 300 200\n\nSample Output 2\n\n375\n\nYou start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:\n\nUse the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.\n\nUse the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.\n\nUse the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.\n\nThus, the maximum possible value of the last ingredient remaining is 375.\n\nPrinting 375.0 and so on will also be accepted.\n\nSample Input 3\n\n5\n138 138 138 138 138\n\nSample Output 3\n\n138", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s344266957", "group_id": "codeNet:p02937", "input_text": "var s,t:string;\n chars:set of char;\n c:char;\n i:int64;\n flag:boolean;\nbegin\nreadln(s);\nread(t);\ni:=1;\nflag:=false;\nchars:=[];\nwhile not(ord(s[i]) in [10,26,32]) do \nbegin\nchars:=chars+[s[i]];\ninc(i)\nend;\n\nwhile not(ord(t[i]) in [10,26,32]) do\nif not (t[i] in chars) then flag:=true;\n\nif flag then write(-1);\nend.", "language": "Pascal", "metadata": {"date": 1566182390, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02937.html", "problem_id": "p02937", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02937/input.txt", "sample_output_relpath": "derived/input_output/data/p02937/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02937/Pascal/s344266957.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s344266957", "user_id": "u655683235"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var s,t:string;\n chars:set of char;\n c:char;\n i:int64;\n flag:boolean;\nbegin\nreadln(s);\nread(t);\ni:=1;\nflag:=false;\nchars:=[];\nwhile not(ord(s[i]) in [10,26,32]) do \nbegin\nchars:=chars+[s[i]];\ninc(i)\nend;\n\nwhile not(ord(t[i]) in [10,26,32]) do\nif not (t[i] in chars) then flag:=true;\n\nif flag then write(-1);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "contest\nson\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02937", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 2103, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s482321363", "group_id": "codeNet:p02938", "input_text": "var\n\tM,L,R,ans,ll,rr:int64;\n k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;\n dp:array[1..60,1..2,1..2]of int64;\nbegin\n\tread(L,R);\n M:=1000000007;\n ll:=1;\n rr:=2;\n for k:=1 to 60 do begin\n \tif(rr<=L)or(R>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n if(limx=1)and(limy=1)then begin\n \tdp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;\n end else if(limx=0)and(limy=1)then begin\n \tdp[i+1,xl,2]:=(dp[i+1,xl,2]+dp[i,xl,yl])mod M;\n dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;\n dp[i+1,2,yl]:=(dp[i+1,2,yl]+dp[i,xl,yl])mod M;\n end else if(limx=0)and(limy=0)then begin\n \tdp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;\n end;\n end;\n end;\n end;\n ll:=ll*2;\n rr:=rr*2;\n ans:=(ans+dp[k,1,1]+dp[k,1,2]+dp[k,2,1]+dp[k,2,2])mod M;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1566182412, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02938.html", "problem_id": "p02938", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02938/input.txt", "sample_output_relpath": "derived/input_output/data/p02938/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02938/Pascal/s482321363.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s482321363", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\tM,L,R,ans,ll,rr:int64;\n k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;\n dp:array[1..60,1..2,1..2]of int64;\nbegin\n\tread(L,R);\n M:=1000000007;\n ll:=1;\n rr:=2;\n for k:=1 to 60 do begin\n \tif(rr<=L)or(R>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n if(limx=1)and(limy=1)then begin\n \tdp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;\n end else if(limx=0)and(limy=1)then begin\n \tdp[i+1,xl,2]:=(dp[i+1,xl,2]+dp[i,xl,yl])mod M;\n dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;\n dp[i+1,2,yl]:=(dp[i+1,2,yl]+dp[i,xl,yl])mod M;\n end else if(limx=0)and(limy=0)then begin\n \tdp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;\n end;\n end;\n end;\n end;\n ll:=ll*2;\n rr:=rr*2;\n ans:=(ans+dp[k,1,1]+dp[k,1,2]+dp[k,2,1]+dp[k,2,2])mod M;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \\leq x \\leq y \\leq R) such that the remainder when y is divided by x is equal to y \\mbox{ XOR } x.\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n1 \\leq L \\leq R \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the number of pairs of integers (x, y) (L \\leq x \\leq y \\leq R) satisfying the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3\n\nThree pairs satisfy the condition: (2, 2), (2, 3), and (3, 3).\n\nSample Input 2\n\n10 100\n\nSample Output 2\n\n604\n\nSample Input 3\n\n1 1000000000000000000\n\nSample Output 3\n\n68038601\n\nBe sure to compute the number modulo 10^9 + 7.", "sample_input": "2 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02938", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \\leq x \\leq y \\leq R) such that the remainder when y is divided by x is equal to y \\mbox{ XOR } x.\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n1 \\leq L \\leq R \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R\n\nOutput\n\nPrint the number of pairs of integers (x, y) (L \\leq x \\leq y \\leq R) satisfying the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3\n\nThree pairs satisfy the condition: (2, 2), (2, 3), and (3, 3).\n\nSample Input 2\n\n10 100\n\nSample Output 2\n\n604\n\nSample Input 3\n\n1 1000000000000000000\n\nSample Output 3\n\n68038601\n\nBe sure to compute the number modulo 10^9 + 7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1624, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s548346601", "group_id": "codeNet:p02938", "input_text": "var\n\tM,L,R,ans,ll,rr:int64;\n k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;\n dp:array[1..60,1..2,1..2]of int64;\nbegin\n\tread(L,R);\n M:=1000000007;\n ll:=1;\n rr:=2;\n for k:=1 to 60 do begin\n \tif(rr<=L)or(R>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy>(k-1-i))mod 2;\n y:=(R>>(k-1-i))mod 2;\n for xl:=1 to 2 do begin\n \tif xl=1 then limx:=x else limx:=0;\n for yl:=1 to 2 do begin\n \tif dp[i,xl,yl]=0 then continue;\n \tif yl=1 then limy:=y else limy:=1;\n for yy:=0 to limy do begin\n \tfor xx:=limx to yy do begin\n \tif(xl=2)or(xx>limx)then id:=2 else id:=1;\n if(yl=2)or(yy Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1565585488, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Pascal/s744422096.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s744422096", "user_id": "u492212770"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "type\n pair = record\n a : longint;\n b : longint;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:longint;\n input:pairArray;\n heap:array[0..100000] of longint;\n\nprocedure swap(var X, Y: longint);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1797, "cpu_time_ms": 39, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s836217593", "group_id": "codeNet:p02948", "input_text": "type\n pair = record\n a : longint;\n b : longint;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:longint;\n input:pairArray;\n heap:array[0..100000] of longint;\n\nprocedure swap(var X, Y: longint);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n if heap[0]>1 then begin\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1565582563, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Pascal/s836217593.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s836217593", "user_id": "u492212770"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "type\n pair = record\n a : longint;\n b : longint;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:longint;\n input:pairArray;\n heap:array[0..100000] of longint;\n\nprocedure swap(var X, Y: longint);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:longint);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:longint;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n if heap[0]>1 then begin\n p := 1;\n while (p*2 <= heap[0]) and (heap[p]0 then ans := ans + downheap\n end;\n writeln(ans)\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1847, "cpu_time_ms": 39, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s092339802", "group_id": "codeNet:p02948", "input_text": "type\n pair = record\n a : int64;\n b : integer;\n end;\n\tpairArray = array[1..100000] of pair;\n\nvar ans,i,j,n,m:integer;\n input:pairArray;\n heap:array[0..100000] of integer;\n\nprocedure swap(var X, Y: integer);\nbegin\n\tif X <> Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:integer;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and ((heap[p] Y then begin\n\t\tX := X xor Y;\n\t\tY := X xor Y;\n\t\tX := X xor Y\n\tend\nend;\n\nprocedure\tpswap(var a,b:pair);\nvar tmp:pair;\nbegin\n\ttmp:=a;\n\ta:=b;\n\tb:=tmp\nend;\n\nprocedure QuickSort(var a:pairArray;start_index,end_index:integer);\nvar i,j,x:int64;\nbegin\n\tx:=a[(start_index+end_index)div 2].a;\n\ti:=start_index;\n\tj:=end_index;\n\twhile(true)do\n\tbegin\n\t\twhile(a[i].a1) and (heap[p]>heap[p div 2]) do begin\n swap(heap[p],heap[p div 2]);\n p := p div 2\n end\nend;\n\nfunction downheap:integer;\nvar p:integer;\nbegin\n downheap:=heap[1];\n heap[1] := heap[heap[0]];\n heap[0] := heap[0] - 1;\n p := 1;\n while (p*2 <= heap[0]) and ((heap[p] 0) and (a[i] = 0)) or ((f[i] = 0) and (a[i] > 0)) then exit(false);\n exit(true); \nend;\n\nbegin\n\ti:=0;\n\twhile not eoln do \n\t begin\n\t inc(i);\n\t read(s[i]);\n\t end;\n\tn:=i; cnt:=0;\n\tfor i:=1 to n do F[i]:=1;\n\trepeat\n\t for i:=1 to n do a[i]:=f[i];\n\t for i:=1 to n do f[i]:=0;\n\t for i:=1 to n do\n\t begin\n\t if (a[i] > 0) and (s[i] = 'R') then f[i+1]:=f[i+1] + a[i];\n if (a[i] > 0) and (s[i] = 'L') then f[i-1]:=a[i] + f[i-1]; \n\t end;\n\t inc(cnt);\n\t if check then break;\n\tuntil false;\n\tif cnt mod 2 = 1 then\n\t begin\n\t for i:=1 to n do a[i]:=f[i];\n\t for i:=1 to n do f[i]:=0;\n\t for i:=1 to n do\n\t\t begin\n\t\t if (a[i] > 0) and (s[i] = 'R') then\n\t\t begin\n\t\t f[i+1]:=f[i+1] + a[i]; a[i]:=0;\n\t\t end;\n\t if (a[i] > 0) and (s[i] = 'L') then\n\t begin\n\t f[i-1]:=a[i] + f[i-1]; a[i]:=0;\n\t end;\n\t\t end;\n\t end;\n\tfor i:=1 to n do write(f[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1564976465, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02954.html", "problem_id": "p02954", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02954/input.txt", "sample_output_relpath": "derived/input_output/data/p02954/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02954/Pascal/s789505564.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s789505564", "user_id": "u017143931"}, "prompt_components": {"gold_output": "0 1 2 1 1\n", "input_to_evaluate": "const maxn = trunc(1e5);\nvar s:array[1..maxn] of char;\n f,a:array[0..maxn + 1] of longint;\n i,n,cnt:longint;\n\nfunction check:boolean;\nvar i:longint;\nbegin\n for i:=1 to n do\n if ((f[i] > 0) and (a[i] = 0)) or ((f[i] = 0) and (a[i] > 0)) then exit(false);\n exit(true); \nend;\n\nbegin\n\ti:=0;\n\twhile not eoln do \n\t begin\n\t inc(i);\n\t read(s[i]);\n\t end;\n\tn:=i; cnt:=0;\n\tfor i:=1 to n do F[i]:=1;\n\trepeat\n\t for i:=1 to n do a[i]:=f[i];\n\t for i:=1 to n do f[i]:=0;\n\t for i:=1 to n do\n\t begin\n\t if (a[i] > 0) and (s[i] = 'R') then f[i+1]:=f[i+1] + a[i];\n if (a[i] > 0) and (s[i] = 'L') then f[i-1]:=a[i] + f[i-1]; \n\t end;\n\t inc(cnt);\n\t if check then break;\n\tuntil false;\n\tif cnt mod 2 = 1 then\n\t begin\n\t for i:=1 to n do a[i]:=f[i];\n\t for i:=1 to n do f[i]:=0;\n\t for i:=1 to n do\n\t\t begin\n\t\t if (a[i] > 0) and (s[i] = 'R') then\n\t\t begin\n\t\t f[i+1]:=f[i+1] + a[i]; a[i]:=0;\n\t\t end;\n\t if (a[i] > 0) and (s[i] = 'L') then\n\t begin\n\t f[i-1]:=a[i] + f[i-1]; a[i]:=0;\n\t end;\n\t\t end;\n\t end;\n\tfor i:=1 to n do write(f[i],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "sample_input": "RRLRL\n"}, "reference_outputs": ["0 1 2 1 1\n"], "source_document_id": "p02954", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1137, "cpu_time_ms": 2103, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s963503854", "group_id": "codeNet:p02959", "input_text": "var\n\tN,i,t:Longint;\n\tans:int64;\n\tA,B:Array[1..100001]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N+1 do read(A[i]);\n\tfor i:=1 to N do read(B[i]);\n\tfor i:=1 to N do begin\n\t\tt:=A[i];\n\t\tif t>B[i] then t:=B[i];\n\t\tinc(ans,t);\n\t\tdec(B[i],t);\n\t\tt:=B[i];\n\t\tif t>A[i+1] then t:=A[i+1];\n\t\tinc(ans,t);\n\t\tdec(A[i+1],t);\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1582030380, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02959.html", "problem_id": "p02959", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02959/input.txt", "sample_output_relpath": "derived/input_output/data/p02959/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02959/Pascal/s963503854.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s963503854", "user_id": "u657913472"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n\tN,i,t:Longint;\n\tans:int64;\n\tA,B:Array[1..100001]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N+1 do read(A[i]);\n\tfor i:=1 to N do read(B[i]);\n\tfor i:=1 to N do begin\n\t\tt:=A[i];\n\t\tif t>B[i] then t:=B[i];\n\t\tinc(ans,t);\n\t\tdec(B[i],t);\n\t\tt:=B[i];\n\t\tif t>A[i+1] then t:=A[i+1];\n\t\tinc(ans,t);\n\t\tdec(A[i+1],t);\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\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\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "sample_input": "2\n3 5 2\n4 5\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02959", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\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\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 331, "cpu_time_ms": 33, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s497824020", "group_id": "codeNet:p02959", "input_text": "const maxn = trunc(1e5);\nvar a,b:array[1..maxn + 2] of longint;\n i,n:longint;\n re:int64;\n\nbegin\n\treadln(n);\n\tfor i:=1 to n + 1 do read(a[i]);\n\tfor i:=1 to n do read(b[i]);\n\tre:=0; b[n+1]:=0; a[n+2]:=0;\n\tfor i:=1 to n + 1 do \n\t\t begin\n\t\t if a[i] >= b[i] then \n\t\t begin\n\t\t re:= re + b[i];\n\t b[i]:=0;\n\t\t end\n\t\t else\n\t\t begin\n\t\t re:= re + a[i];\n\t\t b[i]:=b[i] - a[i];\n\t if a[i+1] >= b[i] then \n\t begin\n\t re:= re + b[i];\n\t a[i+1]:=a[i+1] - b[i];\n\t b[i]:=0;\n\t end\n\t else \n\t begin\n\t re:= re + a[i+1];\n\t a[i+1]:=0; b[i]:=0;\n\t end;\n\t\t end;\n\t\t end;\n\twrite(re);\nend.", "language": "Pascal", "metadata": {"date": 1564278101, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02959.html", "problem_id": "p02959", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02959/input.txt", "sample_output_relpath": "derived/input_output/data/p02959/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02959/Pascal/s497824020.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s497824020", "user_id": "u017143931"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "const maxn = trunc(1e5);\nvar a,b:array[1..maxn + 2] of longint;\n i,n:longint;\n re:int64;\n\nbegin\n\treadln(n);\n\tfor i:=1 to n + 1 do read(a[i]);\n\tfor i:=1 to n do read(b[i]);\n\tre:=0; b[n+1]:=0; a[n+2]:=0;\n\tfor i:=1 to n + 1 do \n\t\t begin\n\t\t if a[i] >= b[i] then \n\t\t begin\n\t\t re:= re + b[i];\n\t b[i]:=0;\n\t\t end\n\t\t else\n\t\t begin\n\t\t re:= re + a[i];\n\t\t b[i]:=b[i] - a[i];\n\t if a[i+1] >= b[i] then \n\t begin\n\t re:= re + b[i];\n\t a[i+1]:=a[i+1] - b[i];\n\t b[i]:=0;\n\t end\n\t else \n\t begin\n\t re:= re + a[i+1];\n\t a[i+1]:=0; b[i]:=0;\n\t end;\n\t\t end;\n\t\t end;\n\twrite(re);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\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\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "sample_input": "2\n3 5 2\n4 5\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02959", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\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\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 746, "cpu_time_ms": 33, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s894902357", "group_id": "codeNet:p02963", "input_text": "var\n\tL,R,M,S:int64;\nbegin\n\tread(S);\n\tL:=0;\n\tR:=1000000001;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif M*M<=S then\n\t\t\tL:=M\n\t\telse\n\t\t\tR:=M;\n\tend;\n\twriteln('0 0 ',R,' 1 ',R*R-S,' ',R);\nend.\n", "language": "Pascal", "metadata": {"date": 1563757791, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02963.html", "problem_id": "p02963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02963/input.txt", "sample_output_relpath": "derived/input_output/data/p02963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02963/Pascal/s894902357.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s894902357", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 0 2 2 0 1\n", "input_to_evaluate": "var\n\tL,R,M,S:int64;\nbegin\n\tread(S);\n\tL:=0;\n\tR:=1000000001;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\tif M*M<=S then\n\t\t\tL:=M\n\t\telse\n\t\t\tR:=M;\n\tend;\n\twriteln('0 0 ',R,' 1 ',R*R-S,' ',R);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "sample_input": "3\n"}, "reference_outputs": ["1 0 2 2 0 1\n"], "source_document_id": "p02963", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s873664998", "group_id": "codeNet:p02969", "input_text": "var\n\tn : integer;\n\t\nbegin\n\treadln(n);\n\twrite(3*n*n);\nend.", "language": "Pascal", "metadata": {"date": 1577221784, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02969.html", "problem_id": "p02969", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02969/input.txt", "sample_output_relpath": "derived/input_output/data/p02969/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02969/Pascal/s873664998.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s873664998", "user_id": "u353919145"}, "prompt_components": {"gold_output": "48\n", "input_to_evaluate": "var\n\tn : integer;\n\t\nbegin\n\treadln(n);\n\twrite(3*n*n);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "sample_input": "4\n"}, "reference_outputs": ["48\n"], "source_document_id": "p02969", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s297188843", "group_id": "codeNet:p02970", "input_text": "Uses math;\nvar n,d:int64;\nbegin\nread(n,d);\nwrite(ceil(n / (2*d+1)))\nend.", "language": "Pascal", "metadata": {"date": 1563671267, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02970.html", "problem_id": "p02970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02970/input.txt", "sample_output_relpath": "derived/input_output/data/p02970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02970/Pascal/s297188843.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s297188843", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Uses math;\nvar n,d:int64;\nbegin\nread(n,d);\nwrite(ceil(n / (2*d+1)))\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "sample_input": "6 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02970", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 72, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s771771963", "group_id": "codeNet:p02975", "input_text": "var n,i,x,j:int64;\n a:array[1..3,1..2]of int64;\n flag:boolean;\nbegin\nread(n);\nfor i := 1 to 3 do a[i,1]:=-1;\nfor i := 1 to n do\n begin\n read(x);\n\n for j := 1 to 3 do\n begin\n flag:=false;\n \n if a[j,1]=x then \n begin\n flag:=true;\n inc(a[j,2]);\n break end;\n \n if a[j,1] < 0 then \n begin\n a[j,1]:=x;\n inc(a[j,2]);\n flag:=true;\n break end;\n end;\n \n if not flag then break;\nend;\n \n if not flag then write('No');\n if flag then \n if ((a[1,2]=a[2,2])and(a[1,2]=a[3,2]))or\n (((a[1,2]=2*a[2,2])or(a[2,2]=2*a[1,2]))and(a[3,2]=0))\n or(a[1,2]=n) then write('Yes') \n else write('No');\n \n \nend.", "language": "Pascal", "metadata": {"date": 1563160261, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02975.html", "problem_id": "p02975", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02975/input.txt", "sample_output_relpath": "derived/input_output/data/p02975/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02975/Pascal/s771771963.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s771771963", "user_id": "u655683235"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var n,i,x,j:int64;\n a:array[1..3,1..2]of int64;\n flag:boolean;\nbegin\nread(n);\nfor i := 1 to 3 do a[i,1]:=-1;\nfor i := 1 to n do\n begin\n read(x);\n\n for j := 1 to 3 do\n begin\n flag:=false;\n \n if a[j,1]=x then \n begin\n flag:=true;\n inc(a[j,2]);\n break end;\n \n if a[j,1] < 0 then \n begin\n a[j,1]:=x;\n inc(a[j,2]);\n flag:=true;\n break end;\n end;\n \n if not flag then break;\nend;\n \n if not flag then write('No');\n if flag then \n if ((a[1,2]=a[2,2])and(a[1,2]=a[3,2]))or\n (((a[1,2]=2*a[2,2])or(a[2,2]=2*a[1,2]))and(a[3,2]=0))\n or(a[1,2]=n) then write('Yes') \n else write('No');\n \n \nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\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 answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02975", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\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 answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 602, "cpu_time_ms": 15, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s164352781", "group_id": "codeNet:p02975", "input_text": "var n,i,x,j:int64;\n a:array[1..3,1..2]of int64;\n flag:boolean;\nbegin\nread(n);\nfor i := 1 to 3 do a[i,1]:=-1;\nfor i := 1 to n do\n begin\n read(x);\n\n for j := 1 to 3 do\n begin\n flag:=false;\n \n if a[j,1]=x then \n begin\n flag:=true;\n inc(a[j,2]);\n break end;\n \n if a[j,1] < 0 then \n begin\n a[j,1]:=x;\n inc(a[j,2]);\n flag:=true;\n break end;\n end;\n \n if not flag then break;\nend;\n \n if not flag then write('No');\n if flag then \n if ((a[1,2]=a[2,2])and(a[1,2]=a[3,2]))or\n (a[1,2]=2*a[2,2])or(a[2,2]=2*a[1,2])or\n (a[1,2]=n) then write('Yes') \n else write('No');\n \n \nend.", "language": "Pascal", "metadata": {"date": 1563159938, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02975.html", "problem_id": "p02975", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02975/input.txt", "sample_output_relpath": "derived/input_output/data/p02975/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02975/Pascal/s164352781.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s164352781", "user_id": "u655683235"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var n,i,x,j:int64;\n a:array[1..3,1..2]of int64;\n flag:boolean;\nbegin\nread(n);\nfor i := 1 to 3 do a[i,1]:=-1;\nfor i := 1 to n do\n begin\n read(x);\n\n for j := 1 to 3 do\n begin\n flag:=false;\n \n if a[j,1]=x then \n begin\n flag:=true;\n inc(a[j,2]);\n break end;\n \n if a[j,1] < 0 then \n begin\n a[j,1]:=x;\n inc(a[j,2]);\n flag:=true;\n break end;\n end;\n \n if not flag then break;\nend;\n \n if not flag then write('No');\n if flag then \n if ((a[1,2]=a[2,2])and(a[1,2]=a[3,2]))or\n (a[1,2]=2*a[2,2])or(a[2,2]=2*a[1,2])or\n (a[1,2]=n) then write('Yes') \n else write('No');\n \n \nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\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 answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02975", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\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 answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 582, "cpu_time_ms": 15, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s290877893", "group_id": "codeNet:p02988", "input_text": "uses math;\nvar i,n,j,max1,max2,res:longint;\n a,b:array[1..20] of integer;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=2 to n - 1 do \n begin\n max1:=0; max2:=0;\n for j:=i- 1 to i + 1 do \n max1:=max(max1,a[j]);\n for j:=i - 1 to i + 1 do \n if (a[j] > max2) and (a[j] <> max1) then max2:=a[j];\n b[max2]:=1;\n end;\n for i:=1 to n do if b[i] = 1 then inc(res);\n write(res)\nend.", "language": "Pascal", "metadata": {"date": 1562032710, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02988.html", "problem_id": "p02988", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02988/input.txt", "sample_output_relpath": "derived/input_output/data/p02988/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02988/Pascal/s290877893.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s290877893", "user_id": "u482388085"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar i,n,j,max1,max2,res:longint;\n a,b:array[1..20] of integer;\nbegin\n readln(n);\n for i:=1 to n do read(a[i]);\n for i:=2 to n - 1 do \n begin\n max1:=0; max2:=0;\n for j:=i- 1 to i + 1 do \n max1:=max(max1,a[j]);\n for j:=i - 1 to i + 1 do \n if (a[j] > max2) and (a[j] <> max1) then max2:=a[j];\n b[max2]:=1;\n end;\n for i:=1 to n do if b[i] = 1 then inc(res);\n write(res)\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\n\nPrint the number of elements p_i (1 < i < n) that satisfy the following condition:\n\np_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 20\n\np is a permutation of {1,\\ 2,\\ ...,\\ n}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\np_1 p_2 ... p_n\n\nOutput\n\nPrint the number of elements p_i (1 < i < n) that satisfy the condition.\n\nSample Input 1\n\n5\n1 3 5 4 2\n\nSample Output 1\n\n2\n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5. Also, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 = 2. These two elements satisfy the condition.\n\nSample Input 2\n\n9\n9 6 3 2 5 8 7 4 1\n\nSample Output 2\n\n5", "sample_input": "5\n1 3 5 4 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02988", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\n\nPrint the number of elements p_i (1 < i < n) that satisfy the following condition:\n\np_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 20\n\np is a permutation of {1,\\ 2,\\ ...,\\ n}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\np_1 p_2 ... p_n\n\nOutput\n\nPrint the number of elements p_i (1 < i < n) that satisfy the condition.\n\nSample Input 1\n\n5\n1 3 5 4 2\n\nSample Output 1\n\n2\n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5. Also, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 = 2. These two elements satisfy the condition.\n\nSample Input 2\n\n9\n9 6 3 2 5 8 7 4 1\n\nSample Output 2\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s881347507", "group_id": "codeNet:p02989", "input_text": "var\n\tN,i:Longint;\n\td:Array[1..100000]of Longint;\nfunction bs(x:Longint):Longint;\nvar L,R,M,cnt,i:Longint;\nbegin\n\tL:=0;\n\tR:=100000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\tcnt:=0;\n\t\tfor i:=1 to N do if d[i]<=M then inc(cnt);\n\t\tif cnt>=x then R:=M else L:=M;\n\tend;\n\tbs:=R;\nend;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(d[i]);\n\twriteln(bs(N div 2+1)-bs(N div 2));\nend.\n", "language": "Pascal", "metadata": {"date": 1582030014, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Pascal/s881347507.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s881347507", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tN,i:Longint;\n\td:Array[1..100000]of Longint;\nfunction bs(x:Longint):Longint;\nvar L,R,M,cnt,i:Longint;\nbegin\n\tL:=0;\n\tR:=100000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\tcnt:=0;\n\t\tfor i:=1 to N do if d[i]<=M then inc(cnt);\n\t\tif cnt>=x then R:=M else L:=M;\n\tend;\n\tbs:=R;\nend;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(d[i]);\n\twriteln(bs(N div 2+1)-bs(N div 2));\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 365, "cpu_time_ms": 28, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s409449956", "group_id": "codeNet:p02989", "input_text": "Program Catcoder1;\n//uses crt;\nvar A:array[1..1000000] of longint;\n i,n,s:longint;\n//--------------------------------\nprocedure QS(l,r :longint);\nvar i,j,x,temp :longint;\nbegin\ni:=l;\nj:=r;\nx:=A[(l+r) div 2];\nrepeat\nWhile A[i]x do dec(j);\nif i<=j then begin\n temp:=A[i];\n A[i]:=A[j];\n A[j]:=temp;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif il then QS(l,j);\nend;\n//------------------------------------\nbegin\nreadln(n);\nfor i:=1 to n do begin\n read(A[i]);\n end;\nQS(1,n);\ns:=A[(n div 2)+1]-A[n div 2];\nWriteln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1561858071, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Pascal/s409449956.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s409449956", "user_id": "u014341649"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Program Catcoder1;\n//uses crt;\nvar A:array[1..1000000] of longint;\n i,n,s:longint;\n//--------------------------------\nprocedure QS(l,r :longint);\nvar i,j,x,temp :longint;\nbegin\ni:=l;\nj:=r;\nx:=A[(l+r) div 2];\nrepeat\nWhile A[i]x do dec(j);\nif i<=j then begin\n temp:=A[i];\n A[i]:=A[j];\n A[j]:=temp;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif il then QS(l,j);\nend;\n//------------------------------------\nbegin\nreadln(n);\nfor i:=1 to n do begin\n read(A[i]);\n end;\nQS(1,n);\ns:=A[(n div 2)+1]-A[n div 2];\nWriteln(s);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 664, "cpu_time_ms": 20, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s736195643", "group_id": "codeNet:p02990", "input_text": "const modP = 1000000007;\nvar Kcomb,NKcomb,inv:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n \n inv[1]:=1;\n for i:=2 to k do begin\n inv[i]:=1;\n p:=modP-2;\n j:=i;\n while p>0 do begin\n if (p and 1)>0 then inv[i]:=inv[i]*j mod modP;\n j:=j*j mod modP;\n p:=p >> 1;\n end;\n end;\n \n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)*inv[i] mod modP ;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)*inv[i] mod modP;\n NKcomb[m-i]:=NKcomb[i];\n end;\n \n for i:=1 to k do begin\n if i<=n-k+1 then begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP) mod modP;\n writeln(b);\n end else writeln(0);\n end;\n \nend.\n", "language": "Pascal", "metadata": {"date": 1562164589, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s736195643.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s736195643", "user_id": "u805277811"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const modP = 1000000007;\nvar Kcomb,NKcomb,inv:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n \n inv[1]:=1;\n for i:=2 to k do begin\n inv[i]:=1;\n p:=modP-2;\n j:=i;\n while p>0 do begin\n if (p and 1)>0 then inv[i]:=inv[i]*j mod modP;\n j:=j*j mod modP;\n p:=p >> 1;\n end;\n end;\n \n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)*inv[i] mod modP ;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)*inv[i] mod modP;\n NKcomb[m-i]:=NKcomb[i];\n end;\n \n for i:=1 to k do begin\n if i<=n-k+1 then begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP) mod modP;\n writeln(b);\n end else writeln(0);\n end;\n \nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s516322090", "group_id": "codeNet:p02990", "input_text": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\n {\nif k>n-k+1 then begin\nfor i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to k do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n }\n \n for i:=1 to k do begin\n if i<=n-k+1 then begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP) mod modP;\n writeln(b);\n end else writeln(0);\n end;\n \nend.\n", "language": "Pascal", "metadata": {"date": 1562123519, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s516322090.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s516322090", "user_id": "u805277811"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\n {\nif k>n-k+1 then begin\nfor i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to k do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n }\n \n for i:=1 to k do begin\n if i<=n-k+1 then begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP) mod modP;\n writeln(b);\n end else writeln(0);\n end;\n \nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 921, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s542032093", "group_id": "codeNet:p02990", "input_text": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\n {\nif k>n-k+1 then begin\n for i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to n do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n }\n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1562120607, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s542032093.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s542032093", "user_id": "u805277811"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\n {\nif k>n-k+1 then begin\n for i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to n do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n }\n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 852, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s807829212", "group_id": "codeNet:p02990", "input_text": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\nif k>n-k+1 then begin\n for i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to n do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1562117986, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s807829212.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s807829212", "user_id": "u805277811"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const modP = 1000000007;\nvar Kcomb,NKcomb:array[0..2010]of int64;\n i,j,k,a,b,n,m,p:int64;\n \nbegin\n readln(n,k);\n NKcomb[0]:=1; NKcomb[n-k+1]:=1;\n Kcomb[0]:=1; Kcomb[k-1]:=1;\n for i:=1 to (k+1)div 2 do begin\n a:=k-i;\n Kcomb[i]:=(Kcomb[i-1] mod modP)*(a mod modP)div i;\n Kcomb[k-1-i]:=Kcomb[i];\n end;\n m:=n-k+1;\n for i:=1 to (m+1)div 2 do begin\n a:=m-i+1;\n NKcomb[i]:=(NKcomb[i-1] mod modP)*(a mod modP)div i;\n NKcomb[m-i]:=NKcomb[i];\n end;\nif k>n-k+1 then begin\n for i:=1 to n-k+1 do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\n for i:=n-k+2 to n do writeln(0);\nend\nelse \n for i:=1 to k do begin\n b:=(NKcomb[i] mod modP)*(Kcomb[i-1] mod modP);\n writeln(b);\n end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s477634696", "group_id": "codeNet:p02990", "input_text": "const md=1000000007;\nvar n,k,i,nk1,red,r,blue,b:int64;\n\nfunction perm(p,l:int64):int64;\n var q,j:int64;\nbegin q :=1;\n for j:=p-l+1 to p do q:=q*j mod md;\n perm:=q;\nend;\nfunction fact(p:int64):int64;\nbegin fact:=perm(p,p) end;\nbegin\nread(n,k);nk1:=n-k+1;\nwriteln(nk1);\nfor i := 2 to k do \n if i <= nk1 then\n begin \n blue:=(perm(k-1,k-i) div fact(i-1))mod md;\n red:= (perm(nk1,nk1-i) div fact(i))mod md;\n writeln(red*blue mod md)\n end\n else write(0);\nend.", "language": "Pascal", "metadata": {"date": 1561863552, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s477634696.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s477634696", "user_id": "u655683235"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const md=1000000007;\nvar n,k,i,nk1,red,r,blue,b:int64;\n\nfunction perm(p,l:int64):int64;\n var q,j:int64;\nbegin q :=1;\n for j:=p-l+1 to p do q:=q*j mod md;\n perm:=q;\nend;\nfunction fact(p:int64):int64;\nbegin fact:=perm(p,p) end;\nbegin\nread(n,k);nk1:=n-k+1;\nwriteln(nk1);\nfor i := 2 to k do \n if i <= nk1 then\n begin \n blue:=(perm(k-1,k-i) div fact(i-1))mod md;\n red:= (perm(nk1,nk1-i) div fact(i))mod md;\n writeln(red*blue mod md)\n end\n else write(0);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 456, "cpu_time_ms": 25, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s063996732", "group_id": "codeNet:p02990", "input_text": "const base = trunc(1e9) + 7;\nvar f:array[0..2000] of int64;\n n,k,i:integer;\n re,x1,x2,a:int64;\n\nprocedure init;\nvar i:integer;\nbegin\n\tf[0]:=1;\n\tf[1]:=1;\n\tfor i:=2 to 2000 do f[i]:= (f[i - 1] * i) mod base;\nend;\n\nfunction power(a,b:int64):int64;\nvar tmp:int64;\nbegin\n\tif b = 0 then exit(1);\n\tif b = 1 then exit(a);\n\ttmp:= power(a,b shr 1);\n\tif b mod 2 = 0 then power:= (tmp * tmp) mod base\n\telse power:= (((tmp * tmp) mod base) * a) mod base;\nend;\n\nfunction calc(n,k:integer):int64;\nbegin\n\tcalc:= (f[n] * power(f[k] * f[n - k], base - 2) mod base) mod base;\nend;\n\nbegin\n\treadln(n,k);\n\tinit;\n\tfor i:=1 to k do \n\t begin\n\t a:= n - k + i - 1;\n\t x1:=calc(k - 1, i - 1);\n\t x2:= calc(n - k + 1, i);\n\t re:=(x1 * x2) mod base;\n\t if a > 0 then writeln(re) else writeln(0);\n\t end;\nend.", "language": "Pascal", "metadata": {"date": 1561863147, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Pascal/s063996732.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s063996732", "user_id": "u017143931"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "const base = trunc(1e9) + 7;\nvar f:array[0..2000] of int64;\n n,k,i:integer;\n re,x1,x2,a:int64;\n\nprocedure init;\nvar i:integer;\nbegin\n\tf[0]:=1;\n\tf[1]:=1;\n\tfor i:=2 to 2000 do f[i]:= (f[i - 1] * i) mod base;\nend;\n\nfunction power(a,b:int64):int64;\nvar tmp:int64;\nbegin\n\tif b = 0 then exit(1);\n\tif b = 1 then exit(a);\n\ttmp:= power(a,b shr 1);\n\tif b mod 2 = 0 then power:= (tmp * tmp) mod base\n\telse power:= (((tmp * tmp) mod base) * a) mod base;\nend;\n\nfunction calc(n,k:integer):int64;\nbegin\n\tcalc:= (f[n] * power(f[k] * f[n - k], base - 2) mod base) mod base;\nend;\n\nbegin\n\treadln(n,k);\n\tinit;\n\tfor i:=1 to k do \n\t begin\n\t a:= n - k + i - 1;\n\t x1:=calc(k - 1, i - 1);\n\t x2:= calc(n - k + 1, i);\n\t re:=(x1 * x2) mod base;\n\t if a > 0 then writeln(re) else writeln(0);\n\t end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 797, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s548409586", "group_id": "codeNet:p02995", "input_text": "Uses math;\nvar A,B,C,D,pCD,i,nCD,nC,nD:int64;\nbegin\n read(A,B,C,D);pCD:=1;\nfor i := 2 to max(C,D) do if (C mod i = 0) or (D mod i = 0) then pCD:=pCD*i;\n nCD:=(B-A) div pCD;\n nC:=(B-A) div C;\n nD:=(B-A) div D;\n write(B-A-nC-nD+nCD);\nend.", "language": "Pascal", "metadata": {"date": 1561236090, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Pascal/s548409586.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s548409586", "user_id": "u655683235"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Uses math;\nvar A,B,C,D,pCD,i,nCD,nC,nD:int64;\nbegin\n read(A,B,C,D);pCD:=1;\nfor i := 2 to max(C,D) do if (C mod i = 0) or (D mod i = 0) then pCD:=pCD*i;\n nCD:=(B-A) div pCD;\n nC:=(B-A) div C;\n nD:=(B-A) div D;\n write(B-A-nC-nD+nCD);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s957940774", "group_id": "codeNet:p02996", "input_text": "program Megalomania;\nconst maxn=2*trunc(1e5);\nvar a,b:array[1..maxn] of longint;\n n:longint;\n\nprocedure rf;\nvar i:Longint;\nbegin\n\treadln(n);\n\tfor i:=1 to n do readln(a[i],b[i]);\nend;\n\nprocedure swap(var x,y:longint);\nvar tmp:longint;\nbegin\n\ttmp:=x;\n x:=y;\n y:=tmp;\nend;\n\nprocedure sort(l,r:longint);\nvar i,j,x:Longint;\nbegin\n\ti:=l; j:=r;\n\tx:=b[(l+r) div 2];\n\trepeat\n\t while b[i]x do dec(j);\n\t if i<=j then\n\t begin\n\t swap(b[i],b[j]);\n\t swap(a[i],a[j]);\n\t inc(i);\n\t dec(j);\n\t end;\n\tuntil i>j;\n\tif lb[i] then \n begin\n check:=false;\n break;\n end;\n end;\n if check then write('Yes') else write('No');\nend;\n\nbegin\n\trf;\n\tsort(1,n);\n\tgreedy;\nend.", "language": "Pascal", "metadata": {"date": 1561234840, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Pascal/s957940774.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s957940774", "user_id": "u017143931"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program Megalomania;\nconst maxn=2*trunc(1e5);\nvar a,b:array[1..maxn] of longint;\n n:longint;\n\nprocedure rf;\nvar i:Longint;\nbegin\n\treadln(n);\n\tfor i:=1 to n do readln(a[i],b[i]);\nend;\n\nprocedure swap(var x,y:longint);\nvar tmp:longint;\nbegin\n\ttmp:=x;\n x:=y;\n y:=tmp;\nend;\n\nprocedure sort(l,r:longint);\nvar i,j,x:Longint;\nbegin\n\ti:=l; j:=r;\n\tx:=b[(l+r) div 2];\n\trepeat\n\t while b[i]x do dec(j);\n\t if i<=j then\n\t begin\n\t swap(b[i],b[j]);\n\t swap(a[i],a[j]);\n\t inc(i);\n\t dec(j);\n\t end;\n\tuntil i>j;\n\tif lb[i] then \n begin\n check:=false;\n break;\n end;\n end;\n if check then write('Yes') else write('No');\nend;\n\nbegin\n\trf;\n\tsort(1,n);\n\tgreedy;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 948, "cpu_time_ms": 69, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s244431601", "group_id": "codeNet:p02997", "input_text": "var\n\tN,K,i,u,v:Longint;\nbegin\n\tread(N,K);\n\tif (N-1)*(N-2)N then begin\n\t\t\tinc(u);\n\t\t\tv:=u+1;\n\t\tend;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1561232684, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02997.html", "problem_id": "p02997", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02997/input.txt", "sample_output_relpath": "derived/input_output/data/p02997/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02997/Pascal/s244431601.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s244431601", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n4 3\n1 2\n3 1\n4 5\n2 3\n", "input_to_evaluate": "var\n\tN,K,i,u,v:Longint;\nbegin\n\tread(N,K);\n\tif (N-1)*(N-2)N then begin\n\t\t\tinc(u);\n\t\t\tv:=u+1;\n\t\tend;\n\tend;\nend.\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "sample_input": "5 3\n"}, "reference_outputs": ["5\n4 3\n1 2\n3 1\n4 5\n2 3\n"], "source_document_id": "p02997", "source_text": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 337, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s229862126", "group_id": "codeNet:p02997", "input_text": "var\n\tN,K,i,u,v:Longint;\nbegin\n\tread(N,K);\n\tif (N-1)*(N-2)N then begin\n\t\t\tinc(u);\n\t\t\tv:=u+1;\n\t\tend;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1561232615, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p02997.html", "problem_id": "p02997", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02997/input.txt", "sample_output_relpath": "derived/input_output/data/p02997/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02997/Pascal/s229862126.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s229862126", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n4 3\n1 2\n3 1\n4 5\n2 3\n", "input_to_evaluate": "var\n\tN,K,i,u,v:Longint;\nbegin\n\tread(N,K);\n\tif (N-1)*(N-2)N then begin\n\t\t\tinc(u);\n\t\t\tv:=u+1;\n\t\tend;\n\tend;\nend.\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "sample_input": "5 3\n"}, "reference_outputs": ["5\n4 3\n1 2\n3 1\n4 5\n2 3\n"], "source_document_id": "p02997", "source_text": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 350, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s862241431", "group_id": "codeNet:p03005", "input_text": "var n,k:integer;begin read(n,k);if(k=1)then writeln(0) else writeln(n-k);end.", "language": "Pascal", "metadata": {"date": 1597431550, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03005.html", "problem_id": "p03005", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03005/input.txt", "sample_output_relpath": "derived/input_output/data/p03005/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03005/Pascal/s862241431.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s862241431", "user_id": "u984276646"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,k:integer;begin read(n,k);if(k=1)then writeln(0) else writeln(n-k);end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "sample_input": "3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03005", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 4, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s644020831", "group_id": "codeNet:p03007", "input_text": "Var a,b,c:Array[1 .. 100000] of Longint;\n n,i,rem1,rem2,min,max,rem,count: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.", "language": "Pascal", "metadata": {"date": 1560648782, "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/s644020831.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s644020831", "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 Longint;\n n,i,rem1,rem2,min,max,rem,count: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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 652, "cpu_time_ms": 48, "memory_kb": 2944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s223880995", "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;\nj:=1;\nfor i:=0 to N do begin\nwhile(j<=MM)and(a[j] -1 then dp[i+1] := (dp[i+1] + dp[i]) mod remainder;\n if dp[i+2] <> -1 then dp[i+2] := (dp[i+2] + dp[i]) mod remainder;\n end;\n writeln(dp[n]);\n for i := 0 to n do writeln(dp[i]);\nend.\n", "language": "Pascal", "metadata": {"date": 1560139485, "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/s717177862.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s717177862", "user_id": "u878615689"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "Uses math;\nvar n, m, i, a : int64;\n dp : array[1..100010] of int64;\n remainder : int64;\nbegin\n remainder := 1000000007;\n readln(n, m);\n \n for i := 1 to 100010 do dp[i] := 0;\n for i := 1 to m do begin\n read(a);\n dp[a] := -1;\n end;\n dp[0] := 1;\n \n for i := 0 to 100005 do begin\n if dp[i] = -1 then Continue;\n if dp[i+1] <> -1 then dp[i+1] := (dp[i+1] + dp[i]) mod remainder;\n if dp[i+2] <> -1 then dp[i+2] := (dp[i+2] + dp[i]) mod remainder;\n end;\n writeln(dp[n]);\n for i := 0 to n do writeln(dp[i]);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 537, "cpu_time_ms": 24, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s959550483", "group_id": "codeNet:p03013", "input_text": "Uses math;\nvar n, m, i, a : int64;\n dp : array[1..100010] of int64;\nconst remainder = 1000000007;\nbegin\n for i := 1 to 100010 do dp[i] := 0;\n dp[0] := 1;\n readln(n, m);\n for i := 1 to m do begin\n read(a);\n dp[a] := -1;\n end;\n \n for i := 0 to 100005 do begin\n if dp[i] = -1 then Continue;\n if dp[i+1] <> -1 then dp[i+1] := (dp[i+1] + dp[i]) mod remainder;\n if dp[i+2] <> -1 then dp[i+2] := (dp[i+2] + dp[i]) mod remainder;\n end;\n writeln(dp[n]);\nend.", "language": "Pascal", "metadata": {"date": 1560139028, "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/s959550483.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s959550483", "user_id": "u878615689"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "Uses math;\nvar n, m, i, a : int64;\n dp : array[1..100010] of int64;\nconst remainder = 1000000007;\nbegin\n for i := 1 to 100010 do dp[i] := 0;\n dp[0] := 1;\n readln(n, m);\n for i := 1 to m do begin\n read(a);\n dp[a] := -1;\n end;\n \n for i := 0 to 100005 do begin\n if dp[i] = -1 then Continue;\n if dp[i+1] <> -1 then dp[i+1] := (dp[i+1] + dp[i]) mod remainder;\n if dp[i+2] <> -1 then dp[i+2] := (dp[i+2] + dp[i]) mod remainder;\n end;\n writeln(dp[n]);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 476, "cpu_time_ms": 12, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s349107823", "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\n for j:=1 to w do begin\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+1]:=0;\n end;\n end;\n {right}\n for i:=1 to h do begin\n if s[i][w]='.' then l[i][w]:=1 else l[i][w]:=0;\n for j:=w-1 downto 1 do begin\n if s[i][j]='.' then l[i][j]:=l[i][j-1]+1 else l[i][j-1]:=0;\n end;\n end;\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": 1561537811, "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/s349107823.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s349107823", "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\n for j:=1 to w do begin\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+1]:=0;\n end;\n end;\n {right}\n for i:=1 to h do begin\n if s[i][w]='.' then l[i][w]:=1 else l[i][w]:=0;\n for j:=w-1 downto 1 do begin\n if s[i][j]='.' then l[i][j]:=l[i][j-1]+1 else l[i][j-1]:=0;\n end;\n end;\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1227, "cpu_time_ms": 2103, "memory_kb": 53248}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s102417911", "group_id": "codeNet:p03014", "input_text": "var l,r,u,d:array[1..2000] of array[1..2000] of integer;\n i,j,h,w,ans:integer;\n s:array[1..2000] of array[1..2000] of char;\n\nbegin\n ans:=0;\n readln(h,w);\n for i:=1 to h do begin\n for j:=1 to w do read(s[i][j]);\n readln\n end;\n for i:=1 to h do begin\n for j:=1 to w do begin\n if s[i][j] = '#' then begin\n u[i][j] := -1;\n l[i][j] := -1\n end else begin\n if i=1 then u[i][j] := 0 else u[i][j] := u[i-1][j] + 1;\n if j=1 then l[i][j] := 0 else l[i][j] := l[i][j-1] + 1\n end\n end\n end;\n for i:=h downto 1 do begin\n for j:=w downto 1 do begin\n if s[i][j] = '#' then begin\n d[i][j] := -1;\n r[i][j] := -1\n end else begin\n if i=h then d[i][j] := 0 else d[i][j] := d[i+1][j] + 1;\n if j=w then r[i][j] := 0 else r[i][j] := r[i][j+1] + 1\n end;\n if ans < l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1 then ans := l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1\n end\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1561534346, "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/s102417911.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s102417911", "user_id": "u492212770"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var l,r,u,d:array[1..2000] of array[1..2000] of integer;\n i,j,h,w,ans:integer;\n s:array[1..2000] of array[1..2000] of char;\n\nbegin\n ans:=0;\n readln(h,w);\n for i:=1 to h do begin\n for j:=1 to w do read(s[i][j]);\n readln\n end;\n for i:=1 to h do begin\n for j:=1 to w do begin\n if s[i][j] = '#' then begin\n u[i][j] := -1;\n l[i][j] := -1\n end else begin\n if i=1 then u[i][j] := 0 else u[i][j] := u[i-1][j] + 1;\n if j=1 then l[i][j] := 0 else l[i][j] := l[i][j-1] + 1\n end\n end\n end;\n for i:=h downto 1 do begin\n for j:=w downto 1 do begin\n if s[i][j] = '#' then begin\n d[i][j] := -1;\n r[i][j] := -1\n end else begin\n if i=h then d[i][j] := 0 else d[i][j] := d[i+1][j] + 1;\n if j=w then r[i][j] := 0 else r[i][j] := r[i][j+1] + 1\n end;\n if ans < l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1 then ans := l[i][j] + r[i][j] + u[i][j] + d[i][j] + 1\n end\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 988, "cpu_time_ms": 175, "memory_kb": 66560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s522995904", "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('Yes');\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1560883346, "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/s522995904.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s522995904", "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('Yes');\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 567, "cpu_time_ms": 6, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s777663447", "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 begin \n read(p);\n if ord(p) < 40 then S[i]:=1 else S[i]:=0; \nend;\n\nx:=1;\n for i := 1 to N 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\nif C > D then \n begin\n x:=0;\n for i := 1 to N do\n begin \n if (S[i]=0) and (S[i+1]=0) and (S[i+2]=0) then x:=1;\n end;\n if x=0 then write('No') else write('Yse');\n end;\n\nend;\nend.\n", "language": "Pascal", "metadata": {"date": 1560875794, "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/s777663447.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s777663447", "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 begin \n read(p);\n if ord(p) < 40 then S[i]:=1 else S[i]:=0; \nend;\n\nx:=1;\n for i := 1 to N 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\nif C > D then \n begin\n x:=0;\n for i := 1 to N do\n begin \n if (S[i]=0) and (S[i+1]=0) and (S[i+2]=0) then x:=1;\n end;\n if x=0 then write('No') else write('Yse');\n end;\n\nend;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 510, "cpu_time_ms": 6, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s595621658", "group_id": "codeNet:p03017", "input_text": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n readln(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do begin\n read(s);\n if (a<=i) and ((c>=i) or (d>=i)) then begin\n if b=i) then mv := max(v,mv)\n end else \n if ((b>=i)or(c<=i)) and (v=0) and (s='#') then ans := false;\n end\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1559530612, "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/s595621658.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s595621658", "user_id": "u492212770"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n readln(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do begin\n read(s);\n if (a<=i) and ((c>=i) or (d>=i)) then begin\n if b=i) then mv := max(v,mv)\n end else \n if ((b>=i)or(c<=i)) and (v=0) and (s='#') then ans := false;\n end\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 657, "cpu_time_ms": 6, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s479484166", "group_id": "codeNet:p03017", "input_text": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n read(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do\n read(s);\n if (a<=i) and (c>=i) and (d>=i) then begin\n if (v=0) and (s='#') then ans := false;\n if s='.' then v := v + 1 else v := 0;\n if (b<=i) and (d>=i) then mv := max(v,mv)\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "language": "Pascal", "metadata": {"date": 1559529233, "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/s479484166.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s479484166", "user_id": "u492212770"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,v,n,a,b,c,d,mv:longint;\n s:char;\n ans:boolean;\n\n\nfunction max(a,b:longint):longint;\nbegin\n if a > b then max := a else max := b\nend;\n\nbegin\n read(n,a,b,c,d);\n v := 0;\n mv := 0;\n ans := true;\n for i:=1 to n do\n read(s);\n if (a<=i) and (c>=i) and (d>=i) then begin\n if (v=0) and (s='#') then ans := false;\n if s='.' then v := v + 1 else v := 0;\n if (b<=i) and (d>=i) then mv := max(v,mv)\n end;\n if (c>d) and (mv<3) then ans := false;\n if ans then writeln('Yes') else writeln('No')\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s937981553", "group_id": "codeNet:p03023", "input_text": "var n:integer;begin readln(n);writeln((n-2)*180);end.", "language": "Pascal", "metadata": {"date": 1597615241, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03023.html", "problem_id": "p03023", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03023/input.txt", "sample_output_relpath": "derived/input_output/data/p03023/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03023/Pascal/s937981553.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s937981553", "user_id": "u984276646"}, "prompt_components": {"gold_output": "180\n", "input_to_evaluate": "var n:integer;begin readln(n);writeln((n-2)*180);end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "sample_input": "3\n"}, "reference_outputs": ["180\n"], "source_document_id": "p03023", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 53, "cpu_time_ms": 3, "memory_kb": 1328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s309739450", "group_id": "codeNet:p03027", "input_text": "var q,x,d,n,i,j,k,ans :longint;\n \nbegin\n readln(q);\n for i:=1 to q do\n begin\n readln(x,d,n);\n ans:=x;\n for j:=1 to n-1 do ans:=(ans*(x+j*d))mod 1000003;\n writeln(ans)\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1559462505, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03027.html", "problem_id": "p03027", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03027/input.txt", "sample_output_relpath": "derived/input_output/data/p03027/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03027/Pascal/s309739450.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s309739450", "user_id": "u805277811"}, "prompt_components": {"gold_output": "9009\n916936\n", "input_to_evaluate": "var q,x,d,n,i,j,k,ans :longint;\n \nbegin\n readln(q);\n for i:=1 to q do\n begin\n readln(x,d,n);\n ans:=x;\n for j:=1 to n-1 do ans:=(ans*(x+j*d))mod 1000003;\n writeln(ans)\n end;\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nConsider the following arithmetic progression with n terms:\n\nx, x + d, x + 2d, \\ldots, x + (n-1)d\n\nWhat is the product of all terms in this sequence?\nCompute the answer modulo 1\\ 000\\ 003.\n\nYou are given Q queries of this form.\nIn the i-th query, compute the answer in case x = x_i, d = d_i, n = n_i.\n\nConstraints\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq x_i, d_i \\leq 1\\ 000\\ 002\n\n1 \\leq n_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\nQ\nx_1 d_1 n_1\n:\nx_Q d_Q n_Q\n\nOutput\n\nPrint Q lines.\n\nIn the i-th line, print the answer for the i-th query.\n\nSample Input 1\n\n2\n7 2 4\n12345 67890 2019\n\nSample Output 1\n\n9009\n916936\n\nFor the first query, the answer is 7 \\times 9 \\times 11 \\times 13 = 9009.\nDon't forget to compute the answer modulo 1\\ 000\\ 003.", "sample_input": "2\n7 2 4\n12345 67890 2019\n"}, "reference_outputs": ["9009\n916936\n"], "source_document_id": "p03027", "source_text": "Score : 600 points\n\nProblem Statement\n\nConsider the following arithmetic progression with n terms:\n\nx, x + d, x + 2d, \\ldots, x + (n-1)d\n\nWhat is the product of all terms in this sequence?\nCompute the answer modulo 1\\ 000\\ 003.\n\nYou are given Q queries of this form.\nIn the i-th query, compute the answer in case x = x_i, d = d_i, n = n_i.\n\nConstraints\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq x_i, d_i \\leq 1\\ 000\\ 002\n\n1 \\leq n_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\nQ\nx_1 d_1 n_1\n:\nx_Q d_Q n_Q\n\nOutput\n\nPrint Q lines.\n\nIn the i-th line, print the answer for the i-th query.\n\nSample Input 1\n\n2\n7 2 4\n12345 67890 2019\n\nSample Output 1\n\n9009\n916936\n\nFor the first query, the answer is 7 \\times 9 \\times 11 \\times 13 = 9009.\nDon't forget to compute the answer modulo 1\\ 000\\ 003.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 198, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s787225304", "group_id": "codeNet:p03027", "input_text": "var q,x,d,n,i,j,k,ans :longint;\n \nbegin\n readln(q);\n for i:=1 to q do\n begin\n readln(x,d,n);\n ans:=x;\n for j:=1 to n-1 do ans:=(ans*((ans+d)mod 1000003))mod 1000003;\n writeln(ans)\n end;\nend.", "language": "Pascal", "metadata": {"date": 1559461659, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03027.html", "problem_id": "p03027", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03027/input.txt", "sample_output_relpath": "derived/input_output/data/p03027/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03027/Pascal/s787225304.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s787225304", "user_id": "u805277811"}, "prompt_components": {"gold_output": "9009\n916936\n", "input_to_evaluate": "var q,x,d,n,i,j,k,ans :longint;\n \nbegin\n readln(q);\n for i:=1 to q do\n begin\n readln(x,d,n);\n ans:=x;\n for j:=1 to n-1 do ans:=(ans*((ans+d)mod 1000003))mod 1000003;\n writeln(ans)\n end;\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nConsider the following arithmetic progression with n terms:\n\nx, x + d, x + 2d, \\ldots, x + (n-1)d\n\nWhat is the product of all terms in this sequence?\nCompute the answer modulo 1\\ 000\\ 003.\n\nYou are given Q queries of this form.\nIn the i-th query, compute the answer in case x = x_i, d = d_i, n = n_i.\n\nConstraints\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq x_i, d_i \\leq 1\\ 000\\ 002\n\n1 \\leq n_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\nQ\nx_1 d_1 n_1\n:\nx_Q d_Q n_Q\n\nOutput\n\nPrint Q lines.\n\nIn the i-th line, print the answer for the i-th query.\n\nSample Input 1\n\n2\n7 2 4\n12345 67890 2019\n\nSample Output 1\n\n9009\n916936\n\nFor the first query, the answer is 7 \\times 9 \\times 11 \\times 13 = 9009.\nDon't forget to compute the answer modulo 1\\ 000\\ 003.", "sample_input": "2\n7 2 4\n12345 67890 2019\n"}, "reference_outputs": ["9009\n916936\n"], "source_document_id": "p03027", "source_text": "Score : 600 points\n\nProblem Statement\n\nConsider the following arithmetic progression with n terms:\n\nx, x + d, x + 2d, \\ldots, x + (n-1)d\n\nWhat is the product of all terms in this sequence?\nCompute the answer modulo 1\\ 000\\ 003.\n\nYou are given Q queries of this form.\nIn the i-th query, compute the answer in case x = x_i, d = d_i, n = n_i.\n\nConstraints\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq x_i, d_i \\leq 1\\ 000\\ 002\n\n1 \\leq n_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\nQ\nx_1 d_1 n_1\n:\nx_Q d_Q n_Q\n\nOutput\n\nPrint Q lines.\n\nIn the i-th line, print the answer for the i-th query.\n\nSample Input 1\n\n2\n7 2 4\n12345 67890 2019\n\nSample Output 1\n\n9009\n916936\n\nFor the first query, the answer is 7 \\times 9 \\times 11 \\times 13 = 9009.\nDon't forget to compute the answer modulo 1\\ 000\\ 003.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s259032843", "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)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": 1558941348, "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/s724379922.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s724379922", "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)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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s750039518", "group_id": "codeNet:p03037", "input_text": "var t:array[0..100000]of longint;\n i,n,m,a,l,r:longint;\nprocedure add(x,y:longint);inline;\nbegin\n while x<=n do\n begin\n inc(t[x],y);\n inc(x,x and -x);\n end;\nend;\nfunction ask(x:longint):longint;inline;\nvar a:longint=0;\nbegin\n while x<>0 do\n begin\n inc(a,t[x]);\n dec(x,x and -x);\n end;\n exit(a);\nend;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(l,r);\n add(l,1);\n add(r+1,-1);\n end;\n for i:=1 to n do\n if ask(i)=m then\n inc(a);\n writeln(a);\nend.", "language": "Pascal", "metadata": {"date": 1583940890, "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/s750039518.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s750039518", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var t:array[0..100000]of longint;\n i,n,m,a,l,r:longint;\nprocedure add(x,y:longint);inline;\nbegin\n while x<=n do\n begin\n inc(t[x],y);\n inc(x,x and -x);\n end;\nend;\nfunction ask(x:longint):longint;inline;\nvar a:longint=0;\nbegin\n while x<>0 do\n begin\n inc(a,t[x]);\n dec(x,x and -x);\n end;\n exit(a);\nend;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n read(l,r);\n add(l,1);\n add(r+1,-1);\n end;\n for i:=1 to n do\n if ask(i)=m then\n inc(a);\n writeln(a);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 495, "cpu_time_ms": 28, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s891658322", "group_id": "codeNet:p03037", "input_text": "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) else write(0);\nend.\n", "language": "Pascal", "metadata": {"date": 1559919770, "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/s891658322.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s891658322", "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) else write(0);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 200, "cpu_time_ms": 22, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s481693680", "group_id": "codeNet:p03037", "input_text": "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.", "language": "Pascal", "metadata": {"date": 1559918999, "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/s481693680.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s481693680", "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.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 185, "cpu_time_ms": 21, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s191884803", "group_id": "codeNet:p03037", "input_text": "var n,m,i :integer;\n l,r,lm,rm :integer;\nbegin\n readln(n,m);\n lm:=0; rm:=100002;\n for i:=1 to m do \n begin\n readln(l,r);\n if lmr then rm:=r\n end;\n if lm<=rm then writeln(rm-lm+1)\n else writeln(0)\nend.", "language": "Pascal", "metadata": {"date": 1558833929, "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/s191884803.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s191884803", "user_id": "u805277811"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,m,i :integer;\n l,r,lm,rm :integer;\nbegin\n readln(n,m);\n lm:=0; rm:=100002;\n for i:=1 to m do \n begin\n readln(l,r);\n if lmr then rm:=r\n end;\n if lm<=rm then writeln(rm-lm+1)\n else writeln(0)\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 21, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s802182904", "group_id": "codeNet:p03037", "input_text": "var i,n,m,l,r,min,max:longint;\n\nbegin\n readln(n,m);\n min:=1;\n max:=n;\n for i:=1 to m do begin\n readln(l,r);\n if l>min then min:=l;\n if rmin then min:=l;\n if ra[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": 1558838396, "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/s712094545.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s712094545", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1747, "cpu_time_ms": 60, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s756072109", "group_id": "codeNet:p03043", "input_text": "uses crt, math;\nvar\n i,n,k,tmp,tmp2:longint;\n kq:real;\nbegin\n clrscr;\n readln(n, k);\n kq:=0;\n for i:=1 to n do begin\n tmp:=i;\n tmp2:=0;\n while tmp=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 4 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": 1558332284, "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/s932676595.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s932676595", "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 4 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s458457902", "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 3 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": 1558332257, "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/s458457902.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s458457902", "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 3 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s392667214", "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 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 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": 1558332132, "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/s392667214.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s392667214", "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 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 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s566116290", "group_id": "codeNet:p03043", "input_text": "Var rem,count:Extended;\n n,k,srem,i,sum:Longint;\n a:Array[1 .. 17] of Extended;\nBegin\n Readln(n,k); rem:=1/n; a[1]:=0.5; count:=0;\n For i:=2 to 17 do a[i]:=a[i-1]*0.5;\n For i:=1 to n do begin\n srem:=i; sum:=0;\n While srem 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": 1557627504, "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/s405593332.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s405593332", "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) 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s129675786", "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 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": 1557627026, "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/s129675786.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s129675786", "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 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 202, "cpu_time_ms": 12, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s207604974", "group_id": "codeNet:p03060", "input_text": "var v:array[1..25]of integer;\n n,a,b,c,ans,i,j :integer;\nbegin\n readln(n);\n for i:=1 to n do read(v[i]);\n for i:=1 to n do begin\n read(a);\n inc(v[i],a)\n end;\n ans:=0;\n for i:=1 to n do\n if v[i]>0 then inc(ans,v[i]);\n write(ans)\nend.", "language": "Pascal", "metadata": {"date": 1556449283, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03060.html", "problem_id": "p03060", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03060/input.txt", "sample_output_relpath": "derived/input_output/data/p03060/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03060/Pascal/s207604974.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s207604974", "user_id": "u805277811"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var v:array[1..25]of integer;\n n,a,b,c,ans,i,j :integer;\nbegin\n readln(n);\n for i:=1 to n do read(v[i]);\n for i:=1 to n do begin\n read(a);\n inc(v[i],a)\n end;\n ans:=0;\n for i:=1 to n do\n if v[i]>0 then inc(ans,v[i]);\n write(ans)\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "sample_input": "3\n10 2 5\n6 3 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03060", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 4, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s312807583", "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 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*maxm;\n write(ans)\nend.\n", "language": "Pascal", "metadata": {"date": 1556451872, "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/s312807583.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s312807583", "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 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*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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 479, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s713531964", "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 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*maxm;\n write(ans)\nend.\n", "language": "Pascal", "metadata": {"date": 1556451651, "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/s713531964.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s713531964", "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 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*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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 479, "cpu_time_ms": 18, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s127596791", "group_id": "codeNet:p03069", "input_text": "var s:array[1..1000000] of char;\n i,n,b,c,min:integer;\n\nbegin\n readln(n);\n b := 0;\n c := 0;\n min := 0;\n for i:=1 to n do begin\n read(s[i]);\n if s[i]='.' then begin\n b := b + 1;\n c := c - 1;\n if min > c then min := c\n end\n else c := c + 1;\n end;\n writeln(min+b)\nend.", "language": "Pascal", "metadata": {"date": 1556228802, "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/s127596791.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s127596791", "user_id": "u492212770"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s:array[1..1000000] of char;\n i,n,b,c,min:integer;\n\nbegin\n readln(n);\n b := 0;\n c := 0;\n min := 0;\n for i:=1 to n do begin\n read(s[i]);\n if s[i]='.' then begin\n b := b + 1;\n c := c - 1;\n if min > c then min := c\n end\n else c := c + 1;\n end;\n writeln(min+b)\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 308, "cpu_time_ms": 5, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s054954307", "group_id": "codeNet:p03069", "input_text": "var s,t:char;\n n,i,b,w,ans:integer;\nbegin\n readln(n);\n s:='.';\n b:=0; w:=0;\n ans:=0;\n for i:=1 to n do begin\n read(t);\n if (s=t) and (t='#') then inc(b);\n if (s=t) and (t='.') then inc(w);\n if (s<>t) and (t='#') then begin\n if bt) and (t='.')then inc(w);\n s:=t\n end;\n if (t='.')and(b>w) then inc(ans,w) else inc(ans,b);\n write(ans)\n \nend.\n", "language": "Pascal", "metadata": {"date": 1555827615, "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/s054954307.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s054954307", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s,t:char;\n n,i,b,w,ans:integer;\nbegin\n readln(n);\n s:='.';\n b:=0; w:=0;\n ans:=0;\n for i:=1 to n do begin\n read(t);\n if (s=t) and (t='#') then inc(b);\n if (s=t) and (t='.') then inc(w);\n if (s<>t) and (t='#') then begin\n if bt) and (t='.')then inc(w);\n s:=t\n end;\n if (t='.')and(b>w) then inc(ans,w) else inc(ans,b);\n write(ans)\n \nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 458, "cpu_time_ms": 6, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s967051169", "group_id": "codeNet:p03069", "input_text": "type itemp = ^item;\n item = record\n cont : integer;\n next : itemp;\n end;\nvar s,temp:char;\n i,j,n,t,tn,ans,tans:integer;\n sn,tsn:itemp;\n\nprocedure additem(var p : itemp;item:integer);{頭から追加}\nvar q : itemp;\nbegin\n q := p;\n new(p);\n p^.cont:=item;\n p^.next := q\nend;\n\nbegin\n readln(n);\n sn:=nil;\n t:=0;\n tn:=1;\n temp:='.';\n for i:=1 to n do begin\n read(s);\n if s=temp then t := t + 1 else begin\n additem(sn,t);\n t := 1;\n tn := tn + 1;\n temp := s\n end;\n end;\n additem(sn,t);\n if temp = '*' then additem(sn,t);\n tn := tn div 2 + 1;\n ans:=n;\n for i:=0 to tn do begin\n j := 0;\n tsn := sn;\n tans := 0;\n while tsn<>nil do begin\n j := j + 1;\n if (j <= i*2) and (j mod 2 = 0) then tans := tans + tsn^.cont;\n if (j > i*2) and (j mod 2 = 1) then tans := tans + tsn^.cont;\n tsn:=tsn^.next\n end;\n if tansnil do begin\n j := j + 1;\n if (j <= i*2) and (j mod 2 = 0) then tans := tans + tsn^.cont;\n if (j > i*2) and (j mod 2 = 1) then tans := tans + tsn^.cont;\n tsn:=tsn^.next\n end;\n if tansnil do begin\n j := j + 1;\n if (j <= i*2) and (j mod 2 = 0) then tans := tans + tsn^.cont;\n if (j > i*2) and (j mod 2 = 1) then tans := tans + tsn^.cont;\n tsn:=tsn^.next\n end;\n if tansnil do begin\n write(sn^.cont);\n sn:=sn^.next\n end;}\nend.", "language": "Pascal", "metadata": {"date": 1555814356, "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/s111938480.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s111938480", "user_id": "u492212770"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "type itemp = ^item;\n item = record\n cont : integer;\n next : itemp;\n end;\nvar s,temp:char;\n i,j,n,t,tn,ans,tans:integer;\n sn,tsn:itemp;\n\nprocedure additem(var p : itemp;item:integer);{頭から追加}\nvar q : itemp;\nbegin\n q := p;\n new(p);\n p^.cont:=item;\n p^.next := q\nend;\n\nbegin\n readln(n);\n sn:=nil;\n t:=0;\n tn:=1;\n temp:='.';\n for i:=1 to n do begin\n read(s);\n if s=temp then t := t + 1 else begin\n additem(sn,t);\n t := 1;\n tn := tn + 1;\n temp := s\n end;\n end;\n additem(sn,t);\n if temp = '*' then additem(sn,t);\n tn := tn div 2;\n ans:=n;\n for i:=0 to tn do begin\n j := 0;\n tsn := sn;\n tans := 0;\n while tsn<>nil do begin\n j := j + 1;\n if (j <= i*2) and (j mod 2 = 0) then tans := tans + tsn^.cont;\n if (j > i*2) and (j mod 2 = 1) then tans := tans + tsn^.cont;\n tsn:=tsn^.next\n end;\n if tansnil do begin\n write(sn^.cont);\n sn:=sn^.next\n end;}\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1028, "cpu_time_ms": 2104, "memory_kb": 6400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s094882560", "group_id": "codeNet:p03069", "input_text": "var a:char;\n flag:boolean;\n i,n,k:integer;\nbegin \n read(n);\n k:=0;\n flag:=false;\n for i:=1 to n do begin\n read(a);\n if a='#' then flag:=true\n else if flag then inc(k)\n end;\n write(k)\nend.\n", "language": "Pascal", "metadata": {"date": 1555809854, "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/s094882560.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s094882560", "user_id": "u805277811"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a:char;\n flag:boolean;\n i,n,k:integer;\nbegin \n read(n);\n k:=0;\n flag:=false;\n for i:=1 to n do begin\n read(a);\n if a='#' then flag:=true\n else if flag then inc(k)\n end;\n write(k)\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 6, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s081331389", "group_id": "codeNet:p03087", "input_text": "var n,q,l,r,i,k :integer;\n c,d:char;\n s:array[1..100000]of char;\n t:array[1..100000]of integer;\nbegin\n readln(n,q); read(s[1]);\n k:=0;t[1]:=0;\n for i:=2 to n do begin\n read(s[i]);\n if (s[i-1]='A')and(s[i]='C') then k+=1;\n t[i]:=k;\n end;\n for i:=1 to q do begin\n readln(l,r);\n writeln(t[r]-t[l])\n end\nend.", "language": "Pascal", "metadata": {"date": 1553653778, "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/s081331389.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s081331389", "user_id": "u805277811"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "var n,q,l,r,i,k :integer;\n c,d:char;\n s:array[1..100000]of char;\n t:array[1..100000]of integer;\nbegin\n readln(n,q); read(s[1]);\n k:=0;t[1]:=0;\n for i:=2 to n do begin\n read(s[i]);\n if (s[i-1]='A')and(s[i]='C') then k+=1;\n t[i]:=k;\n end;\n for i:=1 to q do begin\n readln(l,r);\n writeln(t[r]-t[l])\n end\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 335, "cpu_time_ms": 39, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s483124119", "group_id": "codeNet:p03088", "input_text": "var\n\tn,i,j,k,t:Longint;\n\ts:int64;\n\tdp:array[0..100,0..63]of int64;\nbegin\n\tread(n);\ndp[0,63]:=1;\nfor i:=1 to n do begin\nfor j:=0 to 63 do begin\nfor k:=0 to 3 do begin\nt:=j*4+k;\nif(t mod 64<>9)and(t mod 64<>33)and(t mod 64<>6)and(t<>25)and(t<>41)and(t<>57)and(t<>37)and(t<>45)then\ndp[i,t mod 64]:=(dp[i,t mod 64]+dp[i-1,j])mod 1000000007;\nend;end;end;\nfor i:=0 to 63 do s:=(s+dp[n,i])mod 1000000007;\nwriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1553464611, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03088.html", "problem_id": "p03088", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03088/input.txt", "sample_output_relpath": "derived/input_output/data/p03088/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03088/Pascal/s483124119.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s483124119", "user_id": "u657913472"}, "prompt_components": {"gold_output": "61\n", "input_to_evaluate": "var\n\tn,i,j,k,t:Longint;\n\ts:int64;\n\tdp:array[0..100,0..63]of int64;\nbegin\n\tread(n);\ndp[0,63]:=1;\nfor i:=1 to n do begin\nfor j:=0 to 63 do begin\nfor k:=0 to 3 do begin\nt:=j*4+k;\nif(t mod 64<>9)and(t mod 64<>33)and(t mod 64<>6)and(t<>25)and(t<>41)and(t<>57)and(t<>37)and(t<>45)then\ndp[i,t mod 64]:=(dp[i,t mod 64]+dp[i-1,j])mod 1000000007;\nend;end;end;\nfor i:=0 to 63 do s:=(s+dp[n,i])mod 1000000007;\nwriteln(s);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:\n\nThe string does not contain characters other than A, C, G and T.\n\nThe string does not contain AGC as a substring.\n\nThe condition above cannot be violated by swapping two adjacent characters once.\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\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings of length N that satisfy the following conditions, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n61\n\nThere are 4^3 = 64 strings of length 3 that do not contain characters other than A, C, G and T. Among them, only AGC, ACG and GAC violate the condition, so the answer is 64 - 3 = 61.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n230\n\nSample Input 3\n\n100\n\nSample Output 3\n\n388130742\n\nBe sure to print the number of strings modulo 10^9+7.", "sample_input": "3\n"}, "reference_outputs": ["61\n"], "source_document_id": "p03088", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:\n\nThe string does not contain characters other than A, C, G and T.\n\nThe string does not contain AGC as a substring.\n\nThe condition above cannot be violated by swapping two adjacent characters once.\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\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings of length N that satisfy the following conditions, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n61\n\nThere are 4^3 = 64 strings of length 3 that do not contain characters other than A, C, G and T. Among them, only AGC, ACG and GAC violate the condition, so the answer is 64 - 3 = 61.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n230\n\nSample Input 3\n\n100\n\nSample Output 3\n\n388130742\n\nBe sure to print the number of strings modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 414, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s970884602", "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(n*(n-1)/2-(n-1)/2);\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": 1565062916, "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/s970884602.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s970884602", "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(n*(n-1)/2-(n-1)/2);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 412, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s416212125", "group_id": "codeNet:p03095", "input_text": "var\nN,i:Longint;\nS:String;\ncnt:Array[1..26]of int64;\nans:int64=1;\nbegin\nreadln(N);\nreadln(S);\nfor i:=1 to N do inc(cnt[ord(S[i])-96]);\nfor i:=1 to 26 do ans:=ans*(cnt[i]+1)mod 1000000007;\nwriteln(ans-1);\nend.", "language": "Pascal", "metadata": {"date": 1579662861, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03095.html", "problem_id": "p03095", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03095/input.txt", "sample_output_relpath": "derived/input_output/data/p03095/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03095/Pascal/s416212125.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s416212125", "user_id": "u657913472"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "var\nN,i:Longint;\nS:String;\ncnt:Array[1..26]of int64;\nans:int64=1;\nbegin\nreadln(N);\nreadln(S);\nfor i:=1 to N do inc(cnt[ord(S[i])-96]);\nfor i:=1 to 26 do ans:=ans*(cnt[i]+1)mod 1000000007;\nwriteln(ans-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N.\nAmong its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.\n\nHere, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nS consists of lowercase English letters.\n\n|S|=N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of the subsequences such that all characters are different, modulo 10^9+7.\n\nSample Input 1\n\n4\nabcd\n\nSample Output 1\n\n15\n\nSince all characters in S itself are different, all its subsequences satisfy the condition.\n\nSample Input 2\n\n3\nbaa\n\nSample Output 2\n\n5\n\nThe answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.\n\nSample Input 3\n\n5\nabcab\n\nSample Output 3\n\n17", "sample_input": "4\nabcd\n"}, "reference_outputs": ["15\n"], "source_document_id": "p03095", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N.\nAmong its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.\n\nHere, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nS consists of lowercase English letters.\n\n|S|=N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of the subsequences such that all characters are different, modulo 10^9+7.\n\nSample Input 1\n\n4\nabcd\n\nSample Output 1\n\n15\n\nSince all characters in S itself are different, all its subsequences satisfy the condition.\n\nSample Input 2\n\n3\nbaa\n\nSample Output 2\n\n5\n\nThe answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.\n\nSample Input 3\n\n5\nabcab\n\nSample Output 3\n\n17", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s613281833", "group_id": "codeNet:p03107", "input_text": "var\n\ta,b,i:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=1 to length(s)do begin\n\t\tif s[i]='0'then inc(a)else inc(b);\n\tend;\n\tif auf.pr[b] then begin\n\t\t\tinc(uf.pr[b],uf.pr[a]);\n\t\t\tuf.pr[a]:=b;\n\t\tend else begin\n\t\t\tinc(uf.pr[a],uf.pr[b]);\n\t\t\tuf.pr[b]:=a;\n\t\tend;\n\t\tunite:=true;\n\tend;\nend;\nfunction size(var uf:UnionFind;a:Longint):Longint;\nbegin\n\tsize:=-uf.pr[find(uf,a)];\nend;\nvar\n\tN,M,i:Longint;\n\tuf:UnionFind;\n\tnow,x,y:int64;\n\tans:Array[1..100000]of int64;\n\tu,v:Array[1..100000]of Longint;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(u[i],v[i]);\n\tend;\n\tinit(uf,N);\n\tx:=N;\n\ty:=N-1;\n\tnow:=x*y div 2;\n\tfor i:=M downto 1 do begin\n\t\tans[i]:=now;\n\t\tif not same(uf,u[i],v[i])then begin\n\t\t\tx:=size(uf,u[i]);\n\t\t\ty:=size(uf,v[i]);\n\t\t\tdec(now,x*y);\n\t\tend;\n\t\tunite(uf,u[i],v[i]);\n\tend;\n\tfor i:=1 to M do writeln(ans[i]);\nend.\n", "language": "Pascal", "metadata": {"date": 1583216039, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03108.html", "problem_id": "p03108", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03108/input.txt", "sample_output_relpath": "derived/input_output/data/p03108/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03108/Pascal/s155943598.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s155943598", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0\n0\n4\n5\n6\n", "input_to_evaluate": "type UnionFind=record n:Longint;pr:Array of Longint;end;\nprocedure init(var uf:UnionFind;N:Longint);\nvar i:Longint;\nbegin\n\tuf.n:=N;\n\tsetlength(uf.pr,N);\n\tfor i:=1 to N do uf.pr[i]:=-1;\nend;\nfunction find(var uf:UnionFind;a:Longint):Longint;\nbegin\n\tif uf.pr[a]<0 then find:=a else begin\n\t\tuf.pr[a]:=find(uf,uf.pr[a]);\n\t\tfind:=uf.pr[a];\n\tend;\nend;\nfunction same(var uf:UnionFind;a,b:Longint):Boolean;\nbegin\n\tsame:=find(uf,a)=find(uf,b);\nend;\nfunction unite(var uf:UnionFind;a,b:Longint):Boolean;\nbegin\n\ta:=find(uf,a);\n\tb:=find(uf,b);\n\tif a=b then unite:=false else begin\n\t\tif uf.pr[a]>uf.pr[b] then begin\n\t\t\tinc(uf.pr[b],uf.pr[a]);\n\t\t\tuf.pr[a]:=b;\n\t\tend else begin\n\t\t\tinc(uf.pr[a],uf.pr[b]);\n\t\t\tuf.pr[b]:=a;\n\t\tend;\n\t\tunite:=true;\n\tend;\nend;\nfunction size(var uf:UnionFind;a:Longint):Longint;\nbegin\n\tsize:=-uf.pr[find(uf,a)];\nend;\nvar\n\tN,M,i:Longint;\n\tuf:UnionFind;\n\tnow,x,y:int64;\n\tans:Array[1..100000]of int64;\n\tu,v:Array[1..100000]of Longint;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(u[i],v[i]);\n\tend;\n\tinit(uf,N);\n\tx:=N;\n\ty:=N-1;\n\tnow:=x*y div 2;\n\tfor i:=M downto 1 do begin\n\t\tans[i]:=now;\n\t\tif not same(uf,u[i],v[i])then begin\n\t\t\tx:=size(uf,u[i]);\n\t\t\ty:=size(uf,v[i]);\n\t\t\tdec(now,x*y);\n\t\tend;\n\t\tunite(uf,u[i],v[i]);\n\tend;\n\tfor i:=1 to M do writeln(ans[i]);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\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_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "sample_input": "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"}, "reference_outputs": ["0\n0\n4\n5\n6\n"], "source_document_id": "p03108", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\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_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1272, "cpu_time_ms": 50, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s349227189", "group_id": "codeNet:p03109", "input_text": "var\n\ta,b,c:longint;\n ch:char;\nbegin\n\tread(a,ch,b,ch,c);\n a:=a*10000+b*100+c;\n if a<=20190430 then writeln('Heisei')\n else writeln('TBD');\nend.", "language": "Pascal", "metadata": {"date": 1551038691, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03109.html", "problem_id": "p03109", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03109/input.txt", "sample_output_relpath": "derived/input_output/data/p03109/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03109/Pascal/s349227189.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s349227189", "user_id": "u957998623"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "var\n\ta,b,c:longint;\n ch:char;\nbegin\n\tread(a,ch,b,ch,c);\n a:=a*10000+b*100+c;\n if a<=20190430 then writeln('Heisei')\n else writeln('TBD');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "sample_input": "2019/04/30\n"}, "reference_outputs": ["Heisei\n"], "source_document_id": "p03109", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s194212148", "group_id": "codeNet:p03110", "input_text": "var\n\tch:string;\n\tn,i:longint;\n\tans,s,f:real;\nbegin\n\treadln(n);\n\tans:=0;\n\tfor i:=1 to n do\n\tbegin\n\t\tread(s); readln(ch);\n\t\tif pos('JPY',ch)<>0 then f:=1\n\t\telse f:=380000;\n\t\tans:=ans+s*f;\n\tend;\n\twriteln(ans:0:7);\nend.", "language": "Pascal", "metadata": {"date": 1551039373, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03110.html", "problem_id": "p03110", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03110/input.txt", "sample_output_relpath": "derived/input_output/data/p03110/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03110/Pascal/s194212148.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s194212148", "user_id": "u957998623"}, "prompt_components": {"gold_output": "48000.0\n", "input_to_evaluate": "var\n\tch:string;\n\tn,i:longint;\n\tans,s,f:real;\nbegin\n\treadln(n);\n\tans:=0;\n\tfor i:=1 to n do\n\tbegin\n\t\tread(s); readln(ch);\n\t\tif pos('JPY',ch)<>0 then f:=1\n\t\telse f:=380000;\n\t\tans:=ans+s*f;\n\tend;\n\twriteln(ans:0:7);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "sample_input": "2\n10000 JPY\n0.10000000 BTC\n"}, "reference_outputs": ["48000.0\n"], "source_document_id": "p03110", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s604770447", "group_id": "codeNet:p03111", "input_text": "var\n\tn,a,b,c,s,x:Longint;\n\ti,j,k:byte;\n\td:array[0..255]of Longint;\n\tf:array[0..255]of Longint=(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8);\nbegin\n\tread(n,a,b,c);\n\ti:=0;\n\tfor k:=1 to n do begin\n\t\tread(x);\n\t\tfor j:=0 to i do begin\n\t\t\td[j+i+1]:=d[j]+x;\n\t\tend;\n\t\tinc(i,i+1);\n\tend;\n\ts:=5000000;\n\td[0]:=50000000;\n\tfor j:=0 to i do for k:=0 to i do begin\n\t\tx:=abs(d[j and k]-a)+abs(d[j and not k]-b)+abs(d[k and not j]-c)+f[j or k]*10-30;\n\t\tif s>x then s:=x;\n\tend;\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1551352693, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03111.html", "problem_id": "p03111", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03111/input.txt", "sample_output_relpath": "derived/input_output/data/p03111/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03111/Pascal/s604770447.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s604770447", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "var\n\tn,a,b,c,s,x:Longint;\n\ti,j,k:byte;\n\td:array[0..255]of Longint;\n\tf:array[0..255]of Longint=(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8);\nbegin\n\tread(n,a,b,c);\n\ti:=0;\n\tfor k:=1 to n do begin\n\t\tread(x);\n\t\tfor j:=0 to i do begin\n\t\t\td[j+i+1]:=d[j]+x;\n\t\tend;\n\t\tinc(i,i+1);\n\tend;\n\ts:=5000000;\n\td[0]:=50000000;\n\tfor j:=0 to i do for k:=0 to i do begin\n\t\tx:=abs(d[j and k]-a)+abs(d[j and not k]-b)+abs(d[k and not j]-c)+f[j or k]*10-30;\n\t\tif s>x then s:=x;\n\tend;\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "sample_input": "5 100 90 80\n98\n40\n30\n21\n80\n"}, "reference_outputs": ["23\n"], "source_document_id": "p03111", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 944, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s069603373", "group_id": "codeNet:p03112", "input_text": "type intArray = array[1..100000] of int64;\nvar s,t,x:intArray;\n min1,min2,miner:int64;\n i,j,a,b,q,m: integer;\n \nfunction min(a,b:int64):int64;\nbegin\n if a < b then min := a else min := b\nend;\n \nbegin\n readln(a,b,q);\n for i := 1 to a do readln(s[i]);\n for i := 1 to b do readln(t[i]);\n for i := 1 to q do readln(x[i]);\n for i := 1 to q do begin\n for j := 1 to a do begin\n if 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 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:=ans[i]; ans[i]:=ans[j]; ans[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt[a[j+1]]) or (t[a[j]]=t[a[j+1]]) and (a[j]=0) do\n\t\tbegin\n\t\t\tn:=n-t[a[t1]];\n\t\t\tinc(cnt); ans[cnt]:=a[t1];\n\t\tend;\n\t\tinc(t1);\n\tend;\n\tqsort(1,cnt);\n\tfor i:=cnt downto 1 do write(ans[i]);\n\twriteln;\nend.", "language": "Pascal", "metadata": {"date": 1550373539, "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/s075712331.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s075712331", "user_id": "u957998623"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "const\n\tt:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\tn,m,t1,i,j,cnt:longint;\n\ta,ans:array[-1100..10010] of longint;\n\tf:array[-1100..10010] of boolean;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=ans[(l+r) div 2];\n\trepeat\n\t\twhile ans[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=ans[i]; ans[i]:=ans[j]; ans[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt[a[j+1]]) or (t[a[j]]=t[a[j+1]]) and (a[j]=0) do\n\t\tbegin\n\t\t\tn:=n-t[a[t1]];\n\t\t\tinc(cnt); ans[cnt]:=a[t1];\n\t\tend;\n\t\tinc(t1);\n\tend;\n\tqsort(1,cnt);\n\tfor i:=cnt downto 1 do write(ans[i]);\n\twriteln;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "sample_input": "20 4\n3 7 8 4\n"}, "reference_outputs": ["777773\n"], "source_document_id": "p03128", "source_text": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1049, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s617765391", "group_id": "codeNet:p03128", "input_text": "const\n\tt:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\tn,m,t1,i,j,cnt:longint;\n\ta:array[0..10] of longint;\n\tans:array[0..5000] of longint;\n\tf:array[-110..10010] of boolean;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=ans[(l+r) div 2];\n\trepeat\n\t\twhile ans[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=ans[i]; ans[i]:=ans[j]; ans[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt[a[j+1]]) or (t[a[j]]=t[a[j+1]]) and (a[j]=0) do\n\t\tbegin\n\t\t\tn:=n-t[a[t1]];\n\t\t\tinc(cnt); ans[cnt]:=a[t1];\n\t\tend;\n\t\tinc(t1);\n\tend;\n\tqsort(1,cnt);\n\tfor i:=cnt downto 1 do write(ans[i]);\n\twriteln;\nend.", "language": "Pascal", "metadata": {"date": 1550373342, "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/s617765391.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s617765391", "user_id": "u957998623"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "const\n\tt:array[1..9] of longint=(2,5,5,4,5,6,3,7,6);\nvar\n\tn,m,t1,i,j,cnt:longint;\n\ta:array[0..10] of longint;\n\tans:array[0..5000] of longint;\n\tf:array[-110..10010] of boolean;\nprocedure qsort(l,r:longint);\nvar\n\ti,j,t,mid:longint;\nbegin\n\ti:=l; j:=r; mid:=ans[(l+r) div 2];\n\trepeat\n\t\twhile ans[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=ans[i]; ans[i]:=ans[j]; ans[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lt[a[j+1]]) or (t[a[j]]=t[a[j+1]]) and (a[j]=0) do\n\t\tbegin\n\t\t\tn:=n-t[a[t1]];\n\t\t\tinc(cnt); ans[cnt]:=a[t1];\n\t\tend;\n\t\tinc(t1);\n\tend;\n\tqsort(1,cnt);\n\tfor i:=cnt downto 1 do write(ans[i]);\n\twriteln;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "sample_input": "20 4\n3 7 8 4\n"}, "reference_outputs": ["777773\n"], "source_document_id": "p03128", "source_text": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1069, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s443873557", "group_id": "codeNet:p03137", "input_text": "const NMAX=100000;\nvar n,m,i,j:integer;\n x:array[1..NMAX] of integer;\n y:array[1..NMAX] of integer;\n \nprocedure sortx(p,q:integer);\n var i,j,k,w:integer;\nbegin i:=p;j:=q; k:=x[(p+q) div 2];\n repeat\n while x[i]j;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pj;\n if pb[i]) and (b[i]<>c[i]) and (c[i]<>a[i])) then cnt:=cnt+2 else cnt:=cnt+1;\nend;\nend;\nwriteln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1598549291, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03140.html", "problem_id": "p03140", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03140/input.txt", "sample_output_relpath": "derived/input_output/data/p03140/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03140/Pascal/s149058378.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s149058378", "user_id": "u984276646"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var a,b,c:string;n,i,cnt:integer;\nbegin\nreadln(n);\nreadln(a);\nreadln(b);\nreadln(c);\ncnt:=0;\nfor i:=1 to n do begin\nif ((a[i]=b[i]) and (b[i]=c[i])) then cnt:=cnt\nelse begin\nif ((a[i]<>b[i]) and (b[i]<>c[i]) and (c[i]<>a[i])) then cnt:=cnt+2 else cnt:=cnt+1;\nend;\nend;\nwriteln(cnt);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:\n\nOperation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.\n\nWhat is the minimum number of operations required to achieve the objective?\n\nConstraints\n\n1 \\leq N \\leq 100\n\nEach of the strings A, B and C is a string of length N.\n\nEach character in each of the strings A, B and C is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\nwest\neast\nwait\n\nSample Output 1\n\n3\n\nIn this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:\n\nChange the second character in A to a. A is now wast.\n\nChange the first character in B to w. B is now wast.\n\nChange the third character in C to s. C is now wast.\n\nSample Input 2\n\n9\ndifferent\ndifferent\ndifferent\n\nSample Output 2\n\n0\n\nIf A, B and C are already equal in the beginning, the number of operations required is 0.\n\nSample Input 3\n\n7\nzenkoku\ntouitsu\nprogram\n\nSample Output 3\n\n13", "sample_input": "4\nwest\neast\nwait\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03140", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:\n\nOperation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.\n\nWhat is the minimum number of operations required to achieve the objective?\n\nConstraints\n\n1 \\leq N \\leq 100\n\nEach of the strings A, B and C is a string of length N.\n\nEach character in each of the strings A, B and C is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\nwest\neast\nwait\n\nSample Output 1\n\n3\n\nIn this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:\n\nChange the second character in A to a. A is now wast.\n\nChange the first character in B to w. B is now wast.\n\nChange the third character in C to s. C is now wast.\n\nSample Input 2\n\n9\ndifferent\ndifferent\ndifferent\n\nSample Output 2\n\n0\n\nIf A, B and C are already equal in the beginning, the number of operations required is 0.\n\nSample Input 3\n\n7\nzenkoku\ntouitsu\nprogram\n\nSample Output 3\n\n13", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 5, "memory_kb": 1324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s392900719", "group_id": "codeNet:p03146", "input_text": "var\n\tf:array[-1100..1100000] of boolean;\n\ts,i:longint;\nbegin\n\tread(s);\n\ti:=1;\n\tfillchar(f,sizeof(f),false);\n\twhile f[s]=false do\n\tbegin\n\t\tf[s]:=true;\n\t\tinc(i);\n\t\tif s mod 2=0 then s:=s div 2\n\t\telse s:=s*3+1;\n\tend;\n\twriteln(i);\nend.", "language": "Pascal", "metadata": {"date": 1548036787, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03146.html", "problem_id": "p03146", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03146/input.txt", "sample_output_relpath": "derived/input_output/data/p03146/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03146/Pascal/s392900719.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s392900719", "user_id": "u957998623"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n\tf:array[-1100..1100000] of boolean;\n\ts,i:longint;\nbegin\n\tread(s);\n\ti:=1;\n\tfillchar(f,sizeof(f),false);\n\twhile f[s]=false do\n\tbegin\n\t\tf[s]:=true;\n\t\tinc(i);\n\t\tif s mod 2=0 then s:=s div 2\n\t\telse s:=s*3+1;\n\tend;\n\twriteln(i);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "sample_input": "8\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03146", "source_text": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 231, "cpu_time_ms": 13, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s856995608", "group_id": "codeNet:p03155", "input_text": "var n,h,w:integer;begin readln(n);readln(h);readln(w);writeln((n-h+1)*(n-w+1));end.", "language": "Pascal", "metadata": {"date": 1597445238, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03155.html", "problem_id": "p03155", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03155/input.txt", "sample_output_relpath": "derived/input_output/data/p03155/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03155/Pascal/s856995608.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s856995608", "user_id": "u984276646"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,h,w:integer;begin readln(n);readln(h);readln(w);writeln((n-h+1)*(n-w+1));end.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board.\n\nThe bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns.\n\nHow many ways are there to choose where to put the notice so that it completely covers exactly HW squares?\n\nConstraints\n\n1 \\leq H, W \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH\nW\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n2\n3\n\nSample Output 1\n\n2\n\nThere are two ways to put the notice, as follows:\n\n### ...\n### ###\n... ###\n\nHere, # represents a square covered by the notice, and . represents a square not covered.\n\nSample Input 2\n\n100\n1\n1\n\nSample Output 2\n\n10000\n\nSample Input 3\n\n5\n4\n2\n\nSample Output 3\n\n8", "sample_input": "3\n2\n3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03155", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board.\n\nThe bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns.\n\nHow many ways are there to choose where to put the notice so that it completely covers exactly HW squares?\n\nConstraints\n\n1 \\leq H, W \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH\nW\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n2\n3\n\nSample Output 1\n\n2\n\nThere are two ways to put the notice, as follows:\n\n### ...\n### ###\n... ###\n\nHere, # represents a square covered by the notice, and . represents a square not covered.\n\nSample Input 2\n\n100\n1\n1\n\nSample Output 2\n\n10000\n\nSample Input 3\n\n5\n4\n2\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 83, "cpu_time_ms": 5, "memory_kb": 1384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s136042900", "group_id": "codeNet:p03156", "input_text": "var\nn,a,b,i,f,g,h,p,cnt:integer;\nbegin\nreadln(n);\nread(a,b);\nfor i:=1 to n do begin\nread(p);\nif(p<=a)then f:=f+1;\nif(as then break;\n p:=i-1;\n q:=i;\n t:=n;\n j:=n div 2;\n while j>0 do\n begin\n dec(j);\n f[t]:=true;\n dec(t);\n if p=0 then begin ans:=a[q]+ans; inc(q); end\n else if f[q] then begin ans:=a[p]+ans; dec(p,2); end\n else if s-a[p]>=q-s then\n begin\n ans:=a[p]+ans;\n dec(p);\n end else\n begin\n ans:=a[q]+ans;\n inc(q);\n end;\n end;\nend;\nbegin\n readln(n,m);\n for i:=1 to n do begin read(a[i]); anq:=a[i]+anq; end;\n for i:=1 to m do\n begin\n readln(b[i]);\n ans:=0;\n zx(b[i]);\n writeln(anq-ans);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1547328820, "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/s493514184.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s493514184", "user_id": "u380619494"}, "prompt_components": {"gold_output": "31\n31\n27\n23\n23\n", "input_to_evaluate": "var\n a,b:array[0..100002]of longint;\n i,j,k,n,m,p,q,ans,anq:longint;\nfunction max(a,b:longint):longint;\nbegin\n if abs(a)<=b then exit(a)\n else exit(b);\nend;\nprocedure zx(s:longint);\nvar\n i,j,p,q,t,u,o:longint;\n f:array[0..100002]of boolean;\nbegin\n for i:=1 to n do\n if a[i]>s then break;\n p:=i-1;\n q:=i;\n t:=n;\n j:=n div 2;\n while j>0 do\n begin\n dec(j);\n f[t]:=true;\n dec(t);\n if p=0 then begin ans:=a[q]+ans; inc(q); end\n else if f[q] then begin ans:=a[p]+ans; dec(p,2); end\n else if s-a[p]>=q-s then\n begin\n ans:=a[p]+ans;\n dec(p);\n end else\n begin\n ans:=a[q]+ans;\n inc(q);\n end;\n end;\nend;\nbegin\n readln(n,m);\n for i:=1 to n do begin read(a[i]); anq:=a[i]+anq; end;\n for i:=1 to m do\n begin\n readln(b[i]);\n ans:=0;\n zx(b[i]);\n writeln(anq-ans);\n end;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N cards. The i-th card has an integer A_i written on it.\nFor any two cards, the integers on those cards are different.\n\nUsing these cards, Takahashi and Aoki will play the following game:\n\nAoki chooses an integer x.\n\nStarting from Takahashi, the two players alternately take a card. The card should be chosen in the following manner:\n\nTakahashi should take the card with the largest integer among the remaining card.\n\nAoki should take the card with the integer closest to x among the remaining card. If there are multiple such cards, he should take the card with the smallest integer among those cards.\n\nThe game ends when there is no card remaining.\n\nYou are given Q candidates for the value of x: X_1, X_2, ..., X_Q.\nFor each i (1 \\leq i \\leq Q), find the sum of the integers written on the cards that Takahashi will take if Aoki chooses x = X_i.\n\nConstraints\n\n2 \\leq N \\leq 100 000\n\n1 \\leq Q \\leq 100 000\n\n1 \\leq A_1 < A_2 < ... < A_N \\leq 10^9\n\n1 \\leq X_i \\leq 10^9 (1 \\leq i \\leq Q)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nA_1 A_2 ... A_N\nX_1\nX_2\n:\nX_Q\n\nOutput\n\nPrint Q lines. The i-th line (1 \\leq i \\leq Q) should contain the answer for x = X_i.\n\nSample Input 1\n\n5 5\n3 5 7 11 13\n1\n4\n9\n10\n13\n\nSample Output 1\n\n31\n31\n27\n23\n23\n\nFor example, when x = X_3(= 9), the game proceeds as follows:\n\nTakahashi takes the card with 13.\n\nAoki takes the card with 7.\n\nTakahashi takes the card with 11.\n\nAoki takes the card with 5.\n\nTakahashi takes the card with 3.\n\nThus, 13 + 11 + 3 = 27 should be printed on the third line.\n\nSample Input 2\n\n4 3\n10 20 30 40\n2\n34\n34\n\nSample Output 2\n\n70\n60\n60", "sample_input": "5 5\n3 5 7 11 13\n1\n4\n9\n10\n13\n"}, "reference_outputs": ["31\n31\n27\n23\n23\n"], "source_document_id": "p03158", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N cards. The i-th card has an integer A_i written on it.\nFor any two cards, the integers on those cards are different.\n\nUsing these cards, Takahashi and Aoki will play the following game:\n\nAoki chooses an integer x.\n\nStarting from Takahashi, the two players alternately take a card. The card should be chosen in the following manner:\n\nTakahashi should take the card with the largest integer among the remaining card.\n\nAoki should take the card with the integer closest to x among the remaining card. If there are multiple such cards, he should take the card with the smallest integer among those cards.\n\nThe game ends when there is no card remaining.\n\nYou are given Q candidates for the value of x: X_1, X_2, ..., X_Q.\nFor each i (1 \\leq i \\leq Q), find the sum of the integers written on the cards that Takahashi will take if Aoki chooses x = X_i.\n\nConstraints\n\n2 \\leq N \\leq 100 000\n\n1 \\leq Q \\leq 100 000\n\n1 \\leq A_1 < A_2 < ... < A_N \\leq 10^9\n\n1 \\leq X_i \\leq 10^9 (1 \\leq i \\leq Q)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nA_1 A_2 ... A_N\nX_1\nX_2\n:\nX_Q\n\nOutput\n\nPrint Q lines. The i-th line (1 \\leq i \\leq Q) should contain the answer for x = X_i.\n\nSample Input 1\n\n5 5\n3 5 7 11 13\n1\n4\n9\n10\n13\n\nSample Output 1\n\n31\n31\n27\n23\n23\n\nFor example, when x = X_3(= 9), the game proceeds as follows:\n\nTakahashi takes the card with 13.\n\nAoki takes the card with 7.\n\nTakahashi takes the card with 11.\n\nAoki takes the card with 5.\n\nTakahashi takes the card with 3.\n\nThus, 13 + 11 + 3 = 27 should be printed on the third line.\n\nSample Input 2\n\n4 3\n10 20 30 40\n2\n34\n34\n\nSample Output 2\n\n70\n60\n60", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 841, "cpu_time_ms": 2103, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s067308282", "group_id": "codeNet:p03162", "input_text": "Program VACATION;\nuses math;\nvar F:array[1..1000005,1..3] of longint;\n n,i,j :longint;\n maxx:int64;\n fi:text;\n//-------------------------------\nbegin\n//assign(fi,'VACATION.inp');reset(fi);\nreadln(n);\nfor i:=1 to n do begin\n for j:=1 to 3 do begin\n Read(F[i,j]);\n end;\n end;\nfor i:=n-1 downto 1 do begin\n F[i,1]:=F[i,1]+max(F[i+1,2],F[i+1,3]);\n F[i,2]:=F[i,2]+max(F[i+1,1],F[i+1,3]);\n F[i,3]:=F[i,3]+max(F[i+1,2],F[i+1,1]);\n end;\nfor i:=1 to 3 do begin\n maxx:=max(maxx,F[1,i]);\n end;\nWriteln(maxx);\n//readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1566042506, "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/s067308282.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s067308282", "user_id": "u014341649"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "Program VACATION;\nuses math;\nvar F:array[1..1000005,1..3] of longint;\n n,i,j :longint;\n maxx:int64;\n fi:text;\n//-------------------------------\nbegin\n//assign(fi,'VACATION.inp');reset(fi);\nreadln(n);\nfor i:=1 to n do begin\n for j:=1 to 3 do begin\n Read(F[i,j]);\n end;\n end;\nfor i:=n-1 downto 1 do begin\n F[i,1]:=F[i,1]+max(F[i+1,2],F[i+1,3]);\n F[i,2]:=F[i,2]+max(F[i+1,1],F[i+1,3]);\n F[i,3]:=F[i,3]+max(F[i+1,2],F[i+1,1]);\n end;\nfor i:=1 to 3 do begin\n maxx:=max(maxx,F[1,i]);\n end;\nWriteln(maxx);\n//readln;\nend.\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 740, "cpu_time_ms": 34, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s271696274", "group_id": "codeNet:p03162", "input_text": "uses crt;\nvar a,b,c:array[1..100000] of longint;\n i,n:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n clrscr;\n readln(n);\n for i := 1 to n do readln(a[i],b[i],c[i]);\n for i:=2 to n do \n begin\n a[i]:=max(a[i-1],max(b[i-1],c[i-1])+a[i]);\n b[i]:=max(b[i-1],max(a[i-1],c[i-1])+b[i]);\n c[i]:=max(c[i-1],max(a[i-1],b[i-1])+c[i]);\n end;\n writeln(max(a[n],max(c[n],b[n])));\n readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1565481575, "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/s271696274.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s271696274", "user_id": "u805448247"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "uses crt;\nvar a,b,c:array[1..100000] of longint;\n i,n:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n clrscr;\n readln(n);\n for i := 1 to n do readln(a[i],b[i],c[i]);\n for i:=2 to n do \n begin\n a[i]:=max(a[i-1],max(b[i-1],c[i-1])+a[i]);\n b[i]:=max(b[i-1],max(a[i-1],c[i-1])+b[i]);\n c[i]:=max(c[i-1],max(a[i-1],b[i-1])+c[i]);\n end;\n writeln(max(a[n],max(c[n],b[n])));\n readln;\nend.\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 494, "cpu_time_ms": 36, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s610377219", "group_id": "codeNet:p03162", "input_text": " var f1:text; A,B,C: array [0..1000000] of longint;\n a1,b1,c1,i,n:longint;\n\n function max(x,y:longint):longint;\n BEGIN\n if xy 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": 1546803770, "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/s713093641.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s713093641", "user_id": "u957998623"}, "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 34, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s765411980", "group_id": "codeNet:p03164", "input_text": "var N, W, V, i, j: longint;\n ww, vv: array[1..1000] of longint;\n dp, weight: array[-10..100, -11000..100000] of longint;\nbegin\n readln(N, W);\n for i:=1 to N do\n begin\n readln(ww[i], vv[i]);\n V:=V+vv[i];\n end;\n for i:=1 to N do\n begin\n for j:=1 to V do\n begin\n if (weight[i-1,j-vv[i]]+ww[i]>W) then\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if (dp[i-1,j-vv[i]]+vv[i]<=j) then\n begin\n if dp[i-1,j]>dp[i-1,j-vv[i]]+vv[i] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i-1,j-vv[i]]+vv[i];\n weight[i,j]:=weight[i-1,j-vv[i]]+ww[i];\n end;\n end\n else\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end;\n end;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,V]);\nend.", "language": "Pascal", "metadata": {"date": 1589022948, "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/s765411980.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s765411980", "user_id": "u089230684"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "var N, W, V, i, j: longint;\n ww, vv: array[1..1000] of longint;\n dp, weight: array[-10..100, -11000..100000] of longint;\nbegin\n readln(N, W);\n for i:=1 to N do\n begin\n readln(ww[i], vv[i]);\n V:=V+vv[i];\n end;\n for i:=1 to N do\n begin\n for j:=1 to V do\n begin\n if (weight[i-1,j-vv[i]]+ww[i]>W) then\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end\n else\n begin\n if (dp[i-1,j-vv[i]]+vv[i]<=j) then\n begin\n if dp[i-1,j]>dp[i-1,j-vv[i]]+vv[i] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i-1,j-vv[i]]+vv[i];\n weight[i,j]:=weight[i-1,j-vv[i]]+ww[i];\n end;\n end\n else\n begin\n if dp[i-1,j]>dp[i,j-1] then\n begin\n dp[i,j]:=dp[i-1,j];\n weight[i,j]:=weight[i-1,j];\n end\n else\n begin\n dp[i,j]:=dp[i,j-1];\n weight[i,j]:=weight[i,j-1];\n end;\n end;\n end;\n// write(dp[i,j], ' ');\n end;\n// writeln;\n end;\n writeln(dp[N,V]);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1720, "cpu_time_ms": 110, "memory_kb": 90368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s042039040", "group_id": "codeNet:p03164", "input_text": "uses crt;\nvar\n w: array [0..100] of int64;\n v: array [0..100] of longint;\n c: array [0..100000] of int64;\n m,n,i,j,sum,k: longint;\n\n\nbegin\n clrscr;\n readln ( n, m);\n for i:=1 to n do\n begin\n readln ( w[i], v[i]);\n sum:= sum + v[i];\n end;\n\n c[0]:= 0;\n for i:=1 to sum do c[i]:= 100000000000;\n\n for i:=1 to n do\n begin\n j:= sum;\n while j >= v[i] do\n begin\n if c[j- v[i]] + w[i] <= c[j] then\n c[j]:= c[j- v[i]] + w[i];\n dec (j);\n end;\n end;\n\n for i:= sum downto 1 do\n if c[i] <= m then\n begin\n write ( i);\n break;\n end;\n readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1583876370, "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/s042039040.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s042039040", "user_id": "u428668906"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "uses crt;\nvar\n w: array [0..100] of int64;\n v: array [0..100] of longint;\n c: array [0..100000] of int64;\n m,n,i,j,sum,k: longint;\n\n\nbegin\n clrscr;\n readln ( n, m);\n for i:=1 to n do\n begin\n readln ( w[i], v[i]);\n sum:= sum + v[i];\n end;\n\n c[0]:= 0;\n for i:=1 to sum do c[i]:= 100000000000;\n\n for i:=1 to n do\n begin\n j:= sum;\n while j >= v[i] do\n begin\n if c[j- v[i]] + w[i] <= c[j] then\n c[j]:= c[j- v[i]] + w[i];\n dec (j);\n end;\n end;\n\n for i:= sum downto 1 do\n if c[i] <= m then\n begin\n write ( i);\n break;\n end;\n readln;\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 848, "cpu_time_ms": 23, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s838400595", "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 int32;\n f:array[0..100,0..100000] of int32;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n va:=0;\n read(n,m);\n for i:=1 to n do begin\n read(w[i],v[i]);\n inc(va,v[i]);\n end;\n\nend;\n\nprocedure xuli;\nvar i,j,ans: longint;\nbegin\n\n ans:=0;\n for i:=0 to n do begin\n for j:=0 to va do f[i][j]:=oo;\n end;\n\n f[0][0]:=0;\n\n for i:=1 to n do begin\n for j:=0 to va do begin\n if (j>=v[i]) and (f[i-1][j-v[i]]+w[i]<=m) then f[i][j]:=min(f[i-1][j],f[i-1][j-v[i]]+w[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n\n for j:=0 to va do begin\n if f[n][j]<=m then ans:=j;\n end;\n//\n// for i:=0 to n do begin\n// for j:=0 to va do begin\n// if f[i][j]=oo then write('oo':3)\n// else write(f[i][j]:3);\n// end;\n// writeln\n// end;\n\n write(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577013642, "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/s838400595.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s838400595", "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 int32;\n f:array[0..100,0..100000] of int32;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n va:=0;\n read(n,m);\n for i:=1 to n do begin\n read(w[i],v[i]);\n inc(va,v[i]);\n end;\n\nend;\n\nprocedure xuli;\nvar i,j,ans: longint;\nbegin\n\n ans:=0;\n for i:=0 to n do begin\n for j:=0 to va do f[i][j]:=oo;\n end;\n\n f[0][0]:=0;\n\n for i:=1 to n do begin\n for j:=0 to va do begin\n if (j>=v[i]) and (f[i-1][j-v[i]]+w[i]<=m) then f[i][j]:=min(f[i-1][j],f[i-1][j-v[i]]+w[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n\n for j:=0 to va do begin\n if f[n][j]<=m then ans:=j;\n end;\n//\n// for i:=0 to n do begin\n// for j:=0 to va do begin\n// if f[i][j]=oo then write('oo':3)\n// else write(f[i][j]:3);\n// end;\n// writeln\n// end;\n\n write(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1072, "cpu_time_ms": 55, "memory_kb": 39680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s028497340", "group_id": "codeNet:p03164", "input_text": "program knapsack1;\n\nuses math;\n\nconst\n fi='knapsack1.inp';\n fo='knapsack1.out';\n oo=trunc(1e9)+5;\n\nvar\n n,m,va: longint;\n v,w: array[0..100000] of int16;\n f:array[0..100,0..100000] of int32;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n va:=0;\n read(n,m);\n for i:=1 to n do begin\n read(w[i],v[i]);\n inc(va,v[i]);\n end;\n\nend;\n\nprocedure xuli;\nvar i,j,ans: longint;\nbegin\n\n ans:=0;\n for i:=0 to n do begin\n for j:=0 to va do f[i][j]:=oo;\n end;\n\n f[0][0]:=0;\n\n for i:=1 to n do begin\n for j:=0 to va do begin\n if (j>=v[i]) and (f[i-1][j-v[i]]+w[i]<=m) then f[i][j]:=min(f[i-1][j],f[i-1][j-v[i]]+w[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n\n for j:=0 to va do begin\n if f[n][j]<=m then ans:=j;\n end;\n//\n// for i:=0 to n do begin\n// for j:=0 to va do begin\n// if f[i][j]=oo then write('oo':3)\n// else write(f[i][j]:3);\n// end;\n// writeln\n// end;\n\n write(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577013474, "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/s028497340.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s028497340", "user_id": "u762868299"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "program knapsack1;\n\nuses math;\n\nconst\n fi='knapsack1.inp';\n fo='knapsack1.out';\n oo=trunc(1e9)+5;\n\nvar\n n,m,va: longint;\n v,w: array[0..100000] of int16;\n f:array[0..100,0..100000] of int32;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n va:=0;\n read(n,m);\n for i:=1 to n do begin\n read(w[i],v[i]);\n inc(va,v[i]);\n end;\n\nend;\n\nprocedure xuli;\nvar i,j,ans: longint;\nbegin\n\n ans:=0;\n for i:=0 to n do begin\n for j:=0 to va do f[i][j]:=oo;\n end;\n\n f[0][0]:=0;\n\n for i:=1 to n do begin\n for j:=0 to va do begin\n if (j>=v[i]) and (f[i-1][j-v[i]]+w[i]<=m) then f[i][j]:=min(f[i-1][j],f[i-1][j-v[i]]+w[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n\n for j:=0 to va do begin\n if f[n][j]<=m then ans:=j;\n end;\n//\n// for i:=0 to n do begin\n// for j:=0 to va do begin\n// if f[i][j]=oo then write('oo':3)\n// else write(f[i][j]:3);\n// end;\n// writeln\n// end;\n\n write(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reset(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1072, "cpu_time_ms": 71, "memory_kb": 39680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s392756837", "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:=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": 1577012373, "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/s392756837.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s392756837", "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:=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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 54, "memory_kb": 39680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s697252557", "group_id": "codeNet:p03164", "input_text": "program knapsack1;\n\nuses math;\n\nconst\n fi='knapsack1.inp';\n fo='knapsack1.out';\n\nvar\n n,m: longint;\n v,w: array[0..100000] of int64;\n f:array[0..100,0..100000] of int64;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n read(n,m);\n for i:=1 to n do read(w[i],v[i]);\n\nend;\n\nprocedure xuli;\nvar i,j: longint;\nbegin\n\n fillchar(f,sizeof(f),0);\n for i:=1 to n do begin\n for j:=1 to m do begin\n if j>=w[i] then f[i][j]:=max(f[i-1][j],f[i-1][j-w[i]]+v[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n write(f[n][m]);\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": 1577006938, "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/s697252557.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s697252557", "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\nvar\n n,m: longint;\n v,w: array[0..100000] of int64;\n f:array[0..100,0..100000] of int64;\n\nprocedure nhap;\nvar i: longint;\nbegin\n\n read(n,m);\n for i:=1 to n do read(w[i],v[i]);\n\nend;\n\nprocedure xuli;\nvar i,j: longint;\nbegin\n\n fillchar(f,sizeof(f),0);\n for i:=1 to n do begin\n for j:=1 to m do begin\n if j>=w[i] then f[i][j]:=max(f[i-1][j],f[i-1][j-w[i]]+v[i])\n else f[i][j]:=f[i-1][j];\n end;\n end;\n\n write(f[n][m]);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 676, "cpu_time_ms": 322, "memory_kb": 387968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s761745797", "group_id": "codeNet:p03164", "input_text": "var\n\tf:array[0..100010] of int64;\n\ta,b,n,m,i,j:longint;\nbegin\n\treadln(n,m);\n\tfillchar(f,sizeof(f),$7f);\n\tf[0]:=0;\n\tfor i:=1 to n do \n\tbegin\n\t\tread(a,b);\n\t\tfor j:=100000 downto b do\n\t\t\tif f[j-b]+aj then begin\n ans:=ifthen(k,ans+a[i],ans-a[j]);\n inc(i);\n end else begin\n ans:=ifthen(k,ans+a[j],ans-a[j]);\n dec(j);\n end;\n k:=not(k);\n until i>j;\n\n writeln(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reseT(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1577037959, "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/s532131730.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s532131730", "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 longint;\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,ans: longint; k:boolean;\nbegin\n\n i:=1; j:=n; k:=true;\n ans:=0;\n repeat\n if i>j then begin\n ans:=ifthen(k,ans+a[i],ans-a[j]);\n inc(i);\n end else begin\n ans:=ifthen(k,ans+a[j],ans-a[j]);\n dec(j);\n end;\n k:=not(k);\n until i>j;\n\n writeln(ans);\n\nend;\n\nbegin\n\n //assign(input,fi); reseT(input);\n //assign(output,fo); rewrite(output);\n\n nhap;\n xuli;\n\n //close(input); close(output);\n\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "sample_input": "4\n10 80 90 30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03171", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 677, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s295238389", "group_id": "codeNet:p03178", "input_text": "uses math;\nconst fi='digitnum.inp';\n fo='digitnum.out';\n maxn=10000;\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": 1577080317, "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/s295238389.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s295238389", "user_id": "u801427196"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "uses math;\nconst fi='digitnum.inp';\n fo='digitnum.out';\n maxn=10000;\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1358, "cpu_time_ms": 717, "memory_kb": 23680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s421344533", "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..100,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": 1577080017, "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/s421344533.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s421344533", "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..100,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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1358, "cpu_time_ms": 170, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s144373867", "group_id": "codeNet:p03186", "input_text": "var\n\ta,b,c,ans:int64;\nbegin\n\tread(a,b,c);\n\tif a+b+1>=c then writeln(b+c)else writeln(a+b+1+b);\nend.", "language": "Pascal", "metadata": {"date": 1546135469, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03186.html", "problem_id": "p03186", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03186/input.txt", "sample_output_relpath": "derived/input_output/data/p03186/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03186/Pascal/s144373867.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s144373867", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n\ta,b,c,ans:int64;\nbegin\n\tread(a,b,c);\n\tif a+b+1>=c then writeln(b+c)else writeln(a+b+1+b);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A untasty cookies containing antidotes, B tasty cookies containing antidotes and C tasty cookies containing poison.\n\nEating a cookie containing poison results in a stomachache, and eating a cookie containing poison while having a stomachache results in a death.\nAs he wants to live, he cannot eat one in such a situation.\nEating a cookie containing antidotes while having a stomachache cures it, and there is no other way to cure stomachaches.\n\nFind the maximum number of tasty cookies that Takahashi can eat.\n\nConstraints\n\n0 \\leq A,B,C \\leq 10^9\n\nA,B and C are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum number of tasty cookies that Takahashi can eat.\n\nSample Input 1\n\n3 1 4\n\nSample Output 1\n\n5\n\nWe can eat all tasty cookies, in the following order:\n\nA tasty cookie containing poison\n\nAn untasty cookie containing antidotes\n\nA tasty cookie containing poison\n\nA tasty cookie containing antidotes\n\nA tasty cookie containing poison\n\nAn untasty cookie containing antidotes\n\nA tasty cookie containing poison\n\nSample Input 2\n\n5 2 9\n\nSample Output 2\n\n10\n\nSample Input 3\n\n8 8 1\n\nSample Output 3\n\n9", "sample_input": "3 1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03186", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A untasty cookies containing antidotes, B tasty cookies containing antidotes and C tasty cookies containing poison.\n\nEating a cookie containing poison results in a stomachache, and eating a cookie containing poison while having a stomachache results in a death.\nAs he wants to live, he cannot eat one in such a situation.\nEating a cookie containing antidotes while having a stomachache cures it, and there is no other way to cure stomachaches.\n\nFind the maximum number of tasty cookies that Takahashi can eat.\n\nConstraints\n\n0 \\leq A,B,C \\leq 10^9\n\nA,B and C are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the maximum number of tasty cookies that Takahashi can eat.\n\nSample Input 1\n\n3 1 4\n\nSample Output 1\n\n5\n\nWe can eat all tasty cookies, in the following order:\n\nA tasty cookie containing poison\n\nAn untasty cookie containing antidotes\n\nA tasty cookie containing poison\n\nA tasty cookie containing antidotes\n\nA tasty cookie containing poison\n\nAn untasty cookie containing antidotes\n\nA tasty cookie containing poison\n\nSample Input 2\n\n5 2 9\n\nSample Output 2\n\n10\n\nSample Input 3\n\n8 8 1\n\nSample Output 3\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 99, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s199540481", "group_id": "codeNet:p03192", "input_text": "var\n st:string;\n i,s:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n if st[i]='2' then inc(s);\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1583285075, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "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/s199540481.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s199540481", "user_id": "u263933075"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n st:string;\n i,s:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n if st[i]='2' then inc(s);\n writeln(s);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s119155950", "group_id": "codeNet:p03194", "input_text": "var\n n,p,s:int64;\n f:array[0..1000010] of longint;\n i,j,t:longint;\nbegin\n read(n,p);\n if n=1 then\n begin\n writeln(p);\n halt;\n end;\n if p=1 then \n begin\n writeln(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 inc(i);\n while p mod i=0 do\n begin\n p:=p div i;\n inc(f[i]);\n end;\n end;\n s:=1;\n for i:=2 to t do\n if f[i]>=n then\n for j:=1 to f[i] div n do s:=s*i;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1545532163, "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/s119155950.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s119155950", "user_id": "u380619494"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,p,s:int64;\n f:array[0..1000010] of longint;\n i,j,t:longint;\nbegin\n read(n,p);\n if n=1 then\n begin\n writeln(p);\n halt;\n end;\n if p=1 then \n begin\n writeln(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 inc(i);\n while p mod i=0 do\n begin\n p:=p div i;\n inc(f[i]);\n end;\n end;\n s:=1;\n for i:=2 to t do\n if f[i]>=n then\n for j:=1 to f[i] div n do s:=s*i;\n writeln(s);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 588, "cpu_time_ms": 13, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s669600577", "group_id": "codeNet:p03194", "input_text": "var\n n,p,s:int64;\n f:array[0..1000010] of longint;\n i,j,t:longint;\nbegin\n read(n,p);\n if n=1 then\n begin\n writeln(p);\n halt;\n end;\n if p=1 then \n begin\n writeln(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 inc(i);\n while p mod i=0 do\n begin\n p:=p div i;\n inc(f[i]);\n end;\n end;\n s:=1;\n for i:=2 to t do\n if f[i]>=n then\n for j:=1 to f[i] div n do s:=s*i;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1545532054, "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/s669600577.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s669600577", "user_id": "u223928734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,p,s:int64;\n f:array[0..1000010] of longint;\n i,j,t:longint;\nbegin\n read(n,p);\n if n=1 then\n begin\n writeln(p);\n halt;\n end;\n if p=1 then \n begin\n writeln(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 inc(i);\n while p mod i=0 do\n begin\n p:=p div i;\n inc(f[i]);\n end;\n end;\n s:=1;\n for i:=2 to t do\n if f[i]>=n then\n for j:=1 to f[i] div n do s:=s*i;\n writeln(s);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 588, "cpu_time_ms": 14, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s733380741", "group_id": "codeNet:p03194", "input_text": "var\n\tn,p,s:int64;\n f:array[0..1000010] of longint;\n i,t:longint;\nbegin\n\tread(n,p);\n if n=1 then\n begin\n \twriteln(p);\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 s:=s*i;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1545531436, "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/s733380741.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s733380741", "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,t:longint;\nbegin\n\tread(n,p);\n if n=1 then\n begin\n \twriteln(p);\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 s:=s*i;\n writeln(s);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 460, "cpu_time_ms": 14, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s831535711", "group_id": "codeNet:p03194", "input_text": "var\n\tn,p,s:int64;\n f:array[0..1000010] of longint;\n i,t:longint;\nbegin\n\tread(n,p);\n if n=1 then\n begin\n \twriteln(p);\n halt;\n end;\n fillchar(f,sizeof(f),0);\n i:=1;\n while p<>1 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 t:=trunc(sqrt(p))+1;\n s:=1;\n for i:=2 to t do\n \tif f[i]>=n then s:=s*i;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1545531331, "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/s831535711.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s831535711", "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,t:longint;\nbegin\n\tread(n,p);\n if n=1 then\n begin\n \twriteln(p);\n halt;\n end;\n fillchar(f,sizeof(f),0);\n i:=1;\n while p<>1 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 t:=trunc(sqrt(p))+1;\n s:=1;\n for i:=2 to t do\n \tif f[i]>=n then s:=s*i;\n writeln(s);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 447, "cpu_time_ms": 2103, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s565569708", "group_id": "codeNet:p03195", "input_text": "var\n n,k,i,m,j,t,ans,c,d:longint;\n b:boolean;\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 if k<>t then b:=true;\n t:=k;\n end;\n if (ans=1)or(b=false) then writeln('first')\n else writeln('second');\nend.\n", "language": "Pascal", "metadata": {"date": 1545532999, "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/s565569708.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s565569708", "user_id": "u380619494"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "var\n n,k,i,m,j,t,ans,c,d:longint;\n b:boolean;\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 if k<>t then b:=true;\n t:=k;\n end;\n if (ans=1)or(b=false) 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 18, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s729993069", "group_id": "codeNet:p03195", "input_text": "var\n n,k,i,m,j,t,ans,c,d:longint;\n b:boolean;\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 if k<>1 then b:=true;\n end;\n if (ans=1)or(b=false) then writeln('first')\n else writeln('second');\nend.\n", "language": "Pascal", "metadata": {"date": 1545532844, "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/s729993069.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s729993069", "user_id": "u380619494"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "var\n n,k,i,m,j,t,ans,c,d:longint;\n b:boolean;\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 if k<>1 then b:=true;\n end;\n if (ans=1)or(b=false) 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 248, "cpu_time_ms": 18, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s160256117", "group_id": "codeNet:p03196", "input_text": "var\n\ti,ans,n,p,c:int64;\n\tj:Longint;\nbegin\n\tread(n,p);\n\tif n=1 then begin\n\t\twriteln(p);\n\t\texit;\n\tend;\n\ti:=2;\n\tans:=1;\n\twhile i*i<=p do begin\n\t\tc:=0;\n\t\twhile p mod i=0 do begin\n\t\t\tp:=p div i;\n\t\t\tinc(c);\n\t\tend;\n\t\tfor j:=1 to c div n do ans:=ans*i;\n\t\tinc(i);\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1545537230, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03196.html", "problem_id": "p03196", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03196/input.txt", "sample_output_relpath": "derived/input_output/data/p03196/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03196/Pascal/s160256117.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s160256117", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ti,ans,n,p,c:int64;\n\tj:Longint;\nbegin\n\tread(n,p);\n\tif n=1 then begin\n\t\twriteln(p);\n\t\texit;\n\tend;\n\ti:=2;\n\tans:=1;\n\twhile i*i<=p do begin\n\t\tc:=0;\n\t\twhile p mod i=0 do begin\n\t\t\tp:=p div i;\n\t\t\tinc(c);\n\t\tend;\n\t\tfor j:=1 to c div n do ans:=ans*i;\n\t\tinc(i);\n\tend;\n\twriteln(ans);\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": "p03196", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 281, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s640894989", "group_id": "codeNet:p03196", "input_text": "var\n\ti,ans,n,p,c:int64;\n\tj:Longint;\nbegin\n\tread(n,p);\n\tif n=1 then begin\n\t\twriteln(p);\n\t\texit;\n\tend;\n\ti:=2;\n\tans:=1;\n\twhile i*i<=p do begin\n\t\tc:=0;\n\t\twhile p mod i=0 do begin\n\t\t\tp:=p div i;\n\t\t\tinc(c);\n\t\tend;\n\t\tfor j:=1 to c div n do ans:=ans*i;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1545537200, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03196.html", "problem_id": "p03196", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03196/input.txt", "sample_output_relpath": "derived/input_output/data/p03196/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03196/Pascal/s640894989.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s640894989", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\ti,ans,n,p,c:int64;\n\tj:Longint;\nbegin\n\tread(n,p);\n\tif n=1 then begin\n\t\twriteln(p);\n\t\texit;\n\tend;\n\ti:=2;\n\tans:=1;\n\twhile i*i<=p do begin\n\t\tc:=0;\n\t\twhile p mod i=0 do begin\n\t\t\tp:=p div i;\n\t\t\tinc(c);\n\t\tend;\n\t\tfor j:=1 to c div n do ans:=ans*i;\n\tend;\n\twriteln(ans);\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": "p03196", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 271, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s394201668", "group_id": "codeNet:p03200", "input_text": "var i:Longint;B,E:int64;S:String;\nbegin\nreadln(S);\nfor i:=1 to length(S)do if S[i]='B'then inc(B)else inc(E,B);\nwriteln(E);\nend.", "language": "Pascal", "metadata": {"date": 1579683980, "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/s394201668.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s394201668", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var i:Longint;B,E:int64;S:String;\nbegin\nreadln(S);\nfor i:=1 to length(S)do if S[i]='B'then inc(B)else inc(E,B);\nwriteln(E);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 128, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s104693585", "group_id": "codeNet:p03201", "input_text": "var\n a:array[1..200000]of longint;\n f:array[1..200000]of boolean;\n n,s,i,j,ans:longint;\nfunction sp(a,b:longint):boolean;\nvar c:longint;\nbegin\n c:=a+b;\n while c mod 2 = 0 do c:=c div 2;\n if c = 1 then sp:=true else sp := false\nend;\nbegin\n readln(n);\n for i:=1 to n do begin\n read(a[i]);\n f[i]:=true\n end;\n for i:=2 to n do\n for j:=n downto i do\n if a[j]>a[j-1] then begin\n s:=a[j];\n a[j]:=a[j-1];\n a[j-1]:=s\n end;\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if sp(a[i],a[j])and f[i]and f[j] then begin\n ans:=ans+1;\n f[i]:=false;\n f[j]:=false\n end;\n write(ans)\nend.", "language": "Pascal", "metadata": {"date": 1545255176, "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/s104693585.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s104693585", "user_id": "u917872461"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[1..200000]of longint;\n f:array[1..200000]of boolean;\n n,s,i,j,ans:longint;\nfunction sp(a,b:longint):boolean;\nvar c:longint;\nbegin\n c:=a+b;\n while c mod 2 = 0 do c:=c div 2;\n if c = 1 then sp:=true else sp := false\nend;\nbegin\n readln(n);\n for i:=1 to n do begin\n read(a[i]);\n f[i]:=true\n end;\n for i:=2 to n do\n for j:=n downto i do\n if a[j]>a[j-1] then begin\n s:=a[j];\n a[j]:=a[j-1];\n a[j-1]:=s\n end;\n for i:=1 to n-1 do\n for j:=i+1 to n do\n if sp(a[i],a[j])and f[i]and f[j] then begin\n ans:=ans+1;\n f[i]:=false;\n f[j]:=false\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 616, "cpu_time_ms": 2103, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s947470424", "group_id": "codeNet:p03207", "input_text": "var\n x,ans,max,i,n:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(x);\n ans:=ans+x;\n if x>max then max:=x;\n end;\n writeln(ans-max div 2);\nend.", "language": "Pascal", "metadata": {"date": 1544584324, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03207.html", "problem_id": "p03207", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03207/input.txt", "sample_output_relpath": "derived/input_output/data/p03207/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03207/Pascal/s947470424.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s947470424", "user_id": "u018921758"}, "prompt_components": {"gold_output": "15950\n", "input_to_evaluate": "var\n x,ans,max,i,n:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(x);\n ans:=ans+x;\n if x>max then max:=x;\n end;\n writeln(ans-max div 2);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn some other world, today is the day before Christmas Eve.\n\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\n\nHe has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?\n\nConstraints\n\n2 \\leq N \\leq 10\n\n100 \\leq p_i \\leq 10000\n\np_i is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1\np_2\n:\np_N\n\nOutput\n\nPrint the total amount Mr. Takaha will pay.\n\nSample Input 1\n\n3\n4980\n7980\n6980\n\nSample Output 1\n\n15950\n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.\n\nNote that outputs such as 15950.0 will be judged as Wrong Answer.\n\nSample Input 2\n\n4\n4320\n4320\n4320\n4320\n\nSample Output 2\n\n15120\n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320 + 4320 + 4320 = 15120 yen.", "sample_input": "3\n4980\n7980\n6980\n"}, "reference_outputs": ["15950\n"], "source_document_id": "p03207", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn some other world, today is the day before Christmas Eve.\n\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\n\nHe has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?\n\nConstraints\n\n2 \\leq N \\leq 10\n\n100 \\leq p_i \\leq 10000\n\np_i is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1\np_2\n:\np_N\n\nOutput\n\nPrint the total amount Mr. Takaha will pay.\n\nSample Input 1\n\n3\n4980\n7980\n6980\n\nSample Output 1\n\n15950\n\nThe 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.\n\nNote that outputs such as 15950.0 will be judged as Wrong Answer.\n\nSample Input 2\n\n4\n4320\n4320\n4320\n4320\n\nSample Output 2\n\n15120\n\nOnly one of the four items gets the discount and the total is 4320 / 2 + 4320 + 4320 + 4320 = 15120 yen.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s543827187", "group_id": "codeNet:p03208", "input_text": "var\n h:array[1..100000]of longint;\n n,k,i,j,s,ans,maxIn:longint;\nbegin\n readln(n,k);\n for i:=1 to n do\n readln(h[i]);\n for i:=1 to n-1 do begin\n maxIn:=i;\n for j:=i+1 to n do\n if h[j]>h[maxIn] then maxIn:=j;\n s:=h[i];\n h[i]:=h[maxIn];\n h[maxIn]:=s\n end;\n ans:=h[1]-h[k];\n for i:=2 to n-k+1 do\n if h[i]-h[i+k-1]h[maxIn] then maxIn:=j;\n s:=h[i];\n h[i]:=h[maxIn];\n h[maxIn]:=s\n end;\n ans:=h[1]-h[k];\n for i:=2 to n-k+1 do\n if h[i]-h[i+k-1]h[maxIn] then maxIn:=j;\n s:=h[i];\n h[i]:=h[maxIn];\n h[maxIn]:=h[i]\n end;\n ans:=h[1]-h[k];\n for i:=2 to n-k+1 do\n if h[i]-h[i+k-1]h[maxIn] then maxIn:=j;\n s:=h[i];\n h[i]:=h[maxIn];\n h[maxIn]:=h[i]\n end;\n ans:=h[1]-h[k];\n for i:=2 to n-k+1 do\n if h[i]-h[i+k-1]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if 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 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 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 h[j] then m := j;\n t := h[i];\n h[i] := h[m];\n h[m] := t\n end;\n t := 999999999;\n for i := 0 to n - k do begin\n u := h[i + k - 1] - h[i];\n if t > u then t := u\n end;\n writeln(t)\nend.", "language": "Pascal", "metadata": {"date": 1544323109, "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/s785304880.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s785304880", "user_id": "u492212770"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var i,j,m,n,k : integer;\n t,u : longint;\n h : array[1..100000] of longint;\n\nbegin\n readln(n,k);\n for i := 0 to n - 1 do readln(h[i]);\n for i := 0 to n - 2 do begin\n m := i;\n for j := i + 1 to n - 1 do if h[m] > h[j] then m := j;\n t := h[i];\n h[i] := h[m];\n h[m] := t\n end;\n t := 999999999;\n for i := 0 to n - k do begin\n u := h[i + k - 1] - h[i];\n if t > 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 2103, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s323578706", "group_id": "codeNet:p03208", "input_text": "var\n n,k,i,ans:longint;\n a:array[0..100000]of 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 lmid 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 lmid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544322513, "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/s525651708.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s525651708", "user_id": "u223928734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..100000] of longint;\n i,n,j,m,k:longint;\n ans:qword;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r)shr 1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n p:=a[i];a[i]:=a[j];a[j]:=p;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 592, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s327148505", "group_id": "codeNet:p03208", "input_text": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:int64;\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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544322469, "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/s327148505.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s327148505", "user_id": "u223928734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:int64;\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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 592, "cpu_time_ms": 225, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s402838850", "group_id": "codeNet:p03208", "input_text": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:int64;\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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544322423, "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/s402838850.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s402838850", "user_id": "u223928734"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:int64;\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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 592, "cpu_time_ms": 158, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s611245835", "group_id": "codeNet:p03208", "input_text": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:qword;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) 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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1544322320, "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/s611245835.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s611245835", "user_id": "u380619494"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:qword;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,p:longint;\nbegin\n i:=l;j:=r;\n mid:=a[(l+r) 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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.\n", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 593, "cpu_time_ms": 164, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s774765840", "group_id": "codeNet:p03208", "input_text": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:int64;\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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1544322230, "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/s774765840.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s774765840", "user_id": "u380619494"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[1..10000] of longint;\n i,n,j,m,k:longint;\n ans:int64;\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(a[i+k-1]-a[i]) then ans:=a[i+k-1]-a[i];\n writeln(ans);\nend.\n", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 593, "cpu_time_ms": 254, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s019660685", "group_id": "codeNet:p03208", "input_text": "var\n\tn,i,k,min:longint;\n\ta:array[0..100010] of 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\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif lmid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif labs(b-753) then j:=abs(b-753);\n end;\n writeln(j);\nend.", "language": "Pascal", "metadata": {"date": 1543803047, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03211.html", "problem_id": "p03211", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03211/input.txt", "sample_output_relpath": "derived/input_output/data/p03211/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03211/Pascal/s152328312.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s152328312", "user_id": "u223928734"}, "prompt_components": {"gold_output": "34\n", "input_to_evaluate": "var\n a,b,c,i,j:longint;\n s,s2:string;\nbegin\n readln(s);\n j:=maxlongint;\n if length(s)<3 then begin val(s,b,c); writeln(abs(b-753)); halt; end;\n for i:=1 to length(s)-2 do\n begin\n s2:=copy(s,i,3);\n val(s2,b,c);\n if j>abs(b-753) then j:=abs(b-753);\n end;\n writeln(j);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "sample_input": "1234567876\n"}, "reference_outputs": ["34\n"], "source_document_id": "p03211", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s942209913", "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>777777700 then begin writeln(26484);exit;end;\n\twriteln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1575165626, "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/s942209913.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s942209913", "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>777777700 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s002217817", "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>777777752 then begin writeln(26484);exit;end;\n\twriteln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1575165593, "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/s002217817.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s002217817", "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>777777752 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s175370363", "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 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": 1543984339, "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/s175370363.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s175370363", "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 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 511, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s959609540", "group_id": "codeNet:p03212", "input_text": "var\n\tn,ans:Longint;\nprocedure f(x:int64;a,b,c:Longint);\nbegin\n\tif x>n then exit;\n\tinc(ans,a*b*c);\n\tf(x*10+3,1,b,c);\n\tf(x*10+5,a,1,c);\n\tf(x*10+7,a,b,1);\nend;\nbegin\n\tread(n);\n\tf(0,0,0,0);\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543812021, "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/s959609540.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s959609540", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tn,ans:Longint;\nprocedure f(x:int64;a,b,c:Longint);\nbegin\n\tif x>n then exit;\n\tinc(ans,a*b*c);\n\tf(x*10+3,1,b,c);\n\tf(x*10+5,a,1,c);\n\tf(x*10+7,a,b,1);\nend;\nbegin\n\tread(n);\n\tf(0,0,0,0);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s580277169", "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\twriteln(f(0,0,0,0));\nend.", "language": "Pascal", "metadata": {"date": 1543811953, "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/s580277169.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s580277169", "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\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s025248566", "group_id": "codeNet:p03212", "input_text": "var\n a,b,c,i,j,ans,m:longint;\n n:int64;\n s,s2:string;\n b1,b2,b3:boolean;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n b1:=false;\n b2:=false;\n b3:=false;\n s:='';\n\tstr(i,s);\n s:=s+'4';\n for j:=1 to length(s) do \n begin \n if (s[j]<>'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": 1543807745, "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/s025248566.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s025248566", "user_id": "u380619494"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n a,b,c,i,j,ans,m:longint;\n n:int64;\n s,s2:string;\n b1,b2,b3:boolean;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n b1:=false;\n b2:=false;\n b3:=false;\n s:='';\n\tstr(i,s);\n s:=s+'4';\n for j:=1 to length(s) do \n begin \n if (s[j]<>'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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 497, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s705195726", "group_id": "codeNet:p03212", "input_text": "var\n a,b,c,i,j,ans,m:longint;\n n:int64;\n s,s2:string;\n b1,b2,b3:boolean;\nbegin\n readln(n);\n if n<357 then begin writeln('0'); halt; end;\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('if (',n,''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('if (',n,''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": 1543807307, "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/s637441781.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s637441781", "user_id": "u380619494"}, "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1314, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s758996985", "group_id": "codeNet:p03212", "input_text": "const\n\tt:array[1..3] of char=('3','5','7');\nvar\n\tn:string;\n\tl,ans,b,j:longint;\nprocedure make(x:longint; s:string);\nvar\n\ti,a:longint;\nbegin\n\tif x=j+1 then\n\tbegin\n\t\tif pos('3',s)=0 then exit;\n\t\tif pos('5',s)=0 then exit;\n\t\tif pos('7',s)=0 then exit;\n\t\tval(s,a);\n\t\tif a>b then exit;\n\t\tinc(ans);\n\t\texit;\n\tend;\n\tfor i:=1 to 3 do make(x+1,s+t[i]);\nend;\nbegin\n\tread(b);\n\tstr(b,n);\n\tl:=length(n);\n\tans:=0;\n\tfor j:=3 to l do make(1,'');\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1543803635, "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/s758996985.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758996985", "user_id": "u957998623"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const\n\tt:array[1..3] of char=('3','5','7');\nvar\n\tn:string;\n\tl,ans,b,j:longint;\nprocedure make(x:longint; s:string);\nvar\n\ti,a:longint;\nbegin\n\tif x=j+1 then\n\tbegin\n\t\tif pos('3',s)=0 then exit;\n\t\tif pos('5',s)=0 then exit;\n\t\tif pos('7',s)=0 then exit;\n\t\tval(s,a);\n\t\tif a>b then exit;\n\t\tinc(ans);\n\t\texit;\n\tend;\n\tfor i:=1 to 3 do make(x+1,s+t[i]);\nend;\nbegin\n\tread(b);\n\tstr(b,n);\n\tl:=length(n);\n\tans:=0;\n\tfor j:=3 to l do make(1,'');\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 448, "cpu_time_ms": 8, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s649633716", "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": 1543807050, "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/s649633716.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s649633716", "user_id": "u223928734"}, "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s904072903", "group_id": "codeNet:p03213", "input_text": "var\n\tn,i,ans,p,j,a,cnt,k:Longint;\n\tdp:array[0..100,1..75]of Longint;\nfunction isp(a:Longint):Boolean;\nvar i:Longint;\nbegin\n\ti:=2;\n\twhile i*i<=a do begin\n\t\tif a mod i=0 then begin\n\t\t\tisp:=False;\n\t\t\texit;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tisp:=True;\nend;\nbegin\n\tread(n);\n\tdp[0,1]:=1;\n\tp:=0;\n\tfor i:=2 to n do begin\n\t\tif not isp(i)then continue;\n\t\tcnt:=0;\n\t\tfor j:=1 to n do begin\n\t\t\ta:=j;\n\t\t\twhile a mod i=0 do begin\n\t\t\t\ta:=a div i;\n\t\t\t\tinc(cnt);\n\t\t\tend;\n\t\tend;\n\t\tfor j:=0 to cnt do begin\n\t\t\tif not((j=0)or(j=2)or(j=4)or(j=14)or(j=24)or(j=74))then continue;\n\t\t\tfor k:=1 to 75 div (j+1)do inc(dp[i,k*(j+1)],dp[p,k]);\n\t\tend;\n\t\tp:=i;\n\tend;\n\twriteln(dp[p,75]);\nend.\n", "language": "Pascal", "metadata": {"date": 1543804667, "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/s904072903.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s904072903", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n\tn,i,ans,p,j,a,cnt,k:Longint;\n\tdp:array[0..100,1..75]of Longint;\nfunction isp(a:Longint):Boolean;\nvar i:Longint;\nbegin\n\ti:=2;\n\twhile i*i<=a do begin\n\t\tif a mod i=0 then begin\n\t\t\tisp:=False;\n\t\t\texit;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tisp:=True;\nend;\nbegin\n\tread(n);\n\tdp[0,1]:=1;\n\tp:=0;\n\tfor i:=2 to n do begin\n\t\tif not isp(i)then continue;\n\t\tcnt:=0;\n\t\tfor j:=1 to n do begin\n\t\t\ta:=j;\n\t\t\twhile a mod i=0 do begin\n\t\t\t\ta:=a div i;\n\t\t\t\tinc(cnt);\n\t\t\tend;\n\t\tend;\n\t\tfor j:=0 to cnt do begin\n\t\t\tif not((j=0)or(j=2)or(j=4)or(j=14)or(j=24)or(j=74))then continue;\n\t\t\tfor k:=1 to 75 div (j+1)do inc(dp[i,k*(j+1)],dp[p,k]);\n\t\tend;\n\t\tp:=i;\n\tend;\n\twriteln(dp[p,75]);\nend.\n", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 650, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s885064558", "group_id": "codeNet:p03214", "input_text": "var a:array[1..100] of integer;n,i,s,pnt,d:integer;\nbegin\nread(n);\ns:=0;\nfor i:=1 to n do begin read(a[i]);s:=s+a[i];end;\npnt:=n;\nd:=s;\nfor i:=1 to n do begin\nif(((a[i]*n-s)*(a[i]*n-s))<(d*d))then begin d:=(a[i]*n-s);pnt:=i;end;\nend;\nwriteln(pnt-1);\nend.", "language": "Pascal", "metadata": {"date": 1598460874, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03214.html", "problem_id": "p03214", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03214/input.txt", "sample_output_relpath": "derived/input_output/data/p03214/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03214/Pascal/s885064558.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s885064558", "user_id": "u984276646"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a:array[1..100] of integer;n,i,s,pnt,d:integer;\nbegin\nread(n);\ns:=0;\nfor i:=1 to n do begin read(a[i]);s:=s+a[i];end;\npnt:=n;\nd:=s;\nfor i:=1 to n do begin\nif(((a[i]*n-s)*(a[i]*n-s))<(d*d))then begin d:=(a[i]*n-s);pnt:=i;end;\nend;\nwriteln(pnt-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango-kun is an employee of Dwango Co., Ltd.\n\nOne day, he is asked to generate a thumbnail from a video a user submitted.\n\nTo generate a thumbnail, he needs to select a frame of the video according to the following procedure:\n\nGet an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.\n\nSelect t-th frame whose representation a_t is nearest to the average of all frame representations.\n\nIf there are multiple such frames, select the frame with the smallest index.\n\nFind the index t of the frame he should select to generate a thumbnail.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq a_i \\leq 100\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_{0} a_{1} ... a_{N-1}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nSince the average of frame representations is 2, Niwango-kun needs to select the index 1, whose representation is 2, that is, the nearest value to the average.\n\nSample Input 2\n\n4\n2 5 2 5\n\nSample Output 2\n\n0\n\nThe average of frame representations is 3.5.\n\nIn this case, every frame has the same distance from its representation to the average.\n\nTherefore, Niwango-kun should select index 0, the smallest index among them.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03214", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango-kun is an employee of Dwango Co., Ltd.\n\nOne day, he is asked to generate a thumbnail from a video a user submitted.\n\nTo generate a thumbnail, he needs to select a frame of the video according to the following procedure:\n\nGet an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.\n\nSelect t-th frame whose representation a_t is nearest to the average of all frame representations.\n\nIf there are multiple such frames, select the frame with the smallest index.\n\nFind the index t of the frame he should select to generate a thumbnail.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq a_i \\leq 100\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_{0} a_{1} ... a_{N-1}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nSince the average of frame representations is 2, Niwango-kun needs to select the index 1, whose representation is 2, that is, the nearest value to the average.\n\nSample Input 2\n\n4\n2 5 2 5\n\nSample Output 2\n\n0\n\nThe average of frame representations is 3.5.\n\nIn this case, every frame has the same distance from its representation to the average.\n\nTherefore, Niwango-kun should select index 0, the smallest index among them.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 6, "memory_kb": 1352}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s858404980", "group_id": "codeNet:p03216", "input_text": "var\n\tN,Q,ccc,i,k:Longint;\n\tD,DM,M,ans:int64;\n\tS:String;\nbegin\n\treadln(N);\n\treadln(S);\n\treadln(Q);\n\tfor ccc:=1 to Q do begin\n\t\tread(k);\n\t\tD:=0;DM:=0;M:=0;ans:=0;\n\t\tfor i:=1 to N do begin\n\t\t\tif i>k then begin\n\t\t\t\tif S[i-k]='D' then begin\n\t\t\t\t\tdec(DM,M);\n\t\t\t\t\tdec(D);\n\t\t\t\tend else if S[i-k]='M' then begin\n\t\t\t\t\tdec(M);\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tif S[i]='D' then begin\n\t\t\t\tinc(D);\n\t\t\tend else if S[i]='M' then begin\n\t\t\t\tinc(DM,D);\n\t\t\t\tinc(M);\n\t\t\tend else if S[i]='C' then begin\n\t\t\t\tinc(ans,DM);\n\t\t\tend;\n\t\tend;\n\t\twriteln(ans);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1581857181, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03216.html", "problem_id": "p03216", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03216/input.txt", "sample_output_relpath": "derived/input_output/data/p03216/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03216/Pascal/s858404980.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s858404980", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tN,Q,ccc,i,k:Longint;\n\tD,DM,M,ans:int64;\n\tS:String;\nbegin\n\treadln(N);\n\treadln(S);\n\treadln(Q);\n\tfor ccc:=1 to Q do begin\n\t\tread(k);\n\t\tD:=0;DM:=0;M:=0;ans:=0;\n\t\tfor i:=1 to N do begin\n\t\t\tif i>k then begin\n\t\t\t\tif S[i-k]='D' then begin\n\t\t\t\t\tdec(DM,M);\n\t\t\t\t\tdec(D);\n\t\t\t\tend else if S[i-k]='M' then begin\n\t\t\t\t\tdec(M);\n\t\t\t\tend;\n\t\t\tend;\n\t\t\tif S[i]='D' then begin\n\t\t\t\tinc(D);\n\t\t\tend else if S[i]='M' then begin\n\t\t\t\tinc(DM,D);\n\t\t\t\tinc(M);\n\t\t\tend else if S[i]='C' then begin\n\t\t\t\tinc(ans,DM);\n\t\t\tend;\n\t\tend;\n\t\twriteln(ans);\n\tend;\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nIn Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.\n\nThe name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-ness of a string.\n\nGiven a string S of length N and an integer k (k \\geq 3),\nhe defines the k-DMC number of S as the number of triples (a, b, c) of integers that satisfy the following conditions:\n\n0 \\leq a < b < c \\leq N - 1\n\nS[a] = D\n\nS[b] = M\n\nS[c] = C\n\nc-a < k\n\nHere S[a] is the a-th character of the string S. Indexing is zero-based, that is, 0 \\leq a \\leq N - 1 holds.\n\nFor a string S and Q integers k_0, k_1, ..., k_{Q-1}, calculate the k_i-DMC number of S for each i (0 \\leq i \\leq Q-1).\n\nConstraints\n\n3 \\leq N \\leq 10^6\n\nS consists of uppercase English letters\n\n1 \\leq Q \\leq 75\n\n3 \\leq k_i \\leq N\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nk_{0} k_{1} ... k_{Q-1}\n\nOutput\n\nPrint Q lines.\nThe i-th line should contain the k_i-DMC number of the string S.\n\nSample Input 1\n\n18\nDWANGOMEDIACLUSTER\n1\n18\n\nSample Output 1\n\n1\n\n(a,b,c) = (0, 6, 11) satisfies the conditions.\n\nStrangely, Dwango Media Cluster does not have so much DMC-ness by his definition.\n\nSample Input 2\n\n18\nDDDDDDMMMMMCCCCCCC\n1\n18\n\nSample Output 2\n\n210\n\nThe number of triples can be calculated as 6\\times 5\\times 7.\n\nSample Input 3\n\n54\nDIALUPWIDEAREANETWORKGAMINGOPERATIONCORPORATIONLIMITED\n3\n20 30 40\n\nSample Output 3\n\n0\n1\n2\n\n(a, b, c) = (0, 23, 36), (8, 23, 36) satisfy the conditions except the last one, namely, c-a < k_i.\n\nBy the way, DWANGO is an acronym for \"Dial-up Wide Area Network Gaming Operation\".\n\nSample Output 4\n\n30\nDMCDMCDMCDMCDMCDMCDMCDMCDMCDMC\n4\n5 10 15 20\n\nSample Output 4\n\n10\n52\n110\n140", "sample_input": "18\nDWANGOMEDIACLUSTER\n1\n18\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03216", "source_text": "Score : 600 points\n\nProblem Statement\n\nIn Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.\n\nThe name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-ness of a string.\n\nGiven a string S of length N and an integer k (k \\geq 3),\nhe defines the k-DMC number of S as the number of triples (a, b, c) of integers that satisfy the following conditions:\n\n0 \\leq a < b < c \\leq N - 1\n\nS[a] = D\n\nS[b] = M\n\nS[c] = C\n\nc-a < k\n\nHere S[a] is the a-th character of the string S. Indexing is zero-based, that is, 0 \\leq a \\leq N - 1 holds.\n\nFor a string S and Q integers k_0, k_1, ..., k_{Q-1}, calculate the k_i-DMC number of S for each i (0 \\leq i \\leq Q-1).\n\nConstraints\n\n3 \\leq N \\leq 10^6\n\nS consists of uppercase English letters\n\n1 \\leq Q \\leq 75\n\n3 \\leq k_i \\leq N\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nk_{0} k_{1} ... k_{Q-1}\n\nOutput\n\nPrint Q lines.\nThe i-th line should contain the k_i-DMC number of the string S.\n\nSample Input 1\n\n18\nDWANGOMEDIACLUSTER\n1\n18\n\nSample Output 1\n\n1\n\n(a,b,c) = (0, 6, 11) satisfies the conditions.\n\nStrangely, Dwango Media Cluster does not have so much DMC-ness by his definition.\n\nSample Input 2\n\n18\nDDDDDDMMMMMCCCCCCC\n1\n18\n\nSample Output 2\n\n210\n\nThe number of triples can be calculated as 6\\times 5\\times 7.\n\nSample Input 3\n\n54\nDIALUPWIDEAREANETWORKGAMINGOPERATIONCORPORATIONLIMITED\n3\n20 30 40\n\nSample Output 3\n\n0\n1\n2\n\n(a, b, c) = (0, 23, 36), (8, 23, 36) satisfy the conditions except the last one, namely, c-a < k_i.\n\nBy the way, DWANGO is an acronym for \"Dial-up Wide Area Network Gaming Operation\".\n\nSample Output 4\n\n30\nDMCDMCDMCDMCDMCDMCDMCDMCDMCDMC\n4\n5 10 15 20\n\nSample Output 4\n\n10\n52\n110\n140", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1057, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s095707687", "group_id": "codeNet:p03219", "input_text": "program diskon;\nvar\nx,y : integer;\nbegin\nreadln(x);\nreadln(y);\nx := x + (y div 2);\nwriteln(x);\nend.", "language": "Pascal", "metadata": {"date": 1577222718, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03219.html", "problem_id": "p03219", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03219/input.txt", "sample_output_relpath": "derived/input_output/data/p03219/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03219/Pascal/s095707687.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s095707687", "user_id": "u353919145"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program diskon;\nvar\nx,y : integer;\nbegin\nreadln(x);\nreadln(y);\nx := x + (y div 2);\nwriteln(x);\nend.", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "sample_input": "81 58\n"}, "reference_outputs": ["110\n"], "source_document_id": "p03219", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 99, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s387321522", "group_id": "codeNet:p03220", "input_text": "var\n\tn, t, a, h, i, ans:longint;\n\tmi:extended;\nbegin\n\tread(n, t, a);\n\tmi:=233333333.0;\n\tfor i:=1 to n do\n\tbegin\n\t\tread(h);\n\t\tif abs(t - h * 0.006 - a) < mi then\n\t\tbegin\n\t\t\tmi:=abs(t - h * 0.006 - a);\n\t\t\tans:=i;\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1541384777, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03220.html", "problem_id": "p03220", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03220/input.txt", "sample_output_relpath": "derived/input_output/data/p03220/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03220/Pascal/s387321522.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s387321522", "user_id": "u634600597"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tn, t, a, h, i, ans:longint;\n\tmi:extended;\nbegin\n\tread(n, t, a);\n\tmi:=233333333.0;\n\tfor i:=1 to n do\n\tbegin\n\t\tread(h);\n\t\tif abs(t - h * 0.006 - a) < mi then\n\t\tbegin\n\t\t\tmi:=abs(t - h * 0.006 - a);\n\t\t\tans:=i;\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "sample_input": "2\n12 5\n1000 2000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03220", "source_text": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s602071911", "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[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]]);\n\treadln; readln;\nend.", "language": "Pascal", "metadata": {"date": 1541389146, "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/s602071911.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s602071911", "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[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]]);\n\treadln; readln;\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1105, "cpu_time_ms": 97, "memory_kb": 3712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s235326045", "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\tt:=num[num[i]]; num[num[i]]:=num[num[j]]; num[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": 1541388735, "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/s240692784.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s240692784", "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\tt:=num[num[i]]; num[num[i]]:=num[num[j]]; num[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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1031, "cpu_time_ms": 99, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s480066452", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r,flag:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tif n mod 2=0 then \n\tbegin\n\t\tt1:=a[(1+n) div 2+1];\n\t\tl:=1; r:=n;\n\t\tfor i:=1 to n-1 do\n\t\tbegin\n\t\t\tx:=abs(a[r]-t1);\n\t\t\ty:=abs(t1-a[l]);\n\t\t\tflag:=0;\n\t\t\twhile x=y do\n\t\t\tbegin\n\t\t\t\tinc(flag);\n\t\t\t\tx:=abs(a[r-flag]-a[l]);\n\t\t\t\ty:=abs(a[r]-a[l+flag]);\n\t\t\tend;\n\t\t\tif x>y then right\n\t\t\telse if xt then writeln(s)\n\telse writeln(t);\nend.\n", "language": "Pascal", "metadata": {"date": 1541038678, "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/s480066452.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s480066452", "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,flag:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tif n mod 2=0 then \n\tbegin\n\t\tt1:=a[(1+n) div 2+1];\n\t\tl:=1; r:=n;\n\t\tfor i:=1 to n-1 do\n\t\tbegin\n\t\t\tx:=abs(a[r]-t1);\n\t\t\ty:=abs(t1-a[l]);\n\t\t\tflag:=0;\n\t\t\twhile x=y do\n\t\t\tbegin\n\t\t\t\tinc(flag);\n\t\t\t\tx:=abs(a[r-flag]-a[l]);\n\t\t\t\ty:=abs(a[r]-a[l+flag]);\n\t\t\tend;\n\t\t\tif x>y then right\n\t\t\telse if xt 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1215, "cpu_time_ms": 26, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s679045692", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r,x,y,ttt: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 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 xy then \n\t\t\tbegin \n\t\t\t\tt2:=a[r];\n\t\t\t\tdec(r);\n\t\t\t\tif r=ttt then dec(r);\n\t\t\tend;\n\t\t\tif x<=y then \n\t\t\tbegin \n\t\t\t\tt2:=a[l];\n\t\t\t\tinc(l);\n\t\t\t\tif l=ttt then inc(l);\n\t\t\tend;\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1540753039, "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/s679045692.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s679045692", "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,x,y,ttt: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 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 xy then \n\t\t\tbegin \n\t\t\t\tt2:=a[r];\n\t\t\t\tdec(r);\n\t\t\t\tif r=ttt then dec(r);\n\t\t\tend;\n\t\t\tif x<=y then \n\t\t\tbegin \n\t\t\t\tt2:=a[l];\n\t\t\t\tinc(l);\n\t\t\t\tif l=ttt then inc(l);\n\t\t\tend;\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1023, "cpu_time_ms": 24, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s907085827", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[0..100010] of longint;\n\tn,i,t1,t2,l,r,x,y: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 ly then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\tend;\n\t\tif xy then \n\t\t\tbegin \n\t\t\t\tt2:=a[r];\n\t\t\t\tdec(r);\n\t\t\tend;\n\t\t\tif x<=y then \n\t\t\tbegin \n\t\t\t\tt2:=a[l];\n\t\t\t\tinc(l);\n\t\t\tend;\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.\n", "language": "Pascal", "metadata": {"date": 1540752645, "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/s907085827.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s907085827", "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,x,y: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 ly then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\tend;\n\t\tif xy then \n\t\t\tbegin \n\t\t\t\tt2:=a[r];\n\t\t\t\tdec(r);\n\t\t\tend;\n\t\t\tif x<=y then \n\t\t\tbegin \n\t\t\t\tt2:=a[l];\n\t\t\t\tinc(l);\n\t\t\tend;\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\twriteln(s);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 908, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s880053629", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right\n\t\telse if xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\n\treadln; readln;\nend.\n", "language": "Pascal", "metadata": {"date": 1540694043, "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/s880053629.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s880053629", "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);\n\treadln; readln;\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1150, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s537387230", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2,x,y:int64;\nprocedure qsort(l,r:longint);\nvar\n\tt,mid:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; mid:=a[(l+r) div 2];\n\trepeat\n\t\twhile a[i]mid do dec(j);\n\t\tif i<=j then\n\t\tbegin\n\t\t\tt:=a[i]; a[i]:=a[j]; a[j]:=t;\n\t\t\tinc(i); dec(j);\n\t\tend;\n\tuntil i>j;\n\tif ly then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "language": "Pascal", "metadata": {"date": 1540691958, "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/s537387230.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s537387230", "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\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tx:=abs(a[r]-t1);\n\t\ty:=abs(t1-a[l]);\n\t\tif x>y then right;\n\t\tif xabs(a[r]-a[l+1]) then right\n\t\t\telse left;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1117, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s912690434", "group_id": "codeNet:p03223", "input_text": "var\n\ta:array[-10..200010] of int64;\n\tn,i,l,r:longint;\n\ts,t,t1,t2:int64;\nprocedure qsort(l,r:longint);\nvar\n t,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 lr then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n if l>r then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "language": "Pascal", "metadata": {"date": 1540691313, "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/s912690434.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912690434", "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:int64;\nprocedure qsort(l,r:longint);\nvar\n t,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 lr then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then \n\t\tbegin \n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin \n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2 then inc(l);\n\t\tend;\n\t\ts:=s+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tt:=0;\n\tt1:=a[(1+n) div 2+1];\n\tl:=1; r:=n;\n\tfor i:=1 to n-1 do\n\tbegin\n\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tif l=(1+n) div 2+1 then inc(l);\n if l>r then break;\n\t\tif abs(a[r]-t1)>abs(t1-a[l]) then\n\t\tbegin\n\t\t\tt2:=a[r];\n\t\t\tdec(r);\n\t\t\tif r=(1+n) div 2+1 then dec(r);\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tt2:=a[l];\n\t\t\tinc(l);\n\t\t\tif l=(1+n) div 2+1 then inc(l);\n\t\tend;\n\t\tt:=t+abs(t1-t2);\n\t\tt1:=t2;\n\tend;\n\tif s>t then writeln(s)\n\telse writeln(t);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03223", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1290, "cpu_time_ms": 25, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s109626590", "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);dec(y);\n\tc[x]:=a[i];inc(i);inc(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(y);\n\tc[x]:=a[j];dec(j);inc(x);\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": 1540694026, "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/s109626590.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s109626590", "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);dec(y);\n\tc[x]:=a[i];inc(i);inc(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(y);\n\tc[x]:=a[j];dec(j);inc(x);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2103, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s333314546", "group_id": "codeNet:p03229", "input_text": "var n,i:integer;\na:array[0..100000]of longint;\nf:array[1..100000]of 0..1;\ntot:int64;\nprocedure s(x:integer;la:longint;ss:int64);\nvar j:integer;\nbegin \n\tif x>n then begin if ss>tot then tot:=ss;exit;end;\n\tfor j:=1 to n do \n\tbegin \n\t\tif f[j]=0 then \n\t\tbegin \n\t\t\tf[j]:=1;\n\t\t\tif x=1 then s(x+1,j,ss)\n\t\t\telse \n\t\t\ts(x+1,j,ss+abs(a[j]-a[la]));\n\t\t\tf[j]:=0;\n\t\tend;\n\tend;\nend;\nbegin \n\tread(n);\n\ttot:=0;\n\tfillchar(f,sizeof(f),0);\n\tfor i:=1 to n do read(a[i]);\n\ts(1,0,0);\n\twriteln(tot);\nend.", "language": "Pascal", "metadata": {"date": 1540691329, "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/s333314546.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s333314546", "user_id": "u914335902"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "var n,i:integer;\na:array[0..100000]of longint;\nf:array[1..100000]of 0..1;\ntot:int64;\nprocedure s(x:integer;la:longint;ss:int64);\nvar j:integer;\nbegin \n\tif x>n then begin if ss>tot then tot:=ss;exit;end;\n\tfor j:=1 to n do \n\tbegin \n\t\tif f[j]=0 then \n\t\tbegin \n\t\t\tf[j]:=1;\n\t\t\tif x=1 then s(x+1,j,ss)\n\t\t\telse \n\t\t\ts(x+1,j,ss+abs(a[j]-a[la]));\n\t\t\tf[j]:=0;\n\t\tend;\n\tend;\nend;\nbegin \n\tread(n);\n\ttot:=0;\n\tfillchar(f,sizeof(f),0);\n\tfor i:=1 to n do read(a[i]);\n\ts(1,0,0);\n\twriteln(tot);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 479, "cpu_time_ms": 2103, "memory_kb": 5760}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s776926968", "group_id": "codeNet:p03231", "input_text": "var\n s,t,x:array[0..10000000]of char;\n i,j,n,m:longint;\n l,ans:int64;\nFunction min(x,y:longint):longint;\nbegin\n if x' ' then\n if x[(l div m)*i+1]<>t[i+1] then\n begin\n write('-1');\n exit;\n end;\n write(l);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1539663957, "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/s776926968.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s776926968", "user_id": "u111363574"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n s,t,x:array[0..10000000]of char;\n i,j,n,m:longint;\n l,ans:int64;\nFunction min(x,y:longint):longint;\nbegin\n if x' ' then\n if x[(l div m)*i+1]<>t[i+1] then\n begin\n write('-1');\n exit;\n end;\n write(l);\nend.\n\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 620, "cpu_time_ms": 109, "memory_kb": 13184}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s591137650", "group_id": "codeNet:p03231", "input_text": "var\n s,t,x:array[0..10000]of char;\n i,j,n,m:longint;\n l,ans:int64;\nFunction min(x,y:longint):longint;\nbegin\n if x' ' then\n if x[(l div m)*i+1]<>t[i+1] then\n begin\n write('-1');\n exit;\n end;\n write(l);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1539663806, "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/s591137650.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s591137650", "user_id": "u111363574"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n s,t,x:array[0..10000]of char;\n i,j,n,m:longint;\n l,ans:int64;\nFunction min(x,y:longint):longint;\nbegin\n if x' ' then\n if x[(l div m)*i+1]<>t[i+1] then\n begin\n write('-1');\n exit;\n end;\n write(l);\nend.\n\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 617, "cpu_time_ms": 96, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s250471231", "group_id": "codeNet:p03231", "input_text": "var\n\tn,m,t1,i,j:int64;\n\ts,t:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tr,t:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tt1:=n*m div gcd(n,m);\n\ti:=1; j:=1;\n\twhile (i<=n) and (j<=m) do\n\tbegin\n\t\tif s[i]<>t[j] then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\ti:=i+t1 div m;\n\t\tj:=j+t1 div n;\n\tend;\n\twriteln(t1);\nend.\n", "language": "Pascal", "metadata": {"date": 1539569353, "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/s250471231.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s250471231", "user_id": "u957998623"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\tn,m,t1,i,j:int64;\n\ts,t:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tr,t:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tt1:=n*m div gcd(n,m);\n\ti:=1; j:=1;\n\twhile (i<=n) and (j<=m) do\n\tbegin\n\t\tif s[i]<>t[j] then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\ti:=i+t1 div m;\n\t\tj:=j+t1 div n;\n\tend;\n\twriteln(t1);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s559675325", "group_id": "codeNet:p03231", "input_text": "var\n\tn,m,t1,i,j:longint;\n\ts,t:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tr,t:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tt1:=n*m div gcd(n,m);\n\ti:=1; j:=1;\n\twhile (i<=n) and (j<=m) do\n\tbegin\n\t\tif s[i]<>t[j] then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\ti:=i+t1 div m;\n\t\tj:=j+t1 div n;\n\tend;\n\twriteln(t1);\nend.", "language": "Pascal", "metadata": {"date": 1539569298, "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/s559675325.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s559675325", "user_id": "u957998623"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\tn,m,t1,i,j:longint;\n\ts,t:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tr,t:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tt1:=n*m div gcd(n,m);\n\ti:=1; j:=1;\n\twhile (i<=n) and (j<=m) do\n\tbegin\n\t\tif s[i]<>t[j] then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\ti:=i+t1 div m;\n\t\tj:=j+t1 div n;\n\tend;\n\twriteln(t1);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 493, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s674375989", "group_id": "codeNet:p03231", "input_text": "var\n\tn,m,t1,i,j:longint;\n\ts,t:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tr,t:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tt1:=n*m div gcd(n,m);\n\ti:=1; j:=1;\n\twhile (i<=n) and (j<=m) do\n\tbegin\n\t\tif s[i]<>t[j] then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\ti:=i+t1 div m;\n\t\tj:=j+t1 div n;\n\tend;\n\twriteln(t1);\nend.", "language": "Pascal", "metadata": {"date": 1539569202, "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/s674375989.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s674375989", "user_id": "u957998623"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var\n\tn,m,t1,i,j:longint;\n\ts,t:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tr,t:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tt1:=n*m div gcd(n,m);\n\ti:=1; j:=1;\n\twhile (i<=n) and (j<=m) do\n\tbegin\n\t\tif s[i]<>t[j] then\n\t\tbegin\n\t\t\twriteln(-1);\n\t\t\thalt;\n\t\tend;\n\t\ti:=i+t1 div m;\n\t\tj:=j+t1 div n;\n\tend;\n\twriteln(t1);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 464, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s655403090", "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 p:=k mod n;\n q:=k mod 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": 1539486683, "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/s655403090.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s655403090", "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 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 mod n;\n q:=k mod 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 434, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s112265657", "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": 1539486343, "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/s112265657.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s112265657", "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 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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s136592863", "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 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.\n", "language": "Pascal", "metadata": {"date": 1539485849, "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/s136592863.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s136592863", "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 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.\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 435, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s281295671", "group_id": "codeNet:p03231", "input_text": "var\n\tn,m,t1:longint;\n\ts,t,t2:ansistring;\nfunction gcd(x,y:longint):longint;\nvar\n\tt,r:longint;\nbegin\n\tif x0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tif n0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tif n0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tif n0 do\n\tbegin\n\t\tx:=y; y:=r;\n\t\tr:=x mod y;\n\tend;\n\texit(y);\nend;\nbegin\n\treadln(n,m);\n\treadln(s); readln(t);\n\tif n Block 2\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 2, as only Block 2 remains.\nThus, the total cost of the two operations for this order is 3+2=5.\n\nThen, we will consider the order \"Block 2 -> Block 1\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 1, as only Block 1 remains.\nThus, the total cost of the two operations for this order is 3+1=4.\n\nTherefore, the answer is 5+4=9.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n212\n\nSample Input 3\n\n10\n1 2 4 8 16 32 64 128 256 512\n\nSample Output 3\n\n880971923", "sample_input": "2\n1 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03232", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N blocks arranged in a row, numbered 1 to N from left to right.\nEach block has a weight, and the weight of Block i is A_i.\nSnuke will perform the following operation on these blocks N times:\n\nChoose one block that is still not removed, and remove it.\nThe cost of this operation is the sum of the weights of the blocks that are connected to the block being removed (including itself).\nHere, two blocks x and y ( x \\leq y ) are connected when, for all z ( x \\leq z \\leq y ), Block z is still not removed.\n\nThere are N! possible orders in which Snuke removes the blocks.\nFor all of those N! orders, find the total cost of the N operations, and calculate the sum of those N! total costs.\nAs the answer can be extremely large, compute the sum modulo 10^9+7.\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 A_2 ... A_N\n\nOutput\n\nFor all of the N! orders, find the total cost of the N operations, and print the sum of those N! total costs, modulo 10^9+7.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n9\n\nFirst, we will consider the order \"Block 1 -> Block 2\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 2, as only Block 2 remains.\nThus, the total cost of the two operations for this order is 3+2=5.\n\nThen, we will consider the order \"Block 2 -> Block 1\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 1, as only Block 1 remains.\nThus, the total cost of the two operations for this order is 3+1=4.\n\nTherefore, the answer is 5+4=9.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n212\n\nSample Input 3\n\n10\n1 2 4 8 16 32 64 128 256 512\n\nSample Output 3\n\n880971923", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 490, "cpu_time_ms": 113, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s501623148", "group_id": "codeNet:p03232", "input_text": "var\n\tn,i:Longint;\n\tans,a,m:int64;\n\tsum:array[1..100000]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod m,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod m;\n\t\tpower:=s;\n\tend;\nend;\nbegin\n\tm:=1000000007;\n\tread(n);\n\tsum[1]:=1;\n\tfor i:=2 to n do sum[i]:=(sum[i-1]+power(i,m-2))mod m;\n\tfor i:=1 to n do begin\n\t\tread(a);\n\t\tans:=(ans+(sum[i]+sum[n-i+1]+m-1)mod m*a mod m)mod m;\n\tend;\n\tfor i:=1 to n do ans:=ans*i mod m;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1539491759, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03232.html", "problem_id": "p03232", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03232/input.txt", "sample_output_relpath": "derived/input_output/data/p03232/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03232/Pascal/s501623148.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s501623148", "user_id": "u657913472"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n\tn,i:Longint;\n\tans,a,m:int64;\n\tsum:array[1..100000]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod m,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod m;\n\t\tpower:=s;\n\tend;\nend;\nbegin\n\tm:=1000000007;\n\tread(n);\n\tsum[1]:=1;\n\tfor i:=2 to n do sum[i]:=(sum[i-1]+power(i,m-2))mod m;\n\tfor i:=1 to n do begin\n\t\tread(a);\n\t\tans:=(ans+(sum[i]+sum[n-i+1]+m-1)mod m*a mod m)mod m;\n\tend;\n\tfor i:=1 to n do ans:=ans*i mod m;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N blocks arranged in a row, numbered 1 to N from left to right.\nEach block has a weight, and the weight of Block i is A_i.\nSnuke will perform the following operation on these blocks N times:\n\nChoose one block that is still not removed, and remove it.\nThe cost of this operation is the sum of the weights of the blocks that are connected to the block being removed (including itself).\nHere, two blocks x and y ( x \\leq y ) are connected when, for all z ( x \\leq z \\leq y ), Block z is still not removed.\n\nThere are N! possible orders in which Snuke removes the blocks.\nFor all of those N! orders, find the total cost of the N operations, and calculate the sum of those N! total costs.\nAs the answer can be extremely large, compute the sum modulo 10^9+7.\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 A_2 ... A_N\n\nOutput\n\nFor all of the N! orders, find the total cost of the N operations, and print the sum of those N! total costs, modulo 10^9+7.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n9\n\nFirst, we will consider the order \"Block 1 -> Block 2\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 2, as only Block 2 remains.\nThus, the total cost of the two operations for this order is 3+2=5.\n\nThen, we will consider the order \"Block 2 -> Block 1\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 1, as only Block 1 remains.\nThus, the total cost of the two operations for this order is 3+1=4.\n\nTherefore, the answer is 5+4=9.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n212\n\nSample Input 3\n\n10\n1 2 4 8 16 32 64 128 256 512\n\nSample Output 3\n\n880971923", "sample_input": "2\n1 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03232", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N blocks arranged in a row, numbered 1 to N from left to right.\nEach block has a weight, and the weight of Block i is A_i.\nSnuke will perform the following operation on these blocks N times:\n\nChoose one block that is still not removed, and remove it.\nThe cost of this operation is the sum of the weights of the blocks that are connected to the block being removed (including itself).\nHere, two blocks x and y ( x \\leq y ) are connected when, for all z ( x \\leq z \\leq y ), Block z is still not removed.\n\nThere are N! possible orders in which Snuke removes the blocks.\nFor all of those N! orders, find the total cost of the N operations, and calculate the sum of those N! total costs.\nAs the answer can be extremely large, compute the sum modulo 10^9+7.\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 A_2 ... A_N\n\nOutput\n\nFor all of the N! orders, find the total cost of the N operations, and print the sum of those N! total costs, modulo 10^9+7.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n9\n\nFirst, we will consider the order \"Block 1 -> Block 2\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 2, as only Block 2 remains.\nThus, the total cost of the two operations for this order is 3+2=5.\n\nThen, we will consider the order \"Block 2 -> Block 1\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 1, as only Block 1 remains.\nThus, the total cost of the two operations for this order is 3+1=4.\n\nTherefore, the answer is 5+4=9.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n212\n\nSample Input 3\n\n10\n1 2 4 8 16 32 64 128 256 512\n\nSample Output 3\n\n880971923", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 113, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s163293823", "group_id": "codeNet:p03239", "input_text": "var\n\tn,k,i,c,t,min:longint;\nbegin\n\tread(n,k);\n\tmin:=100000;\n\tfor i:=1 to n do\n\tbegin\n\t\tread(c,t);\n\t\tif t<=k then \n\t\t\tif c=n)and(ans=n)and(ans=n)and(ans=n)and(ans=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538880012, "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/s398334379.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s398334379", "user_id": "u914335902"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,m,i,k:longint;\nbegin \n\tread(n,m);\n\tk:=m div n;\n for i:=k downto 2 do \n if (m mod i=0) and (m div i>=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 210, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s173029733", "group_id": "codeNet:p03241", "input_text": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=1 to m div n do begin if i>sqrt(m) then break;\n if m mod i=0 then max:=i; end;\nwrite(max);\nend.", "language": "Pascal", "metadata": {"date": 1538879801, "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/s173029733.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s173029733", "user_id": "u111363574"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=1 to m div n do begin if i>sqrt(m) then break;\n if m mod i=0 then max:=i; end;\nwrite(max);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 160, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s668733505", "group_id": "codeNet:p03241", "input_text": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=1 to m div n+1 do\n if m mod i=0 then max:=i;\nwrite(max);\nend.", "language": "Pascal", "metadata": {"date": 1538879608, "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/s668733505.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s668733505", "user_id": "u111363574"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,m,i,max:longint;\nbegin\n max:=1;\n read(n,m);\n for i:=1 to m div n+1 do\n if m mod i=0 then max:=i;\nwrite(max);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s510094937", "group_id": "codeNet:p03241", "input_text": "var n,m,i:longint;\nbegin \n\tread(n,m);\n for i:=m-1 downto 2 do \n if (m mod i=0) and (m div i<=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1538879556, "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/s510094937.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s510094937", "user_id": "u914335902"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,m,i:longint;\nbegin \n\tread(n,m);\n for i:=m-1 downto 2 do \n if (m mod i=0) and (m div i<=n) then \n begin \n \twrite(i);\n exit;\n end;\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 161, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s561983742", "group_id": "codeNet:p03242", "input_text": "var\n i:longint;\nbegin\n read(i);\n writeln(1110-i);\nend.", "language": "Pascal", "metadata": {"date": 1538368568, "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/s561983742.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561983742", "user_id": "u729133443"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "var\n i:longint;\nbegin\n read(i);\n writeln(1110-i);\nend.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s676013792", "group_id": "codeNet:p03244", "input_text": "var\n n,i,x,maxo,maxj,oi,ji,maxo2,maxj2:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n if oi=ji then begin\n o[oi]:=-maxlongint;\n\tj[ji]:=-maxlongint;\n maxo2:=-maxlongint;\n maxj2:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo2 then begin maxo2:=o[i]; oi:=i; end;\n\tif j[i]>maxj2 then begin maxj2:=j[i]; ji:=i; end;\n\tend;\n if maxo2>=maxj2 then write(n-maxo2-maxj)\n else write(n-maxj2-maxo);\n end\n else write(n-maxo-maxj);\nend.", "language": "Pascal", "metadata": {"date": 1538274897, "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/s676013792.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s676013792", "user_id": "u797897182"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,x,maxo,maxj,oi,ji,maxo2,maxj2:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n if oi=ji then begin\n o[oi]:=-maxlongint;\n\tj[ji]:=-maxlongint;\n maxo2:=-maxlongint;\n maxj2:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo2 then begin maxo2:=o[i]; oi:=i; end;\n\tif j[i]>maxj2 then begin maxj2:=j[i]; ji:=i; end;\n\tend;\n if maxo2>=maxj2 then write(n-maxo2-maxj)\n else write(n-maxj2-maxo);\n end\n else write(n-maxo-maxj);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 12, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s122308507", "group_id": "codeNet:p03244", "input_text": "var\n n,i,x,maxo,maxj,oi,ji:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n if maxo>=maxj then write(maxo-maxj)\nelse write(maxj-maxo);\nend.", "language": "Pascal", "metadata": {"date": 1538274504, "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/s122308507.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s122308507", "user_id": "u797897182"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,x,maxo,maxj,oi,ji:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n if maxo>=maxj then write(maxo-maxj)\nelse write(maxj-maxo);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 432, "cpu_time_ms": 14, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s500712355", "group_id": "codeNet:p03244", "input_text": "var\n n,i,x,maxo,maxj,oi,ji:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n write(n-maxo-maxj);\nend.", "language": "Pascal", "metadata": {"date": 1538274018, "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/s500712355.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s500712355", "user_id": "u797897182"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,x,maxo,maxj,oi,ji:longint;\n j,o:array[1..100000]of longint;\nbegin\n read(n);\n for i:=1 to n do\n begin\n\t read(x);\n\t if i mod 2=0 then inc(o[x])\n\t else inc(j[x]);\n\tend;\n maxo:=-maxlongint;\n maxj:=-maxlongint;\n for i:=1 to 100000 do\n begin\n if o[i]>maxo then begin maxo:=o[i]; oi:=i; end;\n\tif j[i]>maxj then begin maxj:=j[i]; ji:=i; end;\n\tend;\n write(n-maxo-maxj);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 395, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s792274765", "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 (i<>o)and(b[2,i]>=f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if po)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 (i<>o)and(b[1,i]>=f) then f:=b[1,i];\n if (i<>o)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": 1538273900, "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/s792274765.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s792274765", "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 (i<>o)and(b[2,i]>=f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if po)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 (i<>o)and(b[1,i]>=f) then f:=b[1,i];\n if (i<>o)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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 858, "cpu_time_ms": 14, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s488816104", "group_id": "codeNet:p03244", "input_text": "var\n a,f,g:array[0..100000]of longint;\n p1,p2,q1,q2:array[0..100000]of longint;\n i,j,n,ans,n1,n2:longint;\nProcedure max(x:longint);\nbegin\n if x>ans then ans:=x;\nend;\nProcedure ch(var x,y:longint);\nvar\n t:longint;\nbegin\n t:=x;x:=y;y:=t;\nend;\nProcedure qs1(l,r:longint);\nvar\n i,j,mid:longint;\nbegin\n i:=l;j:=r;mid:=p1[(l+r)div 2];\n repeat\n while p1[i]>mid do inc(i);\n while p1[j]j;\n if lmid do inc(i);\n while q1[j]j;\n if l0 then\n begin\n inc(n1);\n p1[n1]:=f[i];\n p2[n1]:=i;\n end;\n if g[i]<>0 then\n begin\n inc(n2);\n q1[n2]:=g[i];\n q2[n2]:=i;\n end;\n end;\n qs1(1,n1);\n qs2(1,n2);\n for i:=1 to n1 do\n begin\n if p2[i]<>q2[1] then max(p1[i]+q1[1]) else max(p1[i]+q1[2]);\n end;\n write(n-ans);\nend.", "language": "Pascal", "metadata": {"date": 1538272352, "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/s488816104.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488816104", "user_id": "u111363574"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a,f,g:array[0..100000]of longint;\n p1,p2,q1,q2:array[0..100000]of longint;\n i,j,n,ans,n1,n2:longint;\nProcedure max(x:longint);\nbegin\n if x>ans then ans:=x;\nend;\nProcedure ch(var x,y:longint);\nvar\n t:longint;\nbegin\n t:=x;x:=y;y:=t;\nend;\nProcedure qs1(l,r:longint);\nvar\n i,j,mid:longint;\nbegin\n i:=l;j:=r;mid:=p1[(l+r)div 2];\n repeat\n while p1[i]>mid do inc(i);\n while p1[j]j;\n if lmid do inc(i);\n while q1[j]j;\n if l0 then\n begin\n inc(n1);\n p1[n1]:=f[i];\n p2[n1]:=i;\n end;\n if g[i]<>0 then\n begin\n inc(n2);\n q1[n2]:=g[i];\n q2[n2]:=i;\n end;\n end;\n qs1(1,n1);\n qs2(1,n2);\n for i:=1 to n1 do\n begin\n if p2[i]<>q2[1] then max(p1[i]+q1[1]) else max(p1[i]+q1[2]);\n end;\n write(n-ans);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1496, "cpu_time_ms": 19, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s983423227", "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 (i<>o)and(b[2,i]>=f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if po)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 (i<>o)and(b[1,i]>=f) then f:=b[1,i];\n if (i<>o)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.", "language": "Pascal", "metadata": {"date": 1538271882, "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/s983423227.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s983423227", "user_id": "u223928734"}, "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 (i<>o)and(b[2,i]>=f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if po)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 (i<>o)and(b[1,i]>=f) then f:=b[1,i];\n if (i<>o)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.", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 857, "cpu_time_ms": 14, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s641462183", "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 (i<>o)and(b[2,i]>=f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if po)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 (i<>o)and(b[1,i]>=f) then f:=b[1,i];\n if (i<>o)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": 1538271819, "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/s641462183.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s641462183", "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 (i<>o)and(b[2,i]>=f) then f:=b[2,i];\n end;\n\tf:=f+p;\n\tend else\n if po)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 (i<>o)and(b[1,i]>=f) then f:=b[1,i];\n if (i<>o)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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 858, "cpu_time_ms": 14, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s960057246", "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: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\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 end;\n\tf:=f+q;\n end;\n end else f:=p+q;\n writeln(n-f);\nend.", "language": "Pascal", "metadata": {"date": 1538270854, "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/s960057246.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s960057246", "user_id": "u223928734"}, "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: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\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 end;\n\tf:=f+q;\n end;\n end else f:=p+q;\n writeln(n-f);\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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 14, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s658875952", "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 100000 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)\n else exit(y);\nend;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(k);\n if i mod 2=1 then inc(check1[k])\n else inc(check2[k]);\n end;\n for i:=1 to 100000 do\n if check1[i]>maxn1 then\n begin\n maxn1:=check1[i]; who1:=i;\n end;\n\n for i:=1 to 100000 do\n if (i<>who1)and(check1[i]>maxn3) then\n maxn3:=check1[i];\n\n for i:=1 to 100000 do\n if check2[i]>maxn2 then\n begin\n maxn2:=check2[i]; who2:=i;\n end;\n\n for i:=1 to 100000 do\n if (i<>who2)and(check2[i]>maxn4) then\n maxn4:=check2[i];\n\n if who1<>who2 then\n writeln(n-maxn1-maxn2)\n else \n writeln(n-max(maxn1+maxn4,maxn2+maxn3));\nend.", "language": "Pascal", "metadata": {"date": 1538271507, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03246.html", "problem_id": "p03246", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03246/input.txt", "sample_output_relpath": "derived/input_output/data/p03246/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03246/Pascal/s489236616.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s489236616", "user_id": "u277975126"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n maxn1,maxn2,who1,who2,maxn3,maxn4:longint;\n i,j,m,n,k,p,len1,len2:longint;\n check1,check2:array[0..100005]of longint;\nfunction max(x,y:longint):longint;\nbegin\n if x>y then exit(x)\n else exit(y);\nend;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(k);\n if i mod 2=1 then inc(check1[k])\n else inc(check2[k]);\n end;\n for i:=1 to 100000 do\n if check1[i]>maxn1 then\n begin\n maxn1:=check1[i]; who1:=i;\n end;\n\n for i:=1 to 100000 do\n if (i<>who1)and(check1[i]>maxn3) then\n maxn3:=check1[i];\n\n for i:=1 to 100000 do\n if check2[i]>maxn2 then\n begin\n maxn2:=check2[i]; who2:=i;\n end;\n\n for i:=1 to 100000 do\n if (i<>who2)and(check2[i]>maxn4) then\n maxn4:=check2[i];\n\n if who1<>who2 then\n writeln(n-maxn1-maxn2)\n else \n writeln(n-max(maxn1+maxn4,maxn2+maxn3));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03246", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 867, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s301181376", "group_id": "codeNet:p03246", "input_text": "var\n n,i,j,k,t,x,p1,p2,q1,q2,maxa1,maxa2,maxb1,maxb2:longint;\n a,b:array[1..100000] of longint;\nfunction max(x,y:longint):longint;\n begin\n if x>y\n then exit(x)\n else exit(y);\n end;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n if i mod 2=0\n then inc(b[x])\n else inc(a[x]);\n end;\n for i:=1 to 100000 do\n begin\n if a[i]>maxa1\n then\n begin\n maxa2:=maxa1;\n maxa1:=a[i];\n p1:=i;\n end\n else\n if a[i]>maxa2\n then maxa2:=a[i];\n end;\n for i:=1 to 100000 do\n begin\n if b[i]>maxb1\n then\n begin\n maxb2:=maxb1;\n maxb1:=b[i];\n q1:=i;\n end\n else\n if b[i]>maxb2\n then maxb2:=b[i];\n end;\n if p1<>q1\n then writeln(n-maxa1-maxb1)\n else writeln(n-max(maxa1+maxb2,maxa2+maxb1));\nend.\n", "language": "Pascal", "metadata": {"date": 1538270437, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03246.html", "problem_id": "p03246", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03246/input.txt", "sample_output_relpath": "derived/input_output/data/p03246/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03246/Pascal/s301181376.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s301181376", "user_id": "u249197223"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,j,k,t,x,p1,p2,q1,q2,maxa1,maxa2,maxb1,maxb2:longint;\n a,b:array[1..100000] of longint;\nfunction max(x,y:longint):longint;\n begin\n if x>y\n then exit(x)\n else exit(y);\n end;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n if i mod 2=0\n then inc(b[x])\n else inc(a[x]);\n end;\n for i:=1 to 100000 do\n begin\n if a[i]>maxa1\n then\n begin\n maxa2:=maxa1;\n maxa1:=a[i];\n p1:=i;\n end\n else\n if a[i]>maxa2\n then maxa2:=a[i];\n end;\n for i:=1 to 100000 do\n begin\n if b[i]>maxb1\n then\n begin\n maxb2:=maxb1;\n maxb1:=b[i];\n q1:=i;\n end\n else\n if b[i]>maxb2\n then maxb2:=b[i];\n end;\n if p1<>q1\n then writeln(n-maxa1-maxb1)\n else writeln(n-max(maxa1+maxb2,maxa2+maxb1));\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03246", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 913, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s424354995", "group_id": "codeNet:p03247", "input_text": "var\n\tn,i,j,c,a,b:Longint;\n\tx,y,d:array[1..100000]of Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(x[i],y[i]);\n\t\tif (abs(x[i])+abs(y[i]))mod 2<>(abs(x[1])+abs(y[1]))mod 2 then begin\n\t\t\twriteln(-1);\n\t\t\texit;\n\t\tend;\n\tend;\n\ta:=1073741824;\n\twhile a>0 do begin\n\t\tinc(c);\n\t\td[c]:=a;\n\t\ta:=a div 2;\n\tend;\n\tif (abs(x[1])+abs(y[1]))mod 2=1 then begin\n\t\tinc(c);\n\t\td[c]:=1;\n\tend;\n\twriteln(c);\n\tfor i:=1 to c do write(d[i],' ');\n\twriteln;\n\tfor i:=1 to n do begin\n\t\ta:=x[i];\n\t\tb:=y[i];\n\t\tfor j:=1 to c do begin\n\t\t\tif abs(a)>abs(b) then begin\n\t\t\t\tif a>0 then begin\n\t\t\t\t\tdec(a,d[j]);\n\t\t\t\t\twrite('R');\n\t\t\t\tend else begin\n\t\t\t\t\tinc(a,d[j]);\n\t\t\t\t\twrite('L');\n\t\t\t\tend;\n\t\t\tend else begin\n\t\t\t\tif b>0 then begin\n\t\t\t\t\tdec(b,d[j]);\n\t\t\t\t\twrite('U');\n\t\t\t\tend else begin\n\t\t\t\t\tinc(b,d[j]);\n\t\t\t\t\twrite('D');\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\twriteln;\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1540277120, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03247.html", "problem_id": "p03247", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03247/input.txt", "sample_output_relpath": "derived/input_output/data/p03247/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03247/Pascal/s424354995.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s424354995", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n1 2\nRL\nUU\nDR\n", "input_to_evaluate": "var\n\tn,i,j,c,a,b:Longint;\n\tx,y,d:array[1..100000]of Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(x[i],y[i]);\n\t\tif (abs(x[i])+abs(y[i]))mod 2<>(abs(x[1])+abs(y[1]))mod 2 then begin\n\t\t\twriteln(-1);\n\t\t\texit;\n\t\tend;\n\tend;\n\ta:=1073741824;\n\twhile a>0 do begin\n\t\tinc(c);\n\t\td[c]:=a;\n\t\ta:=a div 2;\n\tend;\n\tif (abs(x[1])+abs(y[1]))mod 2=1 then begin\n\t\tinc(c);\n\t\td[c]:=1;\n\tend;\n\twriteln(c);\n\tfor i:=1 to c do write(d[i],' ');\n\twriteln;\n\tfor i:=1 to n do begin\n\t\ta:=x[i];\n\t\tb:=y[i];\n\t\tfor j:=1 to c do begin\n\t\t\tif abs(a)>abs(b) then begin\n\t\t\t\tif a>0 then begin\n\t\t\t\t\tdec(a,d[j]);\n\t\t\t\t\twrite('R');\n\t\t\t\tend else begin\n\t\t\t\t\tinc(a,d[j]);\n\t\t\t\t\twrite('L');\n\t\t\t\tend;\n\t\t\tend else begin\n\t\t\t\tif b>0 then begin\n\t\t\t\t\tdec(b,d[j]);\n\t\t\t\t\twrite('U');\n\t\t\t\tend else begin\n\t\t\t\t\tinc(b,d[j]);\n\t\t\t\t\twrite('D');\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\twriteln;\n\tend;\nend.\n", "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": "p03247", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 832, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s858697999", "group_id": "codeNet:p03247", "input_text": "var\n n,p,m,i,j:longint;\n x,y,d:array[0..1010] of longint;\nbegin\n readln(n);\n readln(x[1],y[1]);\n p:=abs(x[1]+y[1]) mod 2;\n for i:=2 to n do\n begin\n readln(x[i],y[i]);\n if p<>abs(x[i]+y[i]) mod 2 then \n begin\n writeln(-1);exit;\n end;\n end;\n m:=31+1-p;writeln(m);d[31]:=1;\n for i:=30 downto 1 do d[i]:=d[i+1]*2;\n if m=32 then d[32]:=1;\n for i:=1 to m do write(d[i],' ');writeln;\n for i:=1 to n do \n begin \n for j:=1 to m do\n if abs(x[i])>abs(y[i]) then\n if x[i]>0 then begin dec(x[i],d[j]);write('R');end\n else begin inc(x[i],d[j]);write('L');end\n else \n if y[i]>0 then begin dec(y[i],d[j]);write('U');end\n else begin inc(y[i],d[j]);write('D');end;\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1538786061, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03247.html", "problem_id": "p03247", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03247/input.txt", "sample_output_relpath": "derived/input_output/data/p03247/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03247/Pascal/s858697999.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s858697999", "user_id": "u960852022"}, "prompt_components": {"gold_output": "2\n1 2\nRL\nUU\nDR\n", "input_to_evaluate": "var\n n,p,m,i,j:longint;\n x,y,d:array[0..1010] of longint;\nbegin\n readln(n);\n readln(x[1],y[1]);\n p:=abs(x[1]+y[1]) mod 2;\n for i:=2 to n do\n begin\n readln(x[i],y[i]);\n if p<>abs(x[i]+y[i]) mod 2 then \n begin\n writeln(-1);exit;\n end;\n end;\n m:=31+1-p;writeln(m);d[31]:=1;\n for i:=30 downto 1 do d[i]:=d[i+1]*2;\n if m=32 then d[32]:=1;\n for i:=1 to m do write(d[i],' ');writeln;\n for i:=1 to n do \n begin \n for j:=1 to m do\n if abs(x[i])>abs(y[i]) then\n if x[i]>0 then begin dec(x[i],d[j]);write('R');end\n else begin inc(x[i],d[j]);write('L');end\n else \n if y[i]>0 then begin dec(y[i],d[j]);write('U');end\n else begin inc(y[i],d[j]);write('D');end;\n writeln;\n end;\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": "p03247", "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": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 927, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s411708424", "group_id": "codeNet:p03248", "input_text": "var\n n,i,j,k,t,root:longint;\n a:array[1..100000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1;\n for i:=2 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538273915, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s411708424.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s411708424", "user_id": "u249197223"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\n n,i,j,k,t,root:longint;\n a:array[1..100000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1;\n for i:=2 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 29, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s808935700", "group_id": "codeNet:p03248", "input_text": "var\n n,i,j,k,t,root:longint;\n a:array[1..10000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1;\n for i:=2 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538273851, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s808935700.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s808935700", "user_id": "u249197223"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\n n,i,j,k,t,root:longint;\n a:array[1..10000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1;\n for i:=2 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 647, "cpu_time_ms": 29, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s254078893", "group_id": "codeNet:p03248", "input_text": "var\n n,i,j,k,t,root:longint;\n a:array[1..10000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n div 2 do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1;\n writeln(1,' ',2);\n if a[2]=1\n then root:=2;\n for i:=3 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1538273645, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s254078893.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s254078893", "user_id": "u249197223"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\n n,i,j,k,t,root:longint;\n a:array[1..10000] of integer;\n x:char;\n first,next,last,b:array[1..100000] of longint;\nbegin\n i:=0;\n while not eoln do\n begin\n n:=n+1;\n read(x);\n if x='1'\n then a[n]:=1\n else a[n]:=0;\n end;\n if (a[1]=0)or(a[n]=1)\n then\n begin\n writeln(-1);\n halt;\n end;\n for i:=2 to n div 2 do\n if (a[i]=1)and(a[n-i]=0)\n then\n begin\n writeln(-1);\n halt;\n end;\n root:=1;\n writeln(1,' ',2);\n if a[2]=1\n then root:=2;\n for i:=3 to n do\n if a[i-1]=0\n then writeln(root,' ',i)\n else\n begin\n writeln(root,' ',i);\n root:=i;\n end;\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 703, "cpu_time_ms": 30, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s400947798", "group_id": "codeNet:p03248", "input_text": "var\n a:array[1..200000] of longint;\n b,c,i,j,k,t,n,m,x,y:longint;\n s:ansistring;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n-1 do\n begin\n k:=0;\n if s[i]='1' then if s[n-i]='0' then k:=1;\n end;\n if s[1]='0' then k:=1;\n if s[n]='1' then k:=1;\n if k=1 then writeln('-1') else\n begin\n x:=1;\n for i:=1 to n-1 do\n begin\n writeln(x,' ',i+1);\n if s[i]='1' then x:=i+1;\n end;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1538273112, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Pascal/s400947798.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s400947798", "user_id": "u121412807"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "var\n a:array[1..200000] of longint;\n b,c,i,j,k,t,n,m,x,y:longint;\n s:ansistring;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n-1 do\n begin\n k:=0;\n if s[i]='1' then if s[n-i]='0' then k:=1;\n end;\n if s[1]='0' then k:=1;\n if s[n]='1' then k:=1;\n if k=1 then writeln('-1') else\n begin\n x:=1;\n for i:=1 to n-1 do\n begin\n writeln(x,' ',i+1);\n if s[i]='1' then x:=i+1;\n end;\n end;\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 27, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s204264621", "group_id": "codeNet:p03252", "input_text": "var\n s,t,r:ansistring;\n i:longint;\n f:array[0..31] of longint;\nbegin\n readln(s);readln(t);\n for i:=1 to length(s) do\n if f[ord(s[i])-97]=0 then f[ord(s[i])-97]:=ord(t[i])-97\n else if f[ord(s[i])-97]<>ord(t[i])-97 then \n begin\n writeln('No');\n exit;\n end;\n r:=s;s:=t;t:=r;fillchar(f,sizeof(f),0);\n for i:=1 to length(s) do\n if f[ord(s[i])-97]=0 then f[ord(s[i])-97]:=ord(t[i])-97\n else if f[ord(s[i])-97]<>ord(t[i])-97 then \n begin\n writeln('No');\n exit;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1537761732, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Pascal/s204264621.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s204264621", "user_id": "u960852022"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,t,r:ansistring;\n i:longint;\n f:array[0..31] of longint;\nbegin\n readln(s);readln(t);\n for i:=1 to length(s) do\n if f[ord(s[i])-97]=0 then f[ord(s[i])-97]:=ord(t[i])-97\n else if f[ord(s[i])-97]<>ord(t[i])-97 then \n begin\n writeln('No');\n exit;\n end;\n r:=s;s:=t;t:=r;fillchar(f,sizeof(f),0);\n for i:=1 to length(s) do\n if f[ord(s[i])-97]=0 then f[ord(s[i])-97]:=ord(t[i])-97\n else if f[ord(s[i])-97]<>ord(t[i])-97 then \n begin\n writeln('No');\n exit;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 637, "cpu_time_ms": 3, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s598780384", "group_id": "codeNet:p03252", "input_text": "var s1,s2:ansistring;\nc:array['a'..'z']of 0..1;\nf:array['a'..'z']of 'a'..'z';\ni:longint;\nbegin \n\treadln(s1);\n\treadln(s2);\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s1[i]]=0 then \n\t\tbegin \n\t\t\tf[s1[i]]:=s2[i];\n\t\t\tc[s1[i]]:=1;\n\t\tend\n\t\telse if s2[i]<>f[s1[i]] then begin write('No');halt;end;\n\tend;\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s2[i]]=0 then \n\t\tbegin \n\t\t\tf[s2[i]]:=s1[i];\n\t\t\tc[s2[i]]:=1;\n\t\tend\n\t\telse if s1[i]<>f[s2[i]] then begin write('No');halt;end;\n\tend;\n\twrite('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1537760826, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Pascal/s598780384.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s598780384", "user_id": "u914335902"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s1,s2:ansistring;\nc:array['a'..'z']of 0..1;\nf:array['a'..'z']of 'a'..'z';\ni:longint;\nbegin \n\treadln(s1);\n\treadln(s2);\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s1[i]]=0 then \n\t\tbegin \n\t\t\tf[s1[i]]:=s2[i];\n\t\t\tc[s1[i]]:=1;\n\t\tend\n\t\telse if s2[i]<>f[s1[i]] then begin write('No');halt;end;\n\tend;\n\tfillchar(c,sizeof(c),0);\n\tfor i:=1 to length(s1) do\n\tbegin \n\t\tif c[s2[i]]=0 then \n\t\tbegin \n\t\t\tf[s2[i]]:=s1[i];\n\t\t\tc[s2[i]]:=1;\n\t\tend\n\t\telse if s1[i]<>f[s2[i]] then begin write('No');halt;end;\n\tend;\n\twrite('Yes');\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 540, "cpu_time_ms": 2, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s657210183", "group_id": "codeNet:p03252", "input_text": "var\n s1,s2:string;\n a,b:array['a'..'z']of longint;\n c:array[1..26]of boolean;\n f:boolean;\n i,j,k,p:longint;\nbegin\n readln(s1);\n read(s2);\n k:=length(s2);\n f:=true;\n if length(s1)1 then ans:=ans*facnm mod mo*n mod mo*inv mod mo;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1544283432, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Pascal/s367497273.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s367497273", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tfacs:array[0..2001]of int64=(1,437918130,722479105,419467694,390998217,688653593,752369730,314281677,848793393,302778600,641419708,359467170,109119920,291462451,581232364,367552188,19055157,519422664,377413248,184238535,100292593,867553799,680805768,637011622,838031598,954730329,14705621,854687367,82350513,562819783,341406877,11986940,406550952,924707067,697304278,812312671,493805103,750646179,797131515,125408444,593395757,743252791,97269816,625809105,95830437,318440909,191279856,448875092,764072301,941003529,541108809,339617910,981977466,917213110,693389065,939330647,454991628,655104206,938437020,681370120,969117405,153564086,124768900,190510895,380720579,742619942,919179148,860673190,784044468,356858318,849641758,257431766,926581590,488132488,633627778,593920661,234400402,266884017,181686381,657704891,532467852,928162624,121630724,523505981,242416192,940517951,451602922,692382743,856456398,303115999,299200938,638522519,484820571,4950879,652993557,595510479,747441725,565813117,719760882,162603635,531950728,765702160,363728672,790374244,776372982,160226878,217226757,800213188,425234994,877824191,682831525,230335073,830834436,706165316,540595539,144162001,433393698,893091420,997675228,844113510,577889084,874720012,937682696,117557725,705155009,72951350,379968087,950743483,342781022,184481043,153223816,558188636,516225514,438463836,350269020,332366222,493498994,753660595,128078583,238205526,927344283,470091512,192044710,849127063,854869794,502704967,961189336,188562846,643851306,204102562,576865589,574949854,772036106,417276573,773301250,463836195,473281893,894679367,4336597,363467250,317614965,728217456,554126869,874896552,76366192,677000234,337033639,284263197,264056892,538465762,645000912,157420482,14755475,572349905,770650027,208576717,412197753,283971481,892302331,872764474,810673643,764707385,62691675,425317917,827016778,685010988,575309116,86381823,285454093,583163727,483115382,953791654,224496577,413323992,74107909,779820672,988628897,796572345,968946248,444124793,368774859,887671982,535354688,145822049,516927020,988709092,910325210,790606609,425401251,824547428,11347322,841821068,372729338,910253320,383651345,626790213,636443576,633383307,105562610,725643552,766392363,418265499,957763794,832826328,343383160,237604935,582419882,608657845,330910979,511252139,701339131,463738716,849664749,739062237,357088405,324679509,109741460,455887877,269923768,424425198,965651681,471728725,543062503,485378429,571604742,321271335,504455561,509546975,763368909,150072577,232201666,695006444,375079861,765847341,405049322,304181169,685687553,228502082,23642405,733213722,77721395,994809954,217921085,750848255,415201993,877359318,816254961,208800253,165312868,912564763,267878880,620421028,687272398,965091903,910284938,959869931,579283662,460311839,233130006,832629547,806918317,789419725,976360299,66957513,792006720,964835096,764310323,943508794,320822040,855360826,994209082,998710584,451541316,540353405,782850762,83351016,164658610,399153119,484179393,900677914,548996970,540202385,502085905,305629510,414973328,733854511,999551600,929723194,856256948,190437395,831650911,189552007,540085415,264316037,647368479,724859258,63875222,549880942,884378502,48225947,200360748,217411774,428675555,204375967,163813057,11392828,63816753,122454906,279161231,177533667,31612358,140452161,19981188,287350626,225047490,810109242,455285322,682630228,317104780,38098465,981996609,566262664,244205492,11569855,360664468,210352560,808795375,66106220,996704108,52475795,835874618,706698117,834011569,82385442,767403009,260934484,581004588,146951720,315181594,18131026,67347184,660447354,317161158,310293330,957769185,795211642,251210316,376491240,482209772,337887965,715730781,169939932,942501868,896874971,156760010,409840176,442596118,448590113,340183632,448639753,139475086,446619980,683372898,330190835,658072182,120608013,345266529,873204774,859866616,327703544,840550890,500060231,737050414,343707056,929913795,364139378,713522909,605309034,892609044,95663389,422550956,440430257,676836771,616977443,372816409,516450892,308156304,727765485,154582382,122223283,703248501,916757163,626613065,673807982,165855749,104310832,619362396,666635368,551617377,725543210,320014428,83863469,696839568,820486897,690587073,476958860,785342455,964938385,434274056,793377933,473720669,105927603,722446075,463771653,995091580,249784900,362569914,441674995,310891328,443049614,246899301,965628034,8254466,860524980,284046782,649020090,775603661,428599344,313235165,263427830,820210693,584450609,715520777,908274787,449173641,87370462,342675806,667579940,561795065,279679436,78896243,594101806,340351880,104853227,138938342,130890251,986495418,544733609,4904868,918156620,404489692,770967340,158370004,816861962,480737664,420524209,65348113,118371296,286699742,510283129,473058849,602863780,673888495,988224796,727422266,795625516,490010237,643547208,665131,419311146,784876961,259406228,321460624,655258314,98643949,707960681,345366515,677618898,819757880,180025997,737935835,405543032,644653663,490584749,695118839,274538092,632437141,218813310,317001033,910311278,570111271,796146820,110949981,478241232,875076691,307006856,17300606,881553988,227466914,19672824,445302346,910482839,824976273,771616985,270947557,648646822,178180365,137542155,231821182,856901587,993964922,484362438,16217817,162346196,574504715,996863845,926110356,738560761,655452606,847777767,703924556,354719140,551933392,763321879,354410308,716633014,1846113,151195567,397207557,287250393,553695703,673890558,607917045,342267556,791423907,84651643,967621908,301902554,650678899,139731715,307636910,810633682,948014515,866935088,81781900,322819981,80052847,573932828,697481470,945729718,9410113,610388108,997427770,256656171,627562817,382326894,562494885,243742734,278115231,479250272,387514542,698268536,155278258,494100421,212623047,421826322,603738319,758527273,20108421,863619073,821332424,145077127,73700185,204576546,189728558,485502293,841644761,408411010,117079890,38907107,309944332,537278263,217025729,109877174,557761881,994419866,217090673,184824249,189099472,261873512,667808941,586325534,253818913,644423004,981219272,454235616,701754988,399397899,785692610,558429063,364031813,729194366,92482293,326481560,788127248,570445426,823876596,20603955,865141725,343095285,26031301,599138469,726882647,873729904,381275973,727797007,386941508,306915726,183392789,965201592,616292959,988382003,843538214,917204899,346845309,346668863,73340530,211574133,101653426,552055822,392352826,621654267,953923388,649516831,344367172,875418231,749373796,143428656,348401571,841064085,727093888,308500124,232930518,733485509,223530088,955719239,372632899,280379514,793982951,815003859,716823510,420238951,258598151,119317972,532691113,996762842,245917194,50278402,340573112,365772418,972353660,426309883,723221198,174677626,399728595,11650076,709841844,146676835,334038704,534725238,837816787,171414317,303642327,974225117,842734160,776201879,74464463,821426588,38248328,706358135,296716438,445075845,550967966,521492915,274952061,556614251,984837941,648055403,343362475,346080515,256832184,740061294,495959165,729601523,779665586,283275797,197810318,781285237,322261298,135677639,604632373,482730911,262343442,41660771,590107402,953568036,946541117,885083598,382285276,488546372,993845228,909184478,271463541,119198618,592620584,461343501,554131598,652118082,21986535,72902987,687268896,974594416,932795074,774765057,809996715,620738499,399787621,225908460,129158745,586852410,796945456,697021411,269610437,381569864,516484640,533382001,851059476,496376048,117921789,762631608,388289544,175140444,127387258,449693463,568876602,791130076,116649615,899544094,666808812,268154883,130425525,40221932,937092326,80681006,358103796,716404824,842684285,441825078,646820416,235503449,135821388,85455680,158341399,477414981,167897791,535112475,396749090,10704220,234934482,908432331,293931387,731582745,517708259,430870409,980420392,541663303,47582098,455847,356474821,316432065,65533322,85175307,860604360,25754605,154738290,446955362,157986406,781848501,717265250,612404709,706983555,387930108,472703372,677443725,177799133,678723533,355862327,142972046,172238730,511971513,645452094,527518247,731876548,273379339,857639774,841031050,684168469,916679331,820059873,456796817,429183481,526395816,775373984,192323739,296194923,11453925,8278520,409297079,104345442,868422849,808037302,743839810,46575892,772073181,957942297,186788115,208353171,135646592,669701582,639767834,840311971,566239834,748856536,516640190,829180498,126741093,161917011,188925427,150241540,772951297,314136411,385047709,234466451,661905614,866978149,839059042,973857347,733512306,484001044,688907798,284583633,843163128,324217435,258023744,669468233,956937740,751439779,199094586,924317766,652240854,19122513,239556480,767073780,140785202,813367160,936382197,597461024,615192889,99527175,845455419,583838047,319841973,802260377,115832001,410302694,791420576,811802215,885506163,821500977,971899082,851076783,60196672,310722366,460528297,552700981,180873604,609943468,121002913,766255808,312289913,495303973,432738621,394225159,138042435,243477827,749475337,982506554,786394249,356445555,307208212,591254491,619425827,823014817,366656624,619489363,370467112,484246020,270725331,784373520,439653758,820309560,908299141,86224435,932013969,318639644,898352741,401192710,659343882,401578858,851699976,894437844,330041436,170941117,14153059,37693984,616445558,690716870,874502721,449868160,438615741,978160598,698174607,168356987,967878048,736417659,453888345,676617343,274124047,420072609,641407652,318526308,878694635,357869926,315485067,491981417,239038656,843844940,132469174,187019771,523408116,78568538,436938993,486874504,190178115,497209923,995074790,367421824,91668637,710596389,130676774,300098050,904649983,186399972,478015100,31995309,124938003,690394397,711461277,224418847,893879446,781314189,667385447,671417846,234638808,828492043,306706238,127550549,408913764,721516183,331471082,457992974,573468634,672708889,320496078,15839498,885759493,255269181,182400335,530581311,167350302,810232079,650720680,59466245,431116020,679317776,758934084,664980914,278125935,348025264,53331501,133097627,149883591,817848624,900353597,783112758,160763163,238831149,797175555,877308397,39070845,482100617,214965479,344558162,818314994,912223989,213213495,601681586,482310162,863251852,596189612,356519615,79512648,728860288,46903013,888534544,385486256,416178481,385498125,754297579,406709645,755011148,514316323,516985593,413423280,621329073,564117448,828524406,252775486,524528481,42844085,139468211,442041842,804331447,187146136,942938062,48018709,834337461,807286248,75266003,280732574,301044356,688918711,25647683,103691471,356516363,217243322,79719269,838371827,316346259,155522062,268147727,896784626,14951415,470321003,897351995,507321798,999092468,68874685,583865802,235668390,90312874,578971101,263295338,318644981,771253152,969556024,131824084,555364659,177742474,729669260,559938709,645894938,160270347,632777852,735217324,61589642,541933100,694117288,376580544,813068041,477645764,759241785,294519817,138399026,394314552,792949591,934868205,819041193,332485645,845462554,259920986,527437780,309337264,591739449,693276974,678480119,428469431,414263601,633022951,981058512,609542121,442518390,77026581,574261907,45939761,737920568,753807865,274216733,964023100,41919658,848001963,814643993,714996880,211223083,698272928,549380518,965060493,372399874,212188347,648269327,436467039,198057536,488255637,528167194,654566249,498591282,602924257,595802738,646051689,150253145,126142258,853051176,170875874,811033647,829409492,857425357,375070363,518017636,69063083,204378752,975976294,661981759,341281076,220949802,4885828,339589091,544292770,477684459,296578003,526152680,426153882,584733693,354769607,628463735,504184872,962340487,38142158,774710008,313026009,667019208,851177716,608703175,623910550,588942604,664771131,452968880,526552415,371180743,282258493,74410802,118586228,758426336,82207020,769851163,277781927,899447517,277445656,39616839,412570835,644230877,858440059,560027549,653979014,875001552,203289190,287668021,641754696,709569308,43100935,284772512,170487827,712473620,931669785,707240839,349659653,794277139,426319109,269062258,846068884,457829908,36333448,71982296,170135174,709589417,640362445,342495088,841147847,514468327,51968927,688332881,584611895,132113828,917337794,108548150,475063670,795449122,558555126,837635461,837398790,732786257,319001333,198776634,810946626,137870240,158957545,908311315,872619945,664937210,129530468,50348417,849250992,450427339,922572008,618206958,175240077,633367395,825631213,39936802,27403736,980209443,779262371,436554500,682438185,561052839,360181026,353621333,474310496,20746302,68473458,219643096,411557429,197822889,985042166,895962278,443227197,694657534,372677833,911855086,115957705,2894605,536809703,508726322,815233294,202866238,433476225,96761804,754748691,466792919,479956599,151220442,177829816,399844787,888113123,399097330,495693949,81831527,833537368,483958348,47205438,634207676,46648320,324465305,531118527,371868789,981861845,921860206,357792113,268133259,449878693,361697226,350302884,384502541,807638467,401727573,296595730,412192383,145193636,106948516,3274189,223117995,960114799,268522421,204477956,437168126,325814640,387503614,433365363,347193177,114791516,287624303,430900437,940374225,632412154,23409301,547541020,512608806,578807697,443850675,5115349,998330168,653893017,303025260,336219981,882601668,795371447,48538713,649982328,900426809,204558688,653011158,902349808,721480596,211527284,537042464,205459599,475474028,64102375,853122196,239920785,753481311,642672336,182498000,718392117,549190582,899919385,767441910,35831479,901647580,137195945,850922759,981466142,141143905,255873943,17469473,106878802,323468994,459042064,94155677,187551272,530795115,841137570,840248223,467431845,558036327,921180701,678207516,1019817,872202044,963467544,475231870,830760447,628149884,815665664,375159522,861034044,673757389,843558921,902155560,139925365,289287052,504975434,849956279,648860855,869159839,414498699,622880301,864481378,660870295,35825964,519112735,289509856,740089688,822326716,753855755,602596414,1109355,754139240,250452233,191723709,326890640,507591365,152617786,622540065,459313960,564872639,166169821,541421526,188455009,285814597,799131049,175583016,672155446,828067027,801824583,213660817,886755915,514271522,943728970,835578492,73898409,190233572,705737629,435786777,417962929,641806606,869002706,829030184,397303232,674375995,679117195,973411258,659801480,501680008,664225170,908592101,865742350,638569176,168434599,853467653,359584409,640470390,23426105,659816341,644551169,764375544,945112227,88908366,886796928,694202384,816609751,82067555,890808672,203263109,300688088,732861256,981916446,564396474,204963325,607728934,614958095,285589169,516095757,551094266,796996621,156954972,634388393,852919824,951660340,189903249,742460748,240586351,528192736,774856085,78349297,847820063,639182499,674861708,639386368,366465454,369085072,941855646,531030372,760045418,480033669,224399621,110676735,77894517,545100769,650036395,782411682,962394741,21843833,38211912,301959296,579172254,717618843,843531032,975044897,58041033,766509189,888183450,244812160,640598259,649762851,615130101,927355391,740355273,905877239,553665946,824681504,870741191,139576181,919136090,495445285,91191794,139114484,731888951,541278579,314602668,16987211,198661311,712653322,926287373,482220726,956316286,228847458,381771477,724133392,791833167,706068732,996128105,320758457,663466380,327857483,676436428,690021915,504579084,26454933,16038420,157332008,306612706,904818841,445167189,9788408,839132483,90815021,21240951,414051598,130410650,135585214,770455357,647097700,561791251,86951298,11152992,922303224,208184587,6841115,718101467,857264452,585184040,542078386,140828336,809217592,638678485,815085314,193686441,855968166,970509445,602237603,611862881,391504097,76180522,333766430,525156436,459238750,305034567,895552840,295066216,956616889,571451636,714628325,585109252,509577117,351713057,195899084,349961266,813092778,148381618,745829599,725655669,748588140,621061444,87647661,665131400,804407057,786532432,691904089,451188034,420540937,823629411,501560473,400304903,170995170,561965062,721365870,266485419,91353374,947548163,909485397,610766863,928768342,752476980,441431572,344041962,943797032,853458881,702717288,445291878,61235934,456839561,410924722,404926961,194445311,3253589,268799687,807715039,165570205,94763007,158306605,59996720,274108420,414975259,983466636,803394057,87834837,574595575,196191313,844184041,643147106,265818227,101825403,803094044,242562562,839565513,257892092,574135690,30145655,49394657,421361571,763184678,603286204,63452252,139115489,625872226,142064665,516455732,973365994,958346799,583866149,186848069,489388729,440618058,187594059,846920656,584588550,616313658,3266654,507592373,865597837,267145356,510206456,802988440,301697767,64190024,581850323,674500561,355471294,195184459,623420775,920680841,395802067,36642064,470851029,943460901,146732447,166316690,872709391,126163258,950023387,101278761,491582731,639895584,61360863,586337165,193437174,552504580,693546897,77325413,857246661,987532374,853902175,379482747,224733307,115257579,106764520,689354918,298145603,615933962,569076226,328110256,576610866,695851486,785702358,63361341,668886213,927416154,205447692,221665715,199018602,312778040,955638524,26314956,606209807,798483805,709244795,920512580,468134742,745396228,986457805,135914446,938859944,981668478,72804351,522197666,860257082,596201427,493861891,710705969,618177588,806422332,384646184,15076428,70418215,667793574,975770871,145622217,570087218,978775711,739657384,699703979,618576462,77620368,285330510,467646369,523665167,206787932,197281506,634072288,709815314,362695335,705107095,800750169,71227268,423934847,308691367,770269500,363173300,650047647,81854737,334356152,453881875,466676494,994235921,832409515,685904093,721393779,959528791,342024694,744393265,906332280,882992383,951553609,623237368,593348519,199174689,588962133,712620977,829971737,92699062,201761485,45911817,990840621,857165467,840414737,1682954,352749330,3508071,838779094,458972227,647824348,828853075,950000780,854164863,399806922,879137749,212809520,441388638,144475028,395432544,105501058,160504943,669871158,923468766,596352947,692135476,175271758,923738960,503723361,190427004,640326947,678777547,184825262,67184272,194306888,133850550,450428122,75615536,741791390,977784377,981027538,544519858,427234643,976704600,361798085,133012903,839594448,100126660,908636534,415538309,584596772,305392053,367924415,948183134,494350435,706048566,799246183,572044829,73980418,267969547,258397918,211323896,386265065,262530252,151632629,699477545,377982638,771089164,294157205,127574041,87518070,573824443,191094180,590706530,933044004,329309631,892336948,753191963,577284521,987655631,706226766,357305902,594001349,519944161,260808786,181254075,320550296,676860353,328279132,870078596,887434314,258428228,735863058,526730496,236824101,617672087,484961716,63592603,319080338,172014318,475800730,595644977,916663289,738833794,95142235,582969930,486005752,579654560,233475558,54979317,440981254,204736513,489746958,897493865,290680817,879214818,771503873,523135574,792496199,954421607,312608844,349332001,664809479,198788345,372404311,605294124,407806619,306664482,343210044,136280115,678649477,913353839,660918937,761402028,275123138,420140584,395211897,219680467,579084043,391235114,8289646,28760027,347597509,581880420,699243937,56807945,594102464,740568527,685070977,521639273,646019716,37875196,90174632,528595207,207905340,714735302,742634562,635357725,612536743,904636671,358757469,321315689,937533791,479528324,494454809,720036892,917778389,589828633,767794056,640058434,257510447,840866704,311455590,450659980,49891365,599529716,781179867,510612374,709837151,16962196,107146451,0);\n\tinv,now,n,m,ans,mo,p,facnm:int64;\n\tfac:array[0..30]of int64;\n\ti,j:Longint;\nfunction power(a,b:int64):int64;\nvar ret:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\tret:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then ret:=ret*a mod 1000000007;\n\t\tpower:=ret;\n\tend;\nend;\nbegin\n\tread(n,m);\n\tans:=1;\n\tmo:=1000000007;\n\tfac[0]:=1;\n\tfor i:=1 to 30 do fac[i]:=fac[i-1]*i mod mo;\n\tfacnm:=facs[(n-1)div 100];\n\tfor i:=1 to (n-1) mod 100 do begin\n\t\tfacnm:=facnm*(n-i)mod mo;\n\tend;\n\tinv:=power(facnm,mo-2);\n\ti:=2;\n\twhile i*i<=m do begin\n\t\tif m mod i=0 then begin\n\t\t\tp:=0;\n\t\t\twhile m mod i=0 do begin\n\t\t\t\tm:=m div i;\n\t\t\t\tinc(p);\n\t\t\tend;\n\t\t\tnow:=facnm;\n\t\t\tfor j:=1 to p do now:=now*(n+j-1)mod mo;\n\t\t\tans:=ans*now mod mo*power(fac[p],mo-2)mod mo*inv mod mo;\n\t\tend;\n\t\tinc(i);\n\tend;\n\tif m>1 then ans:=ans*facnm mod mo*n mod mo*inv mod mo;\n\twriteln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 20671, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s611042456", "group_id": "codeNet:p03254", "input_text": "uses math;\nvar\n a:array[0..10000]of longint;\n n,x,i,sum:longint;\n procedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if l=a[i])and(i<=n) do\n begin\n\t x:=x-a[i];\n\t inc(i)\n\tend;\n if x<>0 then dec(i);\n writeln(max(0,i-1));\nend.", "language": "Pascal", "metadata": {"date": 1539725631, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03254.html", "problem_id": "p03254", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03254/input.txt", "sample_output_relpath": "derived/input_output/data/p03254/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03254/Pascal/s611042456.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s611042456", "user_id": "u658406065"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar\n a:array[0..10000]of longint;\n n,x,i,sum:longint;\n procedure sort(l,r: longint);\n var\n i,j,x,y: longint;\n begin\n i:=l;\n j:=r;\n x:=a[(l+r) div 2];\n repeat\n while a[i]j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if l=a[i])and(i<=n) do\n begin\n\t x:=x-a[i];\n\t inc(i)\n\tend;\n if x<>0 then dec(i);\n writeln(max(0,i-1));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "sample_input": "3 70\n20 30 10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03254", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 835, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s813857653", "group_id": "codeNet:p03263", "input_text": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..200000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536465919, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s813857653.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s813857653", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..200000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1290, "cpu_time_ms": 67, "memory_kb": 4224}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s454029841", "group_id": "codeNet:p03263", "input_text": "var\n a:array[-10..510,-10..510]of longint;\n b:array[0..1000000,1..4]of longint;\n i,j,n,m,ans:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n for j:=1 to m do\n begin\n read(a[i,j]);\n if j=m then readln;\n end;\n for i:=1 to n do\n for j:=1 to m-1 do\n begin\n if a[i,j] mod 2<>0 then\n begin\n inc(ans);\n b[ans,1]:=i;b[ans,2]:=j;\n b[ans,3]:=i;b[ans,4]:=j+1;\n inc(a[i,j+1],a[i,j]);\n a[i,j]:=0;\n end;\n end;\n for i:=1 to n-1 do\n begin\n if a[i,m] mod 2<>0 then\n begin\n inc(ans);\n b[ans,1]:=i;b[ans,2]:=m;\n b[ans,3]:=i+1;b[ans,4]:=m;\n inc(a[i+1,m],a[i,m]);\n a[i,m]:=0;\n end;\n end;\n writeln(ans);\n for i:=1 to ans do begin\n for j:=1 to 4 do\n write(b[i,j],' ');\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1536460271, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s454029841.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s454029841", "user_id": "u111363574"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "var\n a:array[-10..510,-10..510]of longint;\n b:array[0..1000000,1..4]of longint;\n i,j,n,m,ans:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n for j:=1 to m do\n begin\n read(a[i,j]);\n if j=m then readln;\n end;\n for i:=1 to n do\n for j:=1 to m-1 do\n begin\n if a[i,j] mod 2<>0 then\n begin\n inc(ans);\n b[ans,1]:=i;b[ans,2]:=j;\n b[ans,3]:=i;b[ans,4]:=j+1;\n inc(a[i,j+1],a[i,j]);\n a[i,j]:=0;\n end;\n end;\n for i:=1 to n-1 do\n begin\n if a[i,m] mod 2<>0 then\n begin\n inc(ans);\n b[ans,1]:=i;b[ans,2]:=m;\n b[ans,3]:=i+1;b[ans,4]:=m;\n inc(a[i+1,m],a[i,m]);\n a[i,m]:=0;\n end;\n end;\n writeln(ans);\n for i:=1 to ans do begin\n for j:=1 to 4 do\n write(b[i,j],' ');\n writeln;\n end;\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 898, "cpu_time_ms": 76, "memory_kb": 6016}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s316332353", "group_id": "codeNet:p03263", "input_text": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..200000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..6040,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536459204, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s316332353.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s316332353", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..200000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..6040,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1291, "cpu_time_ms": 67, "memory_kb": 5888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s068925193", "group_id": "codeNet:p03263", "input_text": "var\n n,m,i,j,x,cnt:longint;\n a:array[0..501,0..501] of longint;\n x1,y1,x2,y2:array[0..250001] of longint;\nbegin\n readln(n,m);\n cnt:=0;\n for i:=1 to n do\n begin \n for j:=1 to m-1 do\n begin\n read(x);inc(a[i,j],x);\n if odd(a[i,j]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i;y1[cnt]:=j;y2[cnt]:=j+1;\n inc(a[i,j+1]);\n end;\n end;\n read(x);inc(a[i,m],x);\n if odd(a[i,m]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i+1;y1[cnt]:=m;y2[cnt]:=m;\n inc(a[i+1,m]);\n end;\n end;\n if odd(a[n,m]) then dec(cnt);\n writeln(cnt);\n for i:=1 to cnt do\n writeln(x1[i],' ',y1[i],' ',x2[i],' ',y2[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536459107, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s068925193.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s068925193", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "var\n n,m,i,j,x,cnt:longint;\n a:array[0..501,0..501] of longint;\n x1,y1,x2,y2:array[0..250001] of longint;\nbegin\n readln(n,m);\n cnt:=0;\n for i:=1 to n do\n begin \n for j:=1 to m-1 do\n begin\n read(x);inc(a[i,j],x);\n if odd(a[i,j]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i;y1[cnt]:=j;y2[cnt]:=j+1;\n inc(a[i,j+1]);\n end;\n end;\n read(x);inc(a[i,m],x);\n if odd(a[i,m]) then \n begin\n inc(cnt);\n x1[cnt]:=i;x2[cnt]:=i+1;y1[cnt]:=m;y2[cnt]:=m;\n inc(a[i+1,m]);\n end;\n end;\n if odd(a[n,m]) then dec(cnt);\n writeln(cnt);\n for i:=1 to cnt do\n writeln(x1[i],' ',y1[i],' ',x2[i],' ',y2[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 948, "cpu_time_ms": 64, "memory_kb": 5888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s898243669", "group_id": "codeNet:p03263", "input_text": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..1000000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536458921, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s898243669.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s898243669", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..1000000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t\tfor j:=m downto 1 do\n\t\t\t\tif t[i,j] then\n\t\t\t\t\tif (x<>0) and (y<>0) then\n\t\t\t\t\tbegin \n\t\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\t\tx:=0; y:=0;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin\n\t\t\t\t\t\tx:=i; y:=j;\n\t\t\t\t\tend;\n\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1266, "cpu_time_ms": 66, "memory_kb": 6144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s115956430", "group_id": "codeNet:p03263", "input_text": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..3000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\tbegin \n\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\tx:=0; y:=0;\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tbegin\n\t\t\t\t\tx:=i; y:=j;\n\t\t\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1536457834, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03263.html", "problem_id": "p03263", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03263/input.txt", "sample_output_relpath": "derived/input_output/data/p03263/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03263/Pascal/s115956430.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s115956430", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n", "input_to_evaluate": "type\n\tarr=array[1..4] of longint;\nvar\n\tf:array[0..3000] of arr;\n\tn,m,s,k,x,y,i,j:longint;\n\tt:array[0..600,0..600] of boolean;\nprocedure work(a,b,c,d:longint);\nbegin\n\ts:=s+abs(a-c)+abs(b-d);\n\tinc(k);\n\tf[k,1]:=a;\n\tf[k,2]:=b;\n\tf[k,3]:=c;\n\tf[k,4]:=d;\n\tt[a,b]:=false;\n\tt[c,d]:=false;\nend;\nprocedure print(x:arr);\nvar\n\ti:longint;\nbegin\n\tif x[1]0) and (y<>0) then\n\t\t\t\tbegin \n\t\t\t\t\twork(x,y,i,j);\n\t\t\t\t\tx:=0; y:=0;\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tbegin\n\t\t\t\t\tx:=i; y:=j;\n\t\t\t\tend;\n\twriteln(s);\n\tfor i:=1 to k do print(f[i]);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "sample_input": "2 3\n1 2 3\n0 1 1\n"}, "reference_outputs": ["3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n"], "source_document_id": "p03263", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\n\nIn Cell (i, j), a_{ij} coins are placed.\n\nYou can perform the following operation any number of times:\n\nOperation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.\n\nMaximize the number of cells containing an even number of coins.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 500\n\n0 \\leq a_{ij} \\leq 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} a_{12} ... a_{1W}\na_{21} a_{22} ... a_{2W}\n:\na_{H1} a_{H2} ... a_{HW}\n\nOutput\n\nPrint a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:\n\nN\ny_1 x_1 y_1' x_1'\ny_2 x_2 y_2' x_2'\n:\ny_N x_N y_N' x_N'\n\nThat is, in the first line, print an integer N between 0 and H \\times W (inclusive), representing the number of operations.\n\nIn the (i+1)-th line (1 \\leq i \\leq N), print four integers y_i, x_i, y_i' and x_i' (1 \\leq y_i, y_i' \\leq H and 1 \\leq x_i, x_i' \\leq W), representing the i-th operation. These four integers represents the operation of moving one of the coins placed in Cell (y_i, x_i) to a vertically or horizontally adjacent cell, (y_i', x_i').\n\nNote that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.\n\nSample Input 1\n\n2 3\n1 2 3\n0 1 1\n\nSample Output 1\n\n3\n2 2 2 3\n1 1 1 2\n1 3 1 2\n\nEvery cell contains an even number of coins after the following sequence of operations:\n\nMove the coin in Cell (2, 2) to Cell (2, 3).\n\nMove the coin in Cell (1, 1) to Cell (1, 2).\n\nMove one of the coins in Cell (1, 3) to Cell (1, 2).\n\nSample Input 2\n\n3 2\n1 0\n2 1\n1 0\n\nSample Output 2\n\n3\n1 1 1 2\n1 2 2 2\n3 1 3 2\n\nSample Input 3\n\n1 5\n9 9 9 9 9\n\nSample Output 3\n\n2\n1 1 1 2\n1 3 1 4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1011, "cpu_time_ms": 24, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s247828771", "group_id": "codeNet:p03264", "input_text": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\tinput, oddNum : Integer;\n\tbegin\n\tReadLn(input);\n\toddNum := (input div 2) + (input mod 2);\n\tWriteLn(oddNum * (input - oddNum));\n\tend;\n \nbegin\nMainProc;\nend.\n", "language": "Pascal", "metadata": {"date": 1541286586, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03264.html", "problem_id": "p03264", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03264/input.txt", "sample_output_relpath": "derived/input_output/data/p03264/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03264/Pascal/s247828771.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s247828771", "user_id": "u397546896"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\tinput, oddNum : Integer;\n\tbegin\n\tReadLn(input);\n\toddNum := (input div 2) + (input mod 2);\n\tWriteLn(oddNum * (input - oddNum));\n\tend;\n \nbegin\nMainProc;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\nConstraints\n\n2\\leq K\\leq 100\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n\nTwo pairs can be chosen: (2,1) and (2,3).\n\nSample Input 2\n\n6\n\nSample Output 2\n\n9\n\nSample Input 3\n\n11\n\nSample Output 3\n\n30\n\nSample Input 4\n\n50\n\nSample Output 4\n\n625", "sample_input": "3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03264", "source_text": "Score : 100 points\n\nProblem Statement\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\nConstraints\n\n2\\leq K\\leq 100\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n\nTwo pairs can be chosen: (2,1) and (2,3).\n\nSample Input 2\n\n6\n\nSample Output 2\n\n9\n\nSample Input 3\n\n11\n\nSample Output 3\n\n30\n\nSample Input 4\n\n50\n\nSample Output 4\n\n625", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s717803267", "group_id": "codeNet:p03265", "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,ax,ay,bx,by: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 Read (ax);\n Read (ay);\n Read (bx);\n Readln(by);\n count:=0;\n max :=0;\n min :=100;\n\n Write (bx-(by-ay));\n Write (' ');\n Write (by+(bx-ax));\n Write (' ');\n Write (ax+ay-by);\n Write (' ');\n Writeln(ay-(ax-bx));\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1543378661, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03265.html", "problem_id": "p03265", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03265/input.txt", "sample_output_relpath": "derived/input_output/data/p03265/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03265/Pascal/s717803267.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s717803267", "user_id": "u755925739"}, "prompt_components": {"gold_output": "-1 1 -1 0\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,ax,ay,bx,by: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 Read (ax);\n Read (ay);\n Read (bx);\n Readln(by);\n count:=0;\n max :=0;\n min :=100;\n\n Write (bx-(by-ay));\n Write (' ');\n Write (by+(bx-ax));\n Write (' ');\n Write (ax+ay-by);\n Write (' ');\n Writeln(ay-(ax-bx));\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "sample_input": "0 0 0 1\n"}, "reference_outputs": ["-1 1 -1 0\n"], "source_document_id": "p03265", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 720, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s777889504", "group_id": "codeNet:p03265", "input_text": "uses\n\tSysUtils,\n\tClasses;\n\nprocedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tx1, y1 : Integer;\n\t\tx2, y2 : Integer;\n\t\tx3, y3: Integer;\n\t\tx4, y4: Integer;\n\t\tedgeLenX: Integer;\n\t\tedgeLenY: Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tx1 := StrToInt(strlist.Strings[0]);\n\t\ty1 := StrToInt(strlist.Strings[1]);\n\t\tx2 := StrToInt(strlist.Strings[2]);\n\t\ty2:= StrToInt(strlist.Strings[3]);\n\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tedgeLenX := x1 - x2;\n\tedgeLenY := y1 - y2;\n\t\n\tx3 := x2 + edgeLenY;\n\ty3 := y2 - edgeLenX;\n\tx4 := x1 + edgeLenY;\n\ty4 := y1 - edgeLenX;\n\ttext := IntTostr(x3) + ' ' + IntTostr(y3) + ' ' + IntTostr(x4) + ' ' + IntTostr(y4);\n\tWriteLn(text);\n\tend;\n\nbegin\nMainProc;\nend.", "language": "Pascal", "metadata": {"date": 1541292912, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03265.html", "problem_id": "p03265", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03265/input.txt", "sample_output_relpath": "derived/input_output/data/p03265/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03265/Pascal/s777889504.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s777889504", "user_id": "u397546896"}, "prompt_components": {"gold_output": "-1 1 -1 0\n", "input_to_evaluate": "uses\n\tSysUtils,\n\tClasses;\n\nprocedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tx1, y1 : Integer;\n\t\tx2, y2 : Integer;\n\t\tx3, y3: Integer;\n\t\tx4, y4: Integer;\n\t\tedgeLenX: Integer;\n\t\tedgeLenY: Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tx1 := StrToInt(strlist.Strings[0]);\n\t\ty1 := StrToInt(strlist.Strings[1]);\n\t\tx2 := StrToInt(strlist.Strings[2]);\n\t\ty2:= StrToInt(strlist.Strings[3]);\n\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tedgeLenX := x1 - x2;\n\tedgeLenY := y1 - y2;\n\t\n\tx3 := x2 + edgeLenY;\n\ty3 := y2 - edgeLenX;\n\tx4 := x1 + edgeLenY;\n\ty4 := y1 - edgeLenX;\n\ttext := IntTostr(x3) + ' ' + IntTostr(y3) + ' ' + IntTostr(x4) + ' ' + IntTostr(y4);\n\tWriteLn(text);\n\tend;\n\nbegin\nMainProc;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "sample_input": "0 0 0 1\n"}, "reference_outputs": ["-1 1 -1 0\n"], "source_document_id": "p03265", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 789, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s832944491", "group_id": "codeNet:p03266", "input_text": "var\n i,k,n,q,j:longint;\n ans:qword;\nbegin\n\n readln(n,k);\n i:=k div 2;\n while i<=n do\n begin\n j:=k-(i mod k);\n while j<=n do\n begin\n\t q:=i mod k;\n\t if q=0 then q:=k;\n\t if ((i+q) mod k=0) then \n while q<=n do\n\t begin\n if ((i+q) mod k=0)and((q+j) mod k=0) then begin ans:=ans+(n-q) div k+1; break; end;\n\t\t inc(q);\n\t end;\n\t j:=j+k;\n\tend;\n\tinc(i);\n end;\n writeln(ans);\n\nend.\n", "language": "Pascal", "metadata": {"date": 1535856414, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Pascal/s832944491.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s832944491", "user_id": "u380619494"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n i,k,n,q,j:longint;\n ans:qword;\nbegin\n\n readln(n,k);\n i:=k div 2;\n while i<=n do\n begin\n j:=k-(i mod k);\n while j<=n do\n begin\n\t q:=i mod k;\n\t if q=0 then q:=k;\n\t if ((i+q) mod k=0) then \n while q<=n do\n\t begin\n if ((i+q) mod k=0)and((q+j) mod k=0) then begin ans:=ans+(n-q) div k+1; break; end;\n\t\t inc(q);\n\t end;\n\t j:=j+k;\n\tend;\n\tinc(i);\n end;\n writeln(ans);\n\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 406, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s158215412", "group_id": "codeNet:p03266", "input_text": "var n,k,i:longint;\na:array[1..3]of longint;\nb:array[1..20000]of longint;\ncount,m:longint;\nprocedure dfs(x:integer);\nvar j:longint;\nbegin \n\tif x>3 then \n\tbegin \n\t\tif (a[1]+a[3]) mod k=0 then inc(count);\n\t\texit;\n\tend;\n\tfor j:=1 to m do \n\t\tif ((b[j]-a[x-1])<=n) and ((b[j]-a[x-1])>0) then \n\t\tbegin \n\t\t\ta[x]:=b[j]-a[x-1];\n\t\t\tdfs(x+1);\n\t\tend;\nend;\nbegin \n\tread(n,k);\n\tm:=2*n div k;\n\tfor i:=1 to m do b[i]:=i*k;\n\tfor i:=1 to n do \n\tbegin \n\t\ta[1]:=i;\n\t\tdfs(2);\n\tend;\n\twrite(count);\nend.", "language": "Pascal", "metadata": {"date": 1535854053, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Pascal/s158215412.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s158215412", "user_id": "u914335902"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var n,k,i:longint;\na:array[1..3]of longint;\nb:array[1..20000]of longint;\ncount,m:longint;\nprocedure dfs(x:integer);\nvar j:longint;\nbegin \n\tif x>3 then \n\tbegin \n\t\tif (a[1]+a[3]) mod k=0 then inc(count);\n\t\texit;\n\tend;\n\tfor j:=1 to m do \n\t\tif ((b[j]-a[x-1])<=n) and ((b[j]-a[x-1])>0) then \n\t\tbegin \n\t\t\ta[x]:=b[j]-a[x-1];\n\t\t\tdfs(x+1);\n\t\tend;\nend;\nbegin \n\tread(n,k);\n\tm:=2*n div k;\n\tfor i:=1 to m do b[i]:=i*k;\n\tfor i:=1 to n do \n\tbegin \n\t\ta[1]:=i;\n\t\tdfs(2);\n\tend;\n\twrite(count);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 479, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s340645589", "group_id": "codeNet:p03266", "input_text": "var\n\ta,b,c:longint;\n\tn,k,s:int64;\nfunction ans(x:longint):int64;\nbegin\n\tif x mod k=0 then exit(n div k)\n\telse exit(n div k+1);\nend;\nbegin\n\tread(n,k);\n\ts:=0;\n\tif n0 then writeln;\n\t if b[i]=0 then continue;\n\t for j:=1 to m do\n\t begin\n\t\t if c[j]=0 then continue;\n\t\t if a[i,j]=0 then write('.') else write('#');\n\t\tend;\n\tend;\nend.\n\t\t ", "language": "Pascal", "metadata": {"date": 1535249700, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s753463606.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s753463606", "user_id": "u111363574"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n a,d:array[0..100,0..100]of longint;\n b,c,e:array[0..100]of longint;\n n,m,i,j:longint;\n ch:char;\nbegin\n readln(n,m);\n for i:=1 to n do \n for j:=1 to m do\n\t begin\n\t read(ch);\n\t\tif ch='.' then\n\t\t begin\n\t\t a[i,j]:=0;\n\t\t\t{b[i]:=b[i-1]+0;\n\t\t\tc[j]:=c[j-1]+0;}\n\t\t end else\n\t\t begin\n\t\t a[i,j]:=1;\n\t\t\tinc(b[i]);\n\t\t\tinc(c[j]);\n\t\t end;\n\t\t if j=m then readln;\n\t end;\n for i:=1 to n do\n for j:=1 to m do\n\t begin\n\t if (b[i]=0)or(c[j]=0) then d[i,j]:=0 else d[i,j]:=1;\n\t end;\n for i:=1 to n do\n begin\n\t if b[i-1]>0 then writeln;\n\t if b[i]=0 then continue;\n\t for j:=1 to m do\n\t begin\n\t\t if c[j]=0 then continue;\n\t\t if a[i,j]=0 then write('.') else write('#');\n\t\tend;\n\tend;\nend.\n\t\t ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 715, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s796802443", "group_id": "codeNet:p03273", "input_text": "var\n i,j,p,q,t:longint;\n s,st:array[1..100,1..100]of char;\nbegin\n readln(p,q);\n for i:=1 to p do begin\n for j:=1 to q do begin read(s[i,j]); if s[i,j]='#' then inc(t); end;\n readln;\n end;\n st:=s;\n for i:=1 to p do\n begin\n s[i,q+1]:=' ';\n\t for j:=1 to q do if (s[i,j]<>s[i,j+1]) then break;\n\t if (j=q)and(t>q) then for j:=1 to q do begin if (s[i,j]='#')and(st[i,j]<>' ') then dec(t); st[i,j]:=' '; end;\n end;\n for i:=1 to q do\n begin\n s[p+1,i]:=' ';\n\t for j:=1 to p do if (s[j,i]<>s[j+1,i]) then break;\n\t if (j=p)and(t>p) then for j:=1 to p do begin if (s[j,i]='#')and(st[j,i]<>' ') then dec(t); st[j,i]:=' '; end;\n end;\n for i:=1 to p do\n begin\n\tfor j:=1 to q+1 do if st[i,j]<>' ' then break;\n\tif j=q+1 then continue;\n for j:=1 to q do if st[i,j]<>' ' then write(st[i,j]);\n\twriteln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1535248414, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s796802443.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s796802443", "user_id": "u223928734"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n i,j,p,q,t:longint;\n s,st:array[1..100,1..100]of char;\nbegin\n readln(p,q);\n for i:=1 to p do begin\n for j:=1 to q do begin read(s[i,j]); if s[i,j]='#' then inc(t); end;\n readln;\n end;\n st:=s;\n for i:=1 to p do\n begin\n s[i,q+1]:=' ';\n\t for j:=1 to q do if (s[i,j]<>s[i,j+1]) then break;\n\t if (j=q)and(t>q) then for j:=1 to q do begin if (s[i,j]='#')and(st[i,j]<>' ') then dec(t); st[i,j]:=' '; end;\n end;\n for i:=1 to q do\n begin\n s[p+1,i]:=' ';\n\t for j:=1 to p do if (s[j,i]<>s[j+1,i]) then break;\n\t if (j=p)and(t>p) then for j:=1 to p do begin if (s[j,i]='#')and(st[j,i]<>' ') then dec(t); st[j,i]:=' '; end;\n end;\n for i:=1 to p do\n begin\n\tfor j:=1 to q+1 do if st[i,j]<>' ' then break;\n\tif j=q+1 then continue;\n for j:=1 to q do if st[i,j]<>' ' then write(st[i,j]);\n\twriteln;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 821, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s146381227", "group_id": "codeNet:p03273", "input_text": "var\n i,j,p,q:longint;\n s,st:array[1..100,1..100]of char;\nfunction check:boolean;\nvar\n k,l:longint;\nbegin\n check:=false;\n for l:=1 to p do\n for k:=1 to q do if st[l,k]='#' then exit;\n check:=true;\nend;\nbegin\n readln(p,q);\n for i:=1 to p do begin\n for j:=1 to q do read(s[i,j]);\n readln;\n end;\n st:=s;\n for i:=1 to p do\n begin\n if check then break;\n s[i,q+1]:=' ';\n\t for j:=1 to q do if (s[i,j]<>s[i,j+1]) then break;\n\t if j=q then for j:=1 to q do st[i,j]:=' ';\n end;\n for i:=1 to q do\n begin\n if check then break;\n s[p+1,i]:=' ';\n\t for j:=1 to p do if (s[j,i]<>s[j+1,i]) then break;\n\t if j=p then for j:=1 to p do st[j,i]:=' ';\n end;\n for i:=1 to p do\n begin\n\tfor j:=1 to q+1 do if st[i,j]<>' ' then break;\n\tif j=q+1 then continue;\n for j:=1 to q do if st[i,j]<>' ' then write(st[i,j]);\n\twriteln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1535247766, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s146381227.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s146381227", "user_id": "u223928734"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n i,j,p,q:longint;\n s,st:array[1..100,1..100]of char;\nfunction check:boolean;\nvar\n k,l:longint;\nbegin\n check:=false;\n for l:=1 to p do\n for k:=1 to q do if st[l,k]='#' then exit;\n check:=true;\nend;\nbegin\n readln(p,q);\n for i:=1 to p do begin\n for j:=1 to q do read(s[i,j]);\n readln;\n end;\n st:=s;\n for i:=1 to p do\n begin\n if check then break;\n s[i,q+1]:=' ';\n\t for j:=1 to q do if (s[i,j]<>s[i,j+1]) then break;\n\t if j=q then for j:=1 to q do st[i,j]:=' ';\n end;\n for i:=1 to q do\n begin\n if check then break;\n s[p+1,i]:=' ';\n\t for j:=1 to p do if (s[j,i]<>s[j+1,i]) then break;\n\t if j=p then for j:=1 to p do st[j,i]:=' ';\n end;\n for i:=1 to p do\n begin\n\tfor j:=1 to q+1 do if st[i,j]<>' ' then break;\n\tif j=q+1 then continue;\n for j:=1 to q do if st[i,j]<>' ' then write(st[i,j]);\n\twriteln;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 848, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s676013117", "group_id": "codeNet:p03273", "input_text": "var\n i,j,p,q:longint;\n s,st:array[1..100,1..100]of char;\nfunction check:boolean;\nvar\n k,l:longint;\nbegin\n check:=false;\n for l:=1 to p do\n for k:=1 to q do if st[l,k]='#' then exit;\n check:=true;\nend;\nbegin\n readln(p,q);\n for i:=1 to p do\n for j:=1 to q do read(s[i,j]);\n st:=s;\n for i:=1 to p do\n begin\n if check then break;\n s[i,q+1]:=' ';\n\t for j:=1 to q do if (s[i,j]<>s[i,j+1]) then break;\n\t if j=q then for j:=1 to q do st[i,j]:=' ';\n end;\n for i:=1 to q do\n begin\n if check then break;\n s[p+1,i]:=' ';\n\t for j:=1 to p do if (s[j,i]<>s[j+1,i]) then break;\n\t if j=p then for j:=1 to p do st[j,i]:=' ';\n end;\n for i:=1 to p do\n begin\n\tfor j:=1 to q+1 do if st[i,j]<>' ' then break;\n\tif j=q+1 then continue;\n for j:=1 to q do if st[i,j]<>' ' then write(st[i,j]);\n\twriteln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1535247585, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Pascal/s676013117.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s676013117", "user_id": "u223928734"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "var\n i,j,p,q:longint;\n s,st:array[1..100,1..100]of char;\nfunction check:boolean;\nvar\n k,l:longint;\nbegin\n check:=false;\n for l:=1 to p do\n for k:=1 to q do if st[l,k]='#' then exit;\n check:=true;\nend;\nbegin\n readln(p,q);\n for i:=1 to p do\n for j:=1 to q do read(s[i,j]);\n st:=s;\n for i:=1 to p do\n begin\n if check then break;\n s[i,q+1]:=' ';\n\t for j:=1 to q do if (s[i,j]<>s[i,j+1]) then break;\n\t if j=q then for j:=1 to q do st[i,j]:=' ';\n end;\n for i:=1 to q do\n begin\n if check then break;\n s[p+1,i]:=' ';\n\t for j:=1 to p do if (s[j,i]<>s[j+1,i]) then break;\n\t if j=p then for j:=1 to p do st[j,i]:=' ';\n end;\n for i:=1 to p do\n begin\n\tfor j:=1 to q+1 do if st[i,j]<>' ' then break;\n\tif j=q+1 then continue;\n for j:=1 to q do if st[i,j]<>' ' then write(st[i,j]);\n\twriteln;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 825, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s977718178", "group_id": "codeNet:p03274", "input_text": "var\n a:array[0..100010]of int64;\n k,l,r,n,ans:int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(a[i]);\n ans:=maxlongint;\n for i:=1 to n-k+1 do\n begin\n l:=min(a[i],0);\n r:=max(a[i+k-1],0);\n ans:=min(ans,r-l*2);\n ans:=min(ans,r*2-l);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1540472263, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s977718178.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s977718178", "user_id": "u119860177"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n a:array[0..100010]of int64;\n k,l,r,n,ans:int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(a[i]);\n ans:=maxlongint;\n for i:=1 to n-k+1 do\n begin\n l:=min(a[i],0);\n r:=max(a[i+k-1],0);\n ans:=min(ans,r-l*2);\n ans:=min(ans,r*2-l);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 450, "cpu_time_ms": 15, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s093946423", "group_id": "codeNet:p03274", "input_text": "var\n n,k,ans,t:int64;\n sum,x:array[0..100000]of int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(x[i]);\n ans:=maxlongint;\n for i:=1 to n do\n begin\n if i+k-1>n then continue;\n if (x[i]+x[i+k-1])=((abs(x[i])+abs(x[i+k-1])))\n then ans:=min(ans,max(abs(x[i]),abs(x[i+k-1])))\n else ans:=min(ans,min(abs(x[i]),abs(x[i+k-1]))+abs(x[i])+abs(x[i+k-1]));\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1538856662, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s093946423.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s093946423", "user_id": "u089230684"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n n,k,ans,t:int64;\n sum,x:array[0..100000]of int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(x[i]);\n ans:=maxlongint;\n for i:=1 to n do\n begin\n if i+k-1>n then continue;\n if (x[i]+x[i+k-1])=((abs(x[i])+abs(x[i+k-1])))\n then ans:=min(ans,max(abs(x[i]),abs(x[i+k-1])))\n else ans:=min(ans,min(abs(x[i]),abs(x[i+k-1]))+abs(x[i])+abs(x[i+k-1]));\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 569, "cpu_time_ms": 16, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s538240076", "group_id": "codeNet:p03274", "input_text": "var\n n,k,ans,t:int64;\n sum,x:array[0..100000]of int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(x[i]);\n ans:=maxlongint;\n for i:=1 to n do\n begin\n if i+k-1>n then continue;\n if (x[i]+x[i+k-1])=((abs(x[i])+abs(x[i+k-1])))\n then ans:=min(ans,max(abs(x[i]),abs(x[i+k-1])))\n else ans:=min(ans,min(abs(x[i]),abs(x[i+k-1]))+abs(x[i])+abs(x[i+k-1]));\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1538775825, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s538240076.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s538240076", "user_id": "u119860177"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n n,k,ans,t:int64;\n sum,x:array[0..100000]of int64;\n i:longint;\n\nfunction min(x,y:int64):int64;\nbegin\n if xy then exit(x);\n exit(y);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do\n read(x[i]);\n ans:=maxlongint;\n for i:=1 to n do\n begin\n if i+k-1>n then continue;\n if (x[i]+x[i+k-1])=((abs(x[i])+abs(x[i+k-1])))\n then ans:=min(ans,max(abs(x[i]),abs(x[i+k-1])))\n else ans:=min(ans,min(abs(x[i]),abs(x[i+k-1]))+abs(x[i])+abs(x[i+k-1]));\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 15, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s355376778", "group_id": "codeNet:p03274", "input_text": "var n,k,i,aa:longint;\nmin,count:int64;\na:array[0..100010]of longint;\nfunction m(x,y:int64):int64;\nbegin \n\tif x=k then min:=m(min,a[aa-k+1]);\n\tif n-aa>=k then min:=m(min,a[aa+k]);\n\tfor i:=0 to m(n-aa,k) do \n\t\tif (aa>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-k+i+1]>a[aa+i] then count:=a[aa-k+i+1]+2*a[aa+i]\n\t\t\t\telse count:=2*a[aa-k+i+1]+a[aa+i];\n\t\t\tmin:=m(min,count);\n\t\tend;\n\twrite(min);\nend.", "language": "Pascal", "metadata": {"date": 1535388582, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s355376778.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355376778", "user_id": "u914335902"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var n,k,i,aa:longint;\nmin,count:int64;\na:array[0..100010]of longint;\nfunction m(x,y:int64):int64;\nbegin \n\tif x=k then min:=m(min,a[aa-k+1]);\n\tif n-aa>=k then min:=m(min,a[aa+k]);\n\tfor i:=0 to m(n-aa,k) do \n\t\tif (aa>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-k+i+1]>a[aa+i] then count:=a[aa-k+i+1]+2*a[aa+i]\n\t\t\t\telse count:=2*a[aa-k+i+1]+a[aa+i];\n\t\t\tmin:=m(min,count);\n\t\tend;\n\twrite(min);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 574, "cpu_time_ms": 15, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s857055351", "group_id": "codeNet:p03274", "input_text": "var\n\ta:array[0..100010]of longint;\n\ti,n,k,x,y:longint;\n\ts:int64;\nfunction min(x,y:longint):longint;\nbegin\n\tif x0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\tif p=k then\n\tbegin\n\t\tif abs(f[1])=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535338961, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s018451580.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s018451580", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\tif p=k then\n\tbegin\n\t\tif abs(f[1])=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1038, "cpu_time_ms": 17, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s302090493", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\tif p=k then\n\tbegin\n\t\tif abs(f[1])=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535335402, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s302090493.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s302090493", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\tif x=0 then\n\tbegin\n\t\twriteln(-f[p-k+1]);\n\t\thalt;\n\tend;\n\tif y=0 then\n\tbegin\n\t\twriteln(f[k]);\n\t\thalt;\n\tend;\n\tif p=k then\n\tbegin\n\t\tif abs(f[1])=k then s:=min(s,f1[k-1]);\n\tif 0-y>=k then s:=min(s,f1[0-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[0-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 990, "cpu_time_ms": 16, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s336606965", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif -y>=k then s:=min(s,f1[-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535334021, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s336606965.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s336606965", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif -y>=k then s:=min(s,f1[-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k-1) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 747, "cpu_time_ms": 17, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s359804457", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-100010..100010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif -y>=k then s:=min(s,f1[-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535333739, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s359804457.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s359804457", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t,a,p:longint;\n\tf,f1:array[-100010..100010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif a<0 then inc(y);\n\t\tif a=0 then dec(k);\n\t\tif (a>0) and (f[i-1]<=0) then t:=i;\n\t\tif a<>0 then\n\t\tbegin \n\t\t\tinc(p);\n\t\t\tf[p]:=a;\n\t\tend;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to p do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif -y>=k then s:=min(s,f1[-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 745, "cpu_time_ms": 16, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s115061125", "group_id": "codeNet:p03274", "input_text": "var\n\ts:int64;\n\tn,k,i,x,y,t:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif f[i]<0 then inc(y);\n\t\tif f[i]=0 then dec(k);\n\t\tif (f[i]>0) and (f[i-1]<=0) then t:=i;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to n do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif -y>=k then s:=min(s,f1[-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535333299, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s115061125.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s115061125", "user_id": "u957998623"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n\ts:int64;\n\tn,k,i,x,y,t:longint;\n\tf,f1:array[-200010..200010] of longint;\nfunction min(a,b:longint):longint;\nbegin\n\tif a0 then inc(x);\n\t\tif f[i]<0 then inc(y);\n\t\tif f[i]=0 then dec(k);\n\t\tif (f[i]>0) and (f[i-1]<=0) then t:=i;\n\tend;\n\ts:=$7f;\n\tfor i:=1 to n do f1[i-t]:=abs(f[i]);\n\ty:=-y;\n\tif x>=k then s:=min(s,f1[k-1]);\n\tif -y>=k then s:=min(s,f1[-k]);\n\tfor i:=-min(-y,k) to -1 do\n\t\tif i*(k+i-1)<=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[k+i-1]);\n\tfor i:=1 to min(x-1,k) do\n\t\tif i*(k-i-1)>=0 then\n\t\t\ts:=min(s,f1[i]*2+f1[-(k-i-1)]);\n\twriteln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 696, "cpu_time_ms": 17, "memory_kb": 2048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s279002281", "group_id": "codeNet:p03274", "input_text": "var n,k,i,aa,x,count,min,bb:integer;\na,b:array[1..100000]of integer;\nbegin \n\tread(n,k);\n\tmin:=maxint;\n\ti:=1;\n\tread(x);\n\twhile x<0 do \n\tbegin \n\t\ta[i]:=-x;\n\t\tinc(i);\n\t\tread(x);\n\tend;\n\tif x=0 then begin dec(k);dec(n);if k<>0 then read(x);end;\n\taa:=i-1;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "language": "Pascal", "metadata": {"date": 1535318612, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s279002281.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s279002281", "user_id": "u914335902"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var n,k,i,aa,x,count,min,bb:integer;\na,b:array[1..100000]of integer;\nbegin \n\tread(n,k);\n\tmin:=maxint;\n\ti:=1;\n\tread(x);\n\twhile x<0 do \n\tbegin \n\t\ta[i]:=-x;\n\t\tinc(i);\n\t\tread(x);\n\tend;\n\tif x=0 then begin dec(k);dec(n);if k<>0 then read(x);end;\n\taa:=i-1;bb:=n-aa;\n\tb[1]:=x;\n\tfor i:=2 to n-aa do read(b[i]);\n\tfor i:=0 to k do \n\t\tif (aa>=i) and (bb>=k-i) then\n\t\tbegin \n\t\t\tif a[aa-i+1]>b[k-i] then count:=2*b[k-i]+a[aa-i+1]\n\t\t\t\telse count:=2*a[aa-i+1]+b[k-i];\n\t\t if min>count then min:=count;\n\t\tend;\n\twrite(min);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 512, "cpu_time_ms": 15, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s960950169", "group_id": "codeNet:p03274", "input_text": "var\n a,b:array[-100000..100000]of longint;\n i,n,k:longint;\n ans:qword;\nFunction min(x,y:longint):longint;\nbegin\n if xb then exit(a) else exit(b);\nend;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i]<=0 then x:=i;\n end;\n ans:=maxlongint;\n if x>=k then ans:=min(ans,abs(a[x-k+1]));\n if x+k<=n then ans:=min(ans,abs(a[x+k]));\n for i:=max(x,k)+1 to min(n,x+k)-1 do\n ans:=min(ans,min(abs(a[i]),abs(a[i-k+1]))*2+max(abs(a[i]),abs(a[i-k+1])));\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1535249416, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Pascal/s274474801.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s274474801", "user_id": "u960852022"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n n,k,i,x:longint;\n ans:int64;\n a:array[0..100010] of int64;\nfunction min(a,b:int64):int64;\nbegin\n if ab then exit(a) else exit(b);\nend;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i]<=0 then x:=i;\n end;\n ans:=maxlongint;\n if x>=k then ans:=min(ans,abs(a[x-k+1]));\n if x+k<=n then ans:=min(ans,abs(a[x+k]));\n for i:=max(x,k)+1 to min(n,x+k)-1 do\n ans:=min(ans,min(abs(a[i]),abs(a[i-k+1]))*2+max(abs(a[i]),abs(a[i-k+1])));\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 621, "cpu_time_ms": 15, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s341245206", "group_id": "codeNet:p03281", "input_text": "VAR N,i,j,count,kq:INTEGER;\nbegin\n readln(n);\n i:=1;\n if n < 105 then writeln('0') else\n if n = 105 then writeln('1') else \n begin\n while i <= n do \n begin\n count:=0;\n for j:=1 to n do \n if i mod j = 0 then inc(Count);\n if count = 8 then inc(kq);\n inc(i,2);\n end;\n writeln(kq);\n end;\n end.", "language": "Pascal", "metadata": {"date": 1536030316, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Pascal/s341245206.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s341245206", "user_id": "u060797441"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "VAR N,i,j,count,kq:INTEGER;\nbegin\n readln(n);\n i:=1;\n if n < 105 then writeln('0') else\n if n = 105 then writeln('1') else \n begin\n while i <= n do \n begin\n count:=0;\n for j:=1 to n do \n if i mod j = 0 then inc(Count);\n if count = 8 then inc(kq);\n inc(i,2);\n end;\n writeln(kq);\n end;\n end.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 314, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s315462664", "group_id": "codeNet:p03281", "input_text": "var\n i,j,s,n,ans:longint;\nbegin\n read(n);\n for i:=1 to n do\n if i mod 2=1 then\n begin\n s:=0;\n for j:=1 to i do\n if i mod j=0 then inc(s);\n if s=8 then inc(ans);\n end;\n write(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534642243, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Pascal/s315462664.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s315462664", "user_id": "u111363574"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n i,j,s,n,ans:longint;\nbegin\n read(n);\n for i:=1 to n do\n if i mod 2=1 then\n begin\n s:=0;\n for j:=1 to i do\n if i mod j=0 then inc(s);\n if s=8 then inc(ans);\n end;\n write(ans);\nend.", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 231, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s074756982", "group_id": "codeNet:p03283", "input_text": "var\n a,f:array[0..1000,0..1000] of longint;\n n,m,q,i,j,k,x,y:longint;\nbegin\n readln(n,m,q);\n for i:=1 to m do\n begin\n readln(x,y);\n inc(a[x,y]);\n end;\n for i:=1 to n do\n for j:=i to n do\n begin\n f[i,j]:=f[i,j-1];\n for k:=i to j do\n inc(f[i,j],a[k,j]);\n end;\n for i:=1 to q do\n begin\n readln(x,y);\n writeln(f[x,y]);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1534982499, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Pascal/s074756982.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s074756982", "user_id": "u111363574"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n a,f:array[0..1000,0..1000] of longint;\n n,m,q,i,j,k,x,y:longint;\nbegin\n readln(n,m,q);\n for i:=1 to m do\n begin\n readln(x,y);\n inc(a[x,y]);\n end;\n for i:=1 to n do\n for j:=i to n do\n begin\n f[i,j]:=f[i,j-1];\n for k:=i to j do\n inc(f[i,j],a[k,j]);\n end;\n for i:=1 to q do\n begin\n readln(x,y);\n writeln(f[x,y]);\n end;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 399, "cpu_time_ms": 137, "memory_kb": 6784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s512859171", "group_id": "codeNet:p03283", "input_text": "var n,x,y:integer;\nm,q,i,j,count:longint;\na:array[1..200000,1..2]of integer;\nbegin \n read(n);\n read(m,q);\n for i:=1 to m do\n read(a[i,1],a[i,2]);\n for i:=1 to q do\n begin \n read(x,y);\n count:=0;\n for j:=1 to m do if (a[j,1]>=x) and (a[j,2]<=y) then inc(count)\n else if a[j,1]>y then break;\n writeln(count);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1534646067, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Pascal/s512859171.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s512859171", "user_id": "u914335902"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,x,y:integer;\nm,q,i,j,count:longint;\na:array[1..200000,1..2]of integer;\nbegin \n read(n);\n read(m,q);\n for i:=1 to m do\n read(a[i,1],a[i,2]);\n for i:=1 to q do\n begin \n read(x,y);\n count:=0;\n for j:=1 to m do if (a[j,1]>=x) and (a[j,2]<=y) then inc(count)\n else if a[j,1]>y then break;\n writeln(count);\n end;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 343, "cpu_time_ms": 3155, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s804032246", "group_id": "codeNet:p03283", "input_text": "uses crt;\ntype\n qd = record\n l,r:longint;\n end;\nvar\n a,b:array[1..500] of qd;\n i,j,n,m,q,sum:longint;\nbegin\n read(n,m,q);\n for i:=1 to m do\n readln(a[i].l, a[i].r);\n for i:=1 to q do\n begin\n readln(b[i].l, b[i].r);\n sum:=0;\n for j:=1 to m do\n if (a[j].l>=b[i].l) and (a[j].r<=b[i].r)\n then inc(sum);\n writeln(sum);\n end;\n // readln;\n // readln;\nend.", "language": "Pascal", "metadata": {"date": 1534645929, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Pascal/s804032246.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s804032246", "user_id": "u004929494"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses crt;\ntype\n qd = record\n l,r:longint;\n end;\nvar\n a,b:array[1..500] of qd;\n i,j,n,m,q,sum:longint;\nbegin\n read(n,m,q);\n for i:=1 to m do\n readln(a[i].l, a[i].r);\n for i:=1 to q do\n begin\n readln(b[i].l, b[i].r);\n sum:=0;\n for j:=1 to m do\n if (a[j].l>=b[i].l) and (a[j].r<=b[i].r)\n then inc(sum);\n writeln(sum);\n end;\n // readln;\n // readln;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 544, "cpu_time_ms": 280, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s360852524", "group_id": "codeNet:p03283", "input_text": "uses crt;\ntype\n qd = record\n l,r:longint;\n end;\nvar\n a,b:array[1..500] of qd;\n i,j,n,m,q,sum:longint;\nbegin\n read(n,m,q);\n for i:=1 to m do\n readln(a[i].l, a[i].r);\n for i:=1 to q do\n readln(b[i].l, b[i].r);\n for i:=1 to q do\n begin\n sum:=0;\n for j:=1 to m do\n if (a[j].l>=b[i].l) and (a[j].r<=b[i].r)\n then inc(sum);\n writeln(sum);\n end;\n readln;\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1534645797, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Pascal/s360852524.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s360852524", "user_id": "u004929494"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses crt;\ntype\n qd = record\n l,r:longint;\n end;\nvar\n a,b:array[1..500] of qd;\n i,j,n,m,q,sum:longint;\nbegin\n read(n,m,q);\n for i:=1 to m do\n readln(a[i].l, a[i].r);\n for i:=1 to q do\n readln(b[i].l, b[i].r);\n for i:=1 to q do\n begin\n sum:=0;\n for j:=1 to m do\n if (a[j].l>=b[i].l) and (a[j].r<=b[i].r)\n then inc(sum);\n writeln(sum);\n end;\n readln;\n readln;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 130, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s949450031", "group_id": "codeNet:p03283", "input_text": "var\n\ta:array[0..510,0..200000] of longint;\n\ti,j,k,s,n,m,q,x,y:longint;\nbegin\n\treadln(n,m,q);\n\tfillchar(a,sizeof(a),0);\n\tfor i:=1 to m do\n\tbegin\n\t\tread(x,y);\n\t\tinc(a[x,0]);\n\t\ta[x,a[x,0]]:=y;\n\tend;\n\tfor i:=1 to q do\n\tbegin\n\t\ts:=0;\n\t\tread(x,y);\n\t\tfor k:=x to y do\n\t\t\tfor j:=1 to a[k,0] do\n\t\t\t\tif a[k,j]<=y then inc(s);\n\t\twriteln(s);\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1534643366, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Pascal/s949450031.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s949450031", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\ta:array[0..510,0..200000] of longint;\n\ti,j,k,s,n,m,q,x,y:longint;\nbegin\n\treadln(n,m,q);\n\tfillchar(a,sizeof(a),0);\n\tfor i:=1 to m do\n\tbegin\n\t\tread(x,y);\n\t\tinc(a[x,0]);\n\t\ta[x,a[x,0]]:=y;\n\tend;\n\tfor i:=1 to q do\n\tbegin\n\t\ts:=0;\n\t\tread(x,y);\n\t\tfor k:=x to y do\n\t\t\tfor j:=1 to a[k,0] do\n\t\t\t\tif a[k,j]<=y then inc(s);\n\t\twriteln(s);\n\tend;\nend.", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 3160, "memory_kb": 399488}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s213700267", "group_id": "codeNet:p03284", "input_text": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tif (cracker mod person) = 0 then\n\t\tWriteLn(0)\n\telse\n\t\tWriteLn(1);\n\tend;\n \nbegin\nMainProc;\nend.\n", "language": "Pascal", "metadata": {"date": 1536892704, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Pascal/s213700267.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s213700267", "user_id": "u397546896"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \n procedure MainProc;\n\tvar\n\t\ttext : string;\n\t\tstrlist : TStringList;\n\t\tcracker : Integer;\n\t\tperson : Integer;\n\tbegin\n\tReadLn(text);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := text;\n\t\tcracker := StrToInt(strlist.Strings[0]);\n\t\tperson := StrToInt(strlist.Strings[1]);\n\t\tfinally\n\t\t\tFreeAndNil(strlist);\n\t\t\tend;\n\tif (cracker mod person) = 0 then\n\t\tWriteLn(0)\n\telse\n\t\tWriteLn(1);\n\tend;\n \nbegin\nMainProc;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s830508859", "group_id": "codeNet:p03287", "input_text": "const\n key=100001623;\nvar\n n,i,j:longint;\n k,ans,m,t:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100002000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n t:=b[k];\n if k=0 then ans:=ans+t;\n ans:=ans+t*(t-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534042623, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s830508859.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s830508859", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=100001623;\nvar\n n,i,j:longint;\n k,ans,m,t:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100002000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n t:=b[k];\n if k=0 then ans:=ans+t;\n ans:=ans+t*(t-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 614, "cpu_time_ms": 96, "memory_kb": 391424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s119905931", "group_id": "codeNet:p03287", "input_text": "const\n key=99999989;\nvar\n n,i,j:longint;\n k,ans,m,t:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n t:=b[k];\n if k=0 then ans:=ans+t;\n ans:=ans+t*(t-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534042260, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s119905931.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s119905931", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=99999989;\nvar\n n,i,j:longint;\n k,ans,m,t:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n t:=b[k];\n if k=0 then ans:=ans+t;\n ans:=ans+t*(t-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 613, "cpu_time_ms": 96, "memory_kb": 391552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s985188841", "group_id": "codeNet:p03287", "input_text": "const\n key=99999989;\nvar\n n,m,i,j:longint;\n k,ans,t:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n t:=b[k];\n if k=0 then ans:=ans+t;\n ans:=ans+t*(t-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534042088, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s985188841.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s985188841", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=99999989;\nvar\n n,m,i,j:longint;\n k,ans,t:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n t:=b[k];\n if k=0 then ans:=ans+t;\n ans:=ans+t*(t-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 613, "cpu_time_ms": 145, "memory_kb": 391552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s049619398", "group_id": "codeNet:p03287", "input_text": "const\n key=99999989;\nvar\n n,m,i,j:longint;\n k:int64;\n ans:extended;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans:0:0);\nend.", "language": "Pascal", "metadata": {"date": 1534041500, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s049619398.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s049619398", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=99999989;\nvar\n n,m,i,j:longint;\n k:int64;\n ans:extended;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans:0:0);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 617, "cpu_time_ms": 97, "memory_kb": 391552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s542833856", "group_id": "codeNet:p03287", "input_text": "const\n key=99999989;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534041278, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s542833856.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s542833856", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=99999989;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000000] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 599, "cpu_time_ms": 148, "memory_kb": 391552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s491726518", "group_id": "codeNet:p03287", "input_text": "const\n key=100001333;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100001400] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534041211, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s491726518.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s491726518", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=100001333;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100001400] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 600, "cpu_time_ms": 137, "memory_kb": 391424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s885089853", "group_id": "codeNet:p03287", "input_text": "const\n key=100000037;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000040] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534041146, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s885089853.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s885089853", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=100000037;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000040] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 600, "cpu_time_ms": 97, "memory_kb": 391424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s722543448", "group_id": "codeNet:p03287", "input_text": "const\n key=100000007;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000010] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1534041090, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s722543448.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s722543448", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const\n key=100000007;\nvar\n n,m,i,j:longint;\n k,ans:int64;\n a,c,f:array[0..100010] of int64;\n b:array[0..100000010] of longint;\nbegin\n readln(n,m);j:=1;\n for i:=1 to n do\n begin\n read(a[j]);\n c[j]:=i;\n f[i]:=f[i-1]+a[j];\n k:=f[i] mod m mod key;\n if b[k]<>0 then dec(j);\n inc(b[k]);\n inc(j);\n end;\n for i:=1 to j-1 do\n begin \n k:=f[c[i]] mod m mod key;\n if k=0 then ans:=ans+b[k];\n ans:=ans+b[k]*(b[k]-1) div 2;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 600, "cpu_time_ms": 142, "memory_kb": 391424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s980974985", "group_id": "codeNet:p03287", "input_text": "var n,m,i,j:longint;\na:array[1..100000]of qword;\nt,count:int64;\nbegin \n read(n,m);\n count:=0;\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n begin \n t:=a[i];\n\tif t mod m=0 then inc(count);\n for j:=i+1 to n do \n begin \n t:=t+a[j];\n if t mod m=0 then inc(count);\n end;\n end;\n write(count);\nend.\n", "language": "Pascal", "metadata": {"date": 1534040127, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s980974985.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s980974985", "user_id": "u914335902"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,m,i,j:longint;\na:array[1..100000]of qword;\nt,count:int64;\nbegin \n read(n,m);\n count:=0;\n for i:=1 to n do read(a[i]);\n for i:=1 to n do\n begin \n t:=a[i];\n\tif t mod m=0 then inc(count);\n for j:=i+1 to n do \n begin \n t:=t+a[j];\n if t mod m=0 then inc(count);\n end;\n end;\n write(count);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s086139391", "group_id": "codeNet:p03287", "input_text": "CONST fi='';\n fo='';\nVAR\n f:text;\n a,s:array[0..100001] of int64;\n n,m:longint;\n ds,d:int64;\nPROCEDURE input;\n var i:longint;\n begin\n Assign(f,fi);reset(f);\n readln(f,n,m);\n for i:=1 to n do read(f,a[i]);\n Close(f);\n end;\n\nprocedure sort(l,r: longint);\n var\n i,j: longint;\n x,y:int64;\n begin\n i:=l;\n j:=r;\n x:=s[(l+r) div 2];\n repeat\n while s[i]j) then\n begin\n y:=s[i];\n s[i]:=s[j];\n s[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if ls[i-1] then begin ds:=ds+(i-d)*(i-d-1) div 2; d:=i; end;\n end;\n\nPROCEDURE output;\n begin\n Assign(f,fo);rewrite(f);\n writeln(f,ds);\n Close(f);\n end;\n\nBEGIN\n input; main; output;\nEND.\n", "language": "Pascal", "metadata": {"date": 1534037344, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03287.html", "problem_id": "p03287", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03287/input.txt", "sample_output_relpath": "derived/input_output/data/p03287/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03287/Pascal/s086139391.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s086139391", "user_id": "u155241752"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "CONST fi='';\n fo='';\nVAR\n f:text;\n a,s:array[0..100001] of int64;\n n,m:longint;\n ds,d:int64;\nPROCEDURE input;\n var i:longint;\n begin\n Assign(f,fi);reset(f);\n readln(f,n,m);\n for i:=1 to n do read(f,a[i]);\n Close(f);\n end;\n\nprocedure sort(l,r: longint);\n var\n i,j: longint;\n x,y:int64;\n begin\n i:=l;\n j:=r;\n x:=s[(l+r) div 2];\n repeat\n while s[i]j) then\n begin\n y:=s[i];\n s[i]:=s[j];\n s[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if ls[i-1] then begin ds:=ds+(i-d)*(i-d-1) div 2; d:=i; end;\n end;\n\nPROCEDURE output;\n begin\n Assign(f,fo);rewrite(f);\n writeln(f,ds);\n Close(f);\n end;\n\nBEGIN\n input; main; output;\nEND.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "sample_input": "3 2\n4 1 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03287", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies.\n\nYou will take out the candies from some consecutive boxes and distribute them evenly to M children.\n\nSuch being the case, find the number of the pairs (l, r) that satisfy the following:\n\nl and r are both integers and satisfy 1 \\leq l \\leq r \\leq N.\n\nA_l + A_{l+1} + ... + A_r is a multiple of M.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n2 \\leq M \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the pairs (l, r) that satisfy the conditions.\n\nNote that the number may not fit into a 32-bit integer type.\n\nSample Input 1\n\n3 2\n4 1 5\n\nSample Output 1\n\n3\n\nThe sum A_l + A_{l+1} + ... + A_r for each pair (l, r) is as follows:\n\nSum for (1, 1): 4\n\nSum for (1, 2): 5\n\nSum for (1, 3): 10\n\nSum for (2, 2): 1\n\nSum for (2, 3): 6\n\nSum for (3, 3): 5\n\nAmong these, three are multiples of 2.\n\nSample Input 2\n\n13 17\n29 7 5 7 9 51 7 13 8 55 42 9 81\n\nSample Output 2\n\n6\n\nSample Input 3\n\n10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n25", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1246, "cpu_time_ms": 21, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s332591158", "group_id": "codeNet:p03289", "input_text": "var s:string;\nn,i:longint;\nf:boolean;\nbegin \n\treadln(s);\n\tn:=length(s);\n\tif s[1]<>'A' then begin write('WA');exit;end;\n\tif (s[2]<'a') or (s[n]<'a') then begin write('WA');exit;end;\n\tf:=true;\n\tfor i:=3 to n-1 do \n\tif (s[i]='C') and (f=false) or (s[i]<'a') and (s[i]<>'C') then begin write('WA');exit;end\n\telse if s[i]='C' then f:=false;\n\tif f=true then begin write('WA');exit;end;\n\twrite('AC');\nend.", "language": "Pascal", "metadata": {"date": 1533569930, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03289.html", "problem_id": "p03289", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03289/input.txt", "sample_output_relpath": "derived/input_output/data/p03289/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03289/Pascal/s332591158.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s332591158", "user_id": "u914335902"}, "prompt_components": {"gold_output": "AC\n", "input_to_evaluate": "var s:string;\nn,i:longint;\nf:boolean;\nbegin \n\treadln(s);\n\tn:=length(s);\n\tif s[1]<>'A' then begin write('WA');exit;end;\n\tif (s[2]<'a') or (s[n]<'a') then begin write('WA');exit;end;\n\tf:=true;\n\tfor i:=3 to n-1 do \n\tif (s[i]='C') and (f=false) or (s[i]<'a') and (s[i]<>'C') then begin write('WA');exit;end\n\telse if s[i]='C' then f:=false;\n\tif f=true then begin write('WA');exit;end;\n\twrite('AC');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "sample_input": "AtCoder\n"}, "reference_outputs": ["AC\n"], "source_document_id": "p03289", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 401, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s735010540", "group_id": "codeNet:p03290", "input_text": "var\nf:array[0..1000]of longint;\nn,t,i,j,k,x1,x2,s,min:longint;\nbegin\nread(n,t);\nfor i:=0 to 1000 do\nf[i]:=0;\ns:=0;\nmin:=maxlongint;\nfor i:=1 to n do\nbegin\nread(x1,x2);\ninc(s,x1);\n for j:=s downto x1 do\n begin\n if f[j-x1]+100*i*x1+x2>f[j] then\n f[j]:=f[j-x1]+100*i*x1+x2;\n if (f[j]>=t) and (jf[k] then\n f[k]:=f[k-1]+100*i;\n if (f[k]>=t) and (kf[j] then\n f[j]:=f[j-x1]+100*i*x1+x2;\n if (f[j]>=t) and (jf[k] then\n f[k]:=f[k-1]+100*i;\n if (f[k]>=t) and (kg then l:=g else l:=k+s;\n\t\t\t\tif f[l]>f[k]+j then t[l]:=t[k]+j;\n\t\t\tend;\n\t\tend;\n\t\tf:=t;\n\tend;\n\tmax:=0;\n\tfor i:=1 to g do\n\t\tif (f[i]>max) and (f[i]<>$7f) then max:=f[i];\n\twriteln(max);\nend.", "language": "Pascal", "metadata": {"date": 1538188395, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s703807495.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s703807495", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\tn,g,a,b,i,j,k,l,s,max:longint;\n\tf,t:array[0..1000010] of longint;\nbegin \n\treadln(n,g);\n\tg:=g div 100; \n\tfillchar(f,sizeof(f),$7f);\n\tf[0]:=0;\n\tfor i:=1 to n do\n\tbegin \n\t\tread(a,b);\n\t\tt:=f;\n\t\tfor j:=a downto 0 do \n\t\tbegin \n\t\t\ts:=i*j;\n\t\t\tif j=a then s:=s+b div 100;\n\t\t\tfor k:=g downto 0 do\n\t\t\tbegin\n\t\t\t\tif k+s>g then l:=g else l:=k+s;\n\t\t\t\tif f[l]>f[k]+j then t[l]:=t[k]+j;\n\t\t\tend;\n\t\tend;\n\t\tf:=t;\n\tend;\n\tmax:=0;\n\tfor i:=1 to g do\n\t\tif (f[i]>max) and (f[i]<>$7f) then max:=f[i];\n\twriteln(max);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 498, "cpu_time_ms": 321, "memory_kb": 7936}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s022950272", "group_id": "codeNet:p03290", "input_text": "var\n\tc,w,f,p:array[0..100000]of longint;\n\ta:array[0..1000,0..100010]of longint; \n\tg,v,x,y,d,n,i,j,k,t:longint;\nbegin\n\treadln(d,g);\n\tv:=g div 100;\n\tn:=0;\n\tfillchar(a,sizeof(a),0);\n\tfillchar(f,sizeof(f),0);\n\tfor i:=1 to d do\n begin\n\t\treadln(x,y);\n\t\ty:=y div 100;\n\t\tfor j:=1 to x do\n\t begin\n\t\t\tinc(n);\n\t\t\tif j<>x then w[n]:=i*j else w[n]:=i*j+y;\n\t\t\tc[n]:=j; p[n]:=i;\n\t\tend;\n\tend;\n\tfor i:=1 to n do\n begin\n\t\tinc(a[p[i],0]);\n\t\ta[p[i],a[p[i],0]]:=i;\n\tend;\n\tfor i:=1 to n do\n\t\tfor j:=v downto 0 do\n\t\t\tfor k:=1 to a[i,0] do\n\t\t\t\tif j>=c[a[i,k]] then\n\t\t\t\t\tif f[j]=v then break;\n\twriteln(i);\nend.", "language": "Pascal", "metadata": {"date": 1533763635, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s022950272.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s022950272", "user_id": "u957998623"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n\tc,w,f,p:array[0..100000]of longint;\n\ta:array[0..1000,0..100010]of longint; \n\tg,v,x,y,d,n,i,j,k,t:longint;\nbegin\n\treadln(d,g);\n\tv:=g div 100;\n\tn:=0;\n\tfillchar(a,sizeof(a),0);\n\tfillchar(f,sizeof(f),0);\n\tfor i:=1 to d do\n begin\n\t\treadln(x,y);\n\t\ty:=y div 100;\n\t\tfor j:=1 to x do\n\t begin\n\t\t\tinc(n);\n\t\t\tif j<>x then w[n]:=i*j else w[n]:=i*j+y;\n\t\t\tc[n]:=j; p[n]:=i;\n\t\tend;\n\tend;\n\tfor i:=1 to n do\n begin\n\t\tinc(a[p[i],0]);\n\t\ta[p[i],a[p[i],0]]:=i;\n\tend;\n\tfor i:=1 to n do\n\t\tfor j:=v downto 0 do\n\t\t\tfor k:=1 to a[i,0] do\n\t\t\t\tif j>=c[a[i,k]] then\n\t\t\t\t\tif f[j]=v then break;\n\twriteln(i);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 706, "cpu_time_ms": 1079, "memory_kb": 391552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s145615984", "group_id": "codeNet:p03290", "input_text": "var\n d,g,i,top,k,j:longint;\n a,f:array[0..200010] of longint;\n p,c:array[0..20] of longint;\nfunction min(a,b:longint):longint;\nbegin\n if ab then exit(a) else exit(b);\nend;\nbegin\n readln(d,g);g:=g div 100;\n top:=1;a[top]:=g;\n for i:=1 to d do\n begin\n readln(p[i],c[i]);\n c[i]:=c[i] div 100;\n k:=top;\n while k>0 do\n begin\n for j:=1 to p[i]-1 do\n if f[max(a[k]-i*j,0)]=0 then \n begin\n inc(top);a[top]:=max(a[k]-i*j,0);\n f[max(a[k]-i*j,0)]:=f[a[k]]+j;\n end\n else f[max(a[k]-i*j,0)]:=min(f[max(a[k]-i*j,0)],f[a[k]]+j);\n if f[max(a[k]-i*p[i]-c[i],0)]=0 then \n begin\n inc(top);a[top]:=max(a[k]-i*p[i]-c[i],0);\n f[max(a[k]-i*p[i]-c[i],0)]:=f[a[k]]+p[i];\n end\n else f[max(a[k]-i*p[i]-c[i],0)]:=min(f[max(a[k]-i*p[i]-c[i],0)],f[a[k]]+p[i]);\n dec(k);\n end;\n end;\n for i:=1 to 10 do writeln(f[i]);\n writeln(f[0]);\nend.", "language": "Pascal", "metadata": {"date": 1533599686, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s145615984.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s145615984", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n d,g,i,top,k,j:longint;\n a,f:array[0..200010] of longint;\n p,c:array[0..20] of longint;\nfunction min(a,b:longint):longint;\nbegin\n if ab then exit(a) else exit(b);\nend;\nbegin\n readln(d,g);g:=g div 100;\n top:=1;a[top]:=g;\n for i:=1 to d do\n begin\n readln(p[i],c[i]);\n c[i]:=c[i] div 100;\n k:=top;\n while k>0 do\n begin\n for j:=1 to p[i]-1 do\n if f[max(a[k]-i*j,0)]=0 then \n begin\n inc(top);a[top]:=max(a[k]-i*j,0);\n f[max(a[k]-i*j,0)]:=f[a[k]]+j;\n end\n else f[max(a[k]-i*j,0)]:=min(f[max(a[k]-i*j,0)],f[a[k]]+j);\n if f[max(a[k]-i*p[i]-c[i],0)]=0 then \n begin\n inc(top);a[top]:=max(a[k]-i*p[i]-c[i],0);\n f[max(a[k]-i*p[i]-c[i],0)]:=f[a[k]]+p[i];\n end\n else f[max(a[k]-i*p[i]-c[i],0)]:=min(f[max(a[k]-i*p[i]-c[i],0)],f[a[k]]+p[i]);\n dec(k);\n end;\n end;\n for i:=1 to 10 do writeln(f[i]);\n writeln(f[0]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1320, "cpu_time_ms": 102, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s126780208", "group_id": "codeNet:p03290", "input_text": "var\n d,g,i,j:longint;\n f:array[0..20,0..200010] of longint;\n p,c:array[0..20] of longint;\nfunction min(a,b:longint):longint;\nbegin\n if a999999999 then exit(f[n,m]);\n for i:=0 to p[n]-1 do\n f[n,m]:=min(f[n,m],dp(n-1,m-i*n)+i);\n f[n,m]:=min(f[n,m],dp(n-1,m-p[n]*n-c[n])+p[n]);\n exit(f[n,m]);\nend;\nbegin\n readln(d,g);g:=g div 100;\n for i:=1 to d do\n begin\n readln(p[i],c[i]);\n c[i]:=c[i] div 100;\n end;\n for i:=1 to d do\n for j:=1 to g do\n f[i,j]:=999999999;\n writeln(dp(d,g));\nend.", "language": "Pascal", "metadata": {"date": 1533595451, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s126780208.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s126780208", "user_id": "u960852022"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n d,g,i,j:longint;\n f:array[0..20,0..200010] of longint;\n p,c:array[0..20] of longint;\nfunction min(a,b:longint):longint;\nbegin\n if a999999999 then exit(f[n,m]);\n for i:=0 to p[n]-1 do\n f[n,m]:=min(f[n,m],dp(n-1,m-i*n)+i);\n f[n,m]:=min(f[n,m],dp(n-1,m-p[n]*n-c[n])+p[n]);\n exit(f[n,m]);\nend;\nbegin\n readln(d,g);g:=g div 100;\n for i:=1 to d do\n begin\n readln(p[i],c[i]);\n c[i]:=c[i] div 100;\n end;\n for i:=1 to d do\n for j:=1 to g do\n f[i,j]:=999999999;\n writeln(dp(d,g));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 741, "cpu_time_ms": 2103, "memory_kb": 9088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s456759131", "group_id": "codeNet:p03290", "input_text": "var\n num,b,d,n,i,j,k,t:word;\n c,w,p,f:array[0..100000]of word;\n a:array[0..1000,0..100010]of word; \n inp,m,v:longint;\nbegin\n readln(d,inp);\n m:=inp div 100;\n v:=m;\n t:=d;\n for i:=1 to d do\n begin\n\t readln(num,inp);\n\t b:=inp div 100;\n\t for j:=1 to num do\n\t begin\n\t\t inc(n);\n\t\t if j<>num then w[n]:=i*j else w[n]:=i*j+b;\n\t\t c[n]:=j;\n\t p[n]:=i;\n\t\tend;\n\tend;\n for i:=1 to n do\n begin\n\t inc(a[p[i],0]);\n\t a[p[i],a[p[i],0]]:=i;\n\tend;\n for i:=1 to t do\n for j:=v downto 0 do\n\t for k:=1 to a[i,0] do\n\t if j>=c[a[i,k]] then\n\t\t if f[j]=m then break;\n write(i);\nend.", "language": "Pascal", "metadata": {"date": 1533522607, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Pascal/s456759131.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s456759131", "user_id": "u111363574"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n num,b,d,n,i,j,k,t:word;\n c,w,p,f:array[0..100000]of word;\n a:array[0..1000,0..100010]of word; \n inp,m,v:longint;\nbegin\n readln(d,inp);\n m:=inp div 100;\n v:=m;\n t:=d;\n for i:=1 to d do\n begin\n\t readln(num,inp);\n\t b:=inp div 100;\n\t for j:=1 to num do\n\t begin\n\t\t inc(n);\n\t\t if j<>num then w[n]:=i*j else w[n]:=i*j+b;\n\t\t c[n]:=j;\n\t p[n]:=i;\n\t\tend;\n\tend;\n for i:=1 to n do\n begin\n\t inc(a[p[i],0]);\n\t a[p[i],a[p[i],0]]:=i;\n\tend;\n for i:=1 to t do\n for j:=v downto 0 do\n\t for k:=1 to a[i,0] do\n\t if j>=c[a[i,k]] then\n\t\t if f[j]=m then break;\n write(i);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 697, "cpu_time_ms": 488, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s381900426", "group_id": "codeNet:p03290", "input_text": "var\nf:array[0..1000]of longint;\nn,t,i,j,k,x1,x2,s,min:longint;\nbegin\nread(n,t);\nfor i:=0 to 1000 do\nf[i]:=0;\ns:=0;\nmin:=maxlongint;\nfor i:=1 to n do\nbegin\nread(x1,x2);\ninc(s,x1);\n for j:=s downto x1 do\n begin\n if f[j-x1]+100*i*x1+x2>f[j] then\n f[j]:=f[j-x1]+100*i*x1+x2;\n if (f[j]>=t) and (jf[k] then\n f[k]:=f[k-1]+100*i;\n if (f[k]>=t) and (kf[j] then\n f[j]:=f[j-x1]+100*i*x1+x2;\n if (f[j]>=t) and (jf[k] then\n f[k]:=f[k-1]+100*i;\n if (f[k]>=t) and (k Length(strT)) then\n\t\texit;\n\tif (Length(strS) = 1) then\n\t\texit;\n\twhile (Length(strS) <> count) do\n\t\tbegin\n\t\tif (strS = strT)then\n\t\t\tbegin\n\t\t\tResult := True;\n\t\t\texit;\n\t\t\tend;\n\t\tstr := strS[Length(strS)];\n\t\tstr := str + Copy(strS, 1, Length(strS) - 1);\n\t\tstrS := str;\n\t\tcount := count + 1;\n\t\tend;\n\tend;\n\nvar\n\tstrS, strT : String;\nbegin\t\n\treadln(strS);\n\treadln(strT);\n\t\n\tif CheckFunc(strS, strT) then\n\t\twriteln('Yes')\n\telse\n\t\twriteln('No');\nend.", "language": "Pascal", "metadata": {"date": 1532226911, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03293.html", "problem_id": "p03293", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03293/input.txt", "sample_output_relpath": "derived/input_output/data/p03293/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03293/Pascal/s020148654.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s020148654", "user_id": "u397546896"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n \nfunction CheckFunc(strS : String; const strT : String) : Boolean;\n\tvar\n\t\tcount : Integer;\n\t\tstr : String;\n\tbegin\n\tResult := False;\n\tcount := 0;\n\tif (Length(strS) <> Length(strT)) then\n\t\texit;\n\tif (Length(strS) = 1) then\n\t\texit;\n\twhile (Length(strS) <> count) do\n\t\tbegin\n\t\tif (strS = strT)then\n\t\t\tbegin\n\t\t\tResult := True;\n\t\t\texit;\n\t\t\tend;\n\t\tstr := strS[Length(strS)];\n\t\tstr := str + Copy(strS, 1, Length(strS) - 1);\n\t\tstrS := str;\n\t\tcount := count + 1;\n\t\tend;\n\tend;\n\nvar\n\tstrS, strT : String;\nbegin\t\n\treadln(strS);\n\treadln(strT);\n\t\n\tif CheckFunc(strS, strT) then\n\t\twriteln('Yes')\n\telse\n\t\twriteln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given string S and T consisting of lowercase English letters.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOperation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.\n\nHere, |X| denotes the length of the string X.\n\nConstraints\n\n2 \\leq |S| \\leq 100\n\n|S| = |T|\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S equals T after rotation, print Yes; if it does not, print No.\n\nSample Input 1\n\nkyoto\ntokyo\n\nSample Output 1\n\nYes\n\nIn the first operation, kyoto becomes okyot.\n\nIn the second operation, okyot becomes tokyo.\n\nSample Input 2\n\nabc\narc\n\nSample Output 2\n\nNo\n\nabc does not equal arc after any number of operations.\n\nSample Input 3\n\naaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab\n\nSample Output 3\n\nYes", "sample_input": "kyoto\ntokyo\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03293", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given string S and T consisting of lowercase English letters.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOperation: Let S = S_1 S_2 ... S_{|S|}. Change S to S_{|S|} S_1 S_2 ... S_{|S|-1}.\n\nHere, |X| denotes the length of the string X.\n\nConstraints\n\n2 \\leq |S| \\leq 100\n\n|S| = |T|\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S equals T after rotation, print Yes; if it does not, print No.\n\nSample Input 1\n\nkyoto\ntokyo\n\nSample Output 1\n\nYes\n\nIn the first operation, kyoto becomes okyot.\n\nIn the second operation, okyot becomes tokyo.\n\nSample Input 2\n\nabc\narc\n\nSample Output 2\n\nNo\n\nabc does not equal arc after any number of operations.\n\nSample Input 3\n\naaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 637, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s975247689", "group_id": "codeNet:p03294", "input_text": "var\nN,i,F: integer;\na: array [1..100000] of integer;\nBEGIN\nF:= 0;\nread(N);\nfor i:=1 to N do\nbegin\nread(a[i]);\nend;\nfor i:=1 to N do\nbegin\nF:=F+(a[i]-1);\nend;\nwriteln(F);\nEND.\n", "language": "Pascal", "metadata": {"date": 1561434309, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Pascal/s975247689.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s975247689", "user_id": "u018679195"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var\nN,i,F: integer;\na: array [1..100000] of integer;\nBEGIN\nF:= 0;\nread(N);\nfor i:=1 to N do\nbegin\nread(a[i]);\nend;\nfor i:=1 to N do\nbegin\nF:=F+(a[i]-1);\nend;\nwriteln(F);\nEND.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s291127814", "group_id": "codeNet:p03294", "input_text": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils;\nvar\n a,h,w,i,j,count,count2,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Readln(a);\n sum:=0;\n for I := 0 to a - 1 do begin\n Read(b);\n sum:=sum+b;\n end;\n\n Writeln(sum-a);\n Readln;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1532624143, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Pascal/s291127814.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s291127814", "user_id": "u755925739"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program Project1;\n \n{$APPTYPE CONSOLE}\n \nuses\n SysUtils;\nvar\n a,h,w,i,j,count,count2,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n al:string = 'abcdefghijklmnopqrstuvwxyz';\n tf,tfl,tfr:Boolean;\nbegin\n try\n { TODO -oUser -cConsole メイン : ここにコードを記述してください }\n Readln(a);\n sum:=0;\n for I := 0 to a - 1 do begin\n Read(b);\n sum:=sum+b;\n end;\n\n Writeln(sum-a);\n Readln;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 584, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s569287928", "group_id": "codeNet:p03294", "input_text": "var\n n: integer;\n a: integer;\n i: integer;\n sum: integer;\nbegin\n read(n);\n sum := 0;\n for i := 0 to n - 1 do begin\n read(a);\n sum := sum + a - 1;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1532372946, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Pascal/s569287928.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s569287928", "user_id": "u379319063"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var\n n: integer;\n a: integer;\n i: integer;\n sum: integer;\nbegin\n read(n);\n sum := 0;\n for i := 0 to n - 1 do begin\n read(a);\n sum := sum + a - 1;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s336605533", "group_id": "codeNet:p03297", "input_text": "var\n\tT,i:Longint;\n\tA,B,C,D,G:int64;\nfunction gcd(a,b:int64):int64;\nbegin\n\tif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\n\tread(T);\n\tfor i:=1 to T do begin\n\t\tread(A,B,C,D);\n\t\tG:=gcd(B,D);\n\t\tif(B>A)or(B>D)or(B>(-A mod G+G)mod G+C+1)then writeln('No')else writeln('Yes');\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1579680212, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03297.html", "problem_id": "p03297", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03297/input.txt", "sample_output_relpath": "derived/input_output/data/p03297/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03297/Pascal/s336605533.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s336605533", "user_id": "u657913472"}, "prompt_components": {"gold_output": "No\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n", "input_to_evaluate": "var\n\tT,i:Longint;\n\tA,B,C,D,G:int64;\nfunction gcd(a,b:int64):int64;\nbegin\n\tif b=0 then gcd:=a else gcd:=gcd(b,a mod b);\nend;\nbegin\n\tread(T);\n\tfor i:=1 to T do begin\n\t\tread(A,B,C,D);\n\t\tG:=gcd(B,D);\n\t\tif(B>A)or(B>D)or(B>(-A mod G+G)mod G+C+1)then writeln('No')else writeln('Yes');\n\tend;\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nRingo Mart, a convenience store, sells apple juice.\n\nOn the opening day of Ringo Mart, there were A cans of juice in stock in the morning.\nSnuke buys B cans of juice here every day in the daytime.\nThen, the manager checks the number of cans of juice remaining in stock every night.\nIf there are C or less cans, D new cans will be added to the stock by the next morning.\n\nDetermine if Snuke can buy juice indefinitely, that is, there is always B or more cans of juice in stock when he attempts to buy them.\nNobody besides Snuke buy juice at this store.\n\nNote that each test case in this problem consists of T queries.\n\nConstraints\n\n1 \\leq T \\leq 300\n\n1 \\leq A, B, C, D \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\nA_1 B_1 C_1 D_1\nA_2 B_2 C_2 D_2\n:\nA_T B_T C_T D_T\n\nIn the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.\n\nOutput\n\nPrint T lines. The i-th line should contain Yes if Snuke can buy apple juice indefinitely in the i-th query; No otherwise.\n\nSample Input 1\n\n14\n9 7 5 9\n9 7 6 9\n14 10 7 12\n14 10 8 12\n14 10 9 12\n14 10 7 11\n14 10 8 11\n14 10 9 11\n9 10 5 10\n10 10 5 10\n11 10 5 10\n16 10 5 10\n1000000000000000000 17 14 999999999999999985\n1000000000000000000 17 15 999999999999999985\n\nSample Output 1\n\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n\nIn the first query, the number of cans of juice in stock changes as follows: (D represents daytime and N represents night.)\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 6\n→D x\n\nIn the second query, the number of cans of juice in stock changes as follows:\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 15\n→D 8\n→N 8\n→D 1\n→N 10\n→D 3\n→N 12\n→D 5\n→N 14\n→D 7\n→N 7\n→D 0\n→N 9\n→D 2\n→N 11\n→D …\n\nand so on, thus Snuke can buy juice indefinitely.\n\nSample Input 2\n\n24\n1 2 3 4\n1 2 4 3\n1 3 2 4\n1 3 4 2\n1 4 2 3\n1 4 3 2\n2 1 3 4\n2 1 4 3\n2 3 1 4\n2 3 4 1\n2 4 1 3\n2 4 3 1\n3 1 2 4\n3 1 4 2\n3 2 1 4\n3 2 4 1\n3 4 1 2\n3 4 2 1\n4 1 2 3\n4 1 3 2\n4 2 1 3\n4 2 3 1\n4 3 1 2\n4 3 2 1\n\nSample Output 2\n\nNo\nNo\nNo\nNo\nNo\nNo\nYes\nYes\nNo\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo", "sample_input": "14\n9 7 5 9\n9 7 6 9\n14 10 7 12\n14 10 8 12\n14 10 9 12\n14 10 7 11\n14 10 8 11\n14 10 9 11\n9 10 5 10\n10 10 5 10\n11 10 5 10\n16 10 5 10\n1000000000000000000 17 14 999999999999999985\n1000000000000000000 17 15 999999999999999985\n"}, "reference_outputs": ["No\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n"], "source_document_id": "p03297", "source_text": "Score : 600 points\n\nProblem Statement\n\nRingo Mart, a convenience store, sells apple juice.\n\nOn the opening day of Ringo Mart, there were A cans of juice in stock in the morning.\nSnuke buys B cans of juice here every day in the daytime.\nThen, the manager checks the number of cans of juice remaining in stock every night.\nIf there are C or less cans, D new cans will be added to the stock by the next morning.\n\nDetermine if Snuke can buy juice indefinitely, that is, there is always B or more cans of juice in stock when he attempts to buy them.\nNobody besides Snuke buy juice at this store.\n\nNote that each test case in this problem consists of T queries.\n\nConstraints\n\n1 \\leq T \\leq 300\n\n1 \\leq A, B, C, D \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\nA_1 B_1 C_1 D_1\nA_2 B_2 C_2 D_2\n:\nA_T B_T C_T D_T\n\nIn the i-th query, A = A_i, B = B_i, C = C_i, D = D_i.\n\nOutput\n\nPrint T lines. The i-th line should contain Yes if Snuke can buy apple juice indefinitely in the i-th query; No otherwise.\n\nSample Input 1\n\n14\n9 7 5 9\n9 7 6 9\n14 10 7 12\n14 10 8 12\n14 10 9 12\n14 10 7 11\n14 10 8 11\n14 10 9 11\n9 10 5 10\n10 10 5 10\n11 10 5 10\n16 10 5 10\n1000000000000000000 17 14 999999999999999985\n1000000000000000000 17 15 999999999999999985\n\nSample Output 1\n\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nYes\nNo\nNo\nYes\n\nIn the first query, the number of cans of juice in stock changes as follows: (D represents daytime and N represents night.)\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 6\n→D x\n\nIn the second query, the number of cans of juice in stock changes as follows:\n\n9\n→D 2\n→N 11\n→D 4\n→N 13\n→D 6\n→N 15\n→D 8\n→N 8\n→D 1\n→N 10\n→D 3\n→N 12\n→D 5\n→N 14\n→D 7\n→N 7\n→D 0\n→N 9\n→D 2\n→N 11\n→D …\n\nand so on, thus Snuke can buy juice indefinitely.\n\nSample Input 2\n\n24\n1 2 3 4\n1 2 4 3\n1 3 2 4\n1 3 4 2\n1 4 2 3\n1 4 3 2\n2 1 3 4\n2 1 4 3\n2 3 1 4\n2 3 4 1\n2 4 1 3\n2 4 3 1\n3 1 2 4\n3 1 4 2\n3 2 1 4\n3 2 4 1\n3 4 1 2\n3 4 2 1\n4 1 2 3\n4 1 3 2\n4 2 1 3\n4 2 3 1\n4 3 1 2\n4 3 2 1\n\nSample Output 2\n\nNo\nNo\nNo\nNo\nNo\nNo\nYes\nYes\nNo\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s819732723", "group_id": "codeNet:p03303", "input_text": "var i,x:Longint;\ns:String;\nbegin\nreadln(s);\nread(x);\ni:=1;\nwhile i<=length(s)do begin\nwrite(s[i]);inc(i,x);\nend;\nwriteln;\nend.", "language": "Pascal", "metadata": {"date": 1581664054, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03303.html", "problem_id": "p03303", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03303/input.txt", "sample_output_relpath": "derived/input_output/data/p03303/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03303/Pascal/s819732723.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s819732723", "user_id": "u657913472"}, "prompt_components": {"gold_output": "adg\n", "input_to_evaluate": "var i,x:Longint;\ns:String;\nbegin\nreadln(s);\nread(x);\ni:=1;\nwhile i<=length(s)do begin\nwrite(s[i]);inc(i,x);\nend;\nwriteln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nWe will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.\n\nConstraints\n\n1 \\leq w \\leq |S| \\leq 1000\n\nS consists of lowercase English letters.\n\nw is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nw\n\nOutput\n\nPrint the desired string in one line.\n\nSample Input 1\n\nabcdefgh\n3\n\nSample Output 1\n\nadg\n\nWhen we write down abcdefgh, starting a new line after every three letters, we get the following:\n\nabc\n\ndef\n\ngh\n\nConcatenating the letters at the beginnings of these lines, we obtain adg.\n\nSample Input 2\n\nlllll\n1\n\nSample Output 2\n\nlllll\n\nSample Input 3\n\nsouuundhound\n2\n\nSample Output 3\n\nsuudon", "sample_input": "abcdefgh\n3\n"}, "reference_outputs": ["adg\n"], "source_document_id": "p03303", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nWe will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.\n\nConstraints\n\n1 \\leq w \\leq |S| \\leq 1000\n\nS consists of lowercase English letters.\n\nw is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nw\n\nOutput\n\nPrint the desired string in one line.\n\nSample Input 1\n\nabcdefgh\n3\n\nSample Output 1\n\nadg\n\nWhen we write down abcdefgh, starting a new line after every three letters, we get the following:\n\nabc\n\ndef\n\ngh\n\nConcatenating the letters at the beginnings of these lines, we obtain adg.\n\nSample Input 2\n\nlllll\n1\n\nSample Output 2\n\nlllll\n\nSample Input 3\n\nsouuundhound\n2\n\nSample Output 3\n\nsuudon", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s175378847", "group_id": "codeNet:p03308", "input_text": "var\n n,min,max,i,x:longint;\nbegin\n readln(n);\n max:=0;min:=maxlongint;\n for i:=1 to n do\n begin\n read(x);\n if xmax then max:=x;\n end;\n writeln(max-min);\nend.", "language": "Pascal", "metadata": {"date": 1530892348, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03308.html", "problem_id": "p03308", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03308/input.txt", "sample_output_relpath": "derived/input_output/data/p03308/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03308/Pascal/s175378847.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s175378847", "user_id": "u960852022"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n n,min,max,i,x:longint;\nbegin\n readln(n);\n max:=0;min:=maxlongint;\n for i:=1 to n do\n begin\n read(x);\n if xmax then max:=x;\n end;\n writeln(max-min);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "sample_input": "4\n1 4 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03308", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s706704526", "group_id": "codeNet:p03308", "input_text": "uses\n SysUtils,\n Classes;\n\nvar\n\ta, i, j, t : Integer;\n\tatype : array of Integer;\n\tstr : String;\n\tstrlist : TStringList;\nbegin\n\treadln(a);\n\tsetLength(atype, a);\n\t\n\treadln(str);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := str;\n\t\tfor i := 0 to a - 1 do\n\t\t\tatype[i] := StrToInt(strlist.Strings[i]);\n\tfinally\n\t\tstrlist.free;\n\t\tend;\n\t\t\n\tfor i := 0 to a - 1 do\n\t\tbegin\n\t\tfor j := a - 1 downto i + 1 do\n\t\t\tbegin\n\t\t\t\tif atype[j - 1] > atype[j] then\n\t\t\t\t\tbegin\n\t\t\t\t\tt := atype[j - 1];\n\t\t\t\t\tatype[j - 1] := atype[j];\n\t\t\t\t\tatype[j] := t;\n\t\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tt := atype[a -1] - atype[0];\n\t\twriteLn(t);\nend.", "language": "Pascal", "metadata": {"date": 1530499312, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03308.html", "problem_id": "p03308", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03308/input.txt", "sample_output_relpath": "derived/input_output/data/p03308/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03308/Pascal/s706704526.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s706704526", "user_id": "u397546896"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "uses\n SysUtils,\n Classes;\n\nvar\n\ta, i, j, t : Integer;\n\tatype : array of Integer;\n\tstr : String;\n\tstrlist : TStringList;\nbegin\n\treadln(a);\n\tsetLength(atype, a);\n\t\n\treadln(str);\n\tstrlist := TStringList.Create;\n\ttry\n\t\tstrlist.Delimiter := ' ';\n\t\tstrlist.DelimitedText := str;\n\t\tfor i := 0 to a - 1 do\n\t\t\tatype[i] := StrToInt(strlist.Strings[i]);\n\tfinally\n\t\tstrlist.free;\n\t\tend;\n\t\t\n\tfor i := 0 to a - 1 do\n\t\tbegin\n\t\tfor j := a - 1 downto i + 1 do\n\t\t\tbegin\n\t\t\t\tif atype[j - 1] > atype[j] then\n\t\t\t\t\tbegin\n\t\t\t\t\tt := atype[j - 1];\n\t\t\t\t\tatype[j - 1] := atype[j];\n\t\t\t\t\tatype[j] := t;\n\t\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tt := atype[a -1] - atype[0];\n\t\twriteLn(t);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "sample_input": "4\n1 4 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03308", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 650, "cpu_time_ms": 1, "memory_kb": 288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s798176775", "group_id": "codeNet:p03309", "input_text": "var\n n,i:longint;\n ans:int64;\n a:array[0..200010] of longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,mid,t:longint;\nbegin\n i:=l;j:=r;mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then \n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if lmid 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 l1 do begin\n\t\tM:=(L+R)div 2;\n\t\tcnt:=0;\n\t\tfor i:=1 to N do if A[i]<=M then inc(cnt);\n\t\tif cnt*2>=N then R:=M else L:=M;\n\tend;\n\tfor i:=1 to N do inc(ans,abs(A[i]-R));\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1582186877, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03311.html", "problem_id": "p03311", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03311/input.txt", "sample_output_relpath": "derived/input_output/data/p03311/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03311/Pascal/s630228969.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s630228969", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tN,L,R,M,i,cnt:Longint;\n\tA:Array[1..200000]of Longint;\n\tans:int64;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(A[i]);\n\t\tdec(A[i],i);\n\tend;\n\tL:=-1000000;\n\tR:=1000000000;\n\twhile R-L>1 do begin\n\t\tM:=(L+R)div 2;\n\t\tcnt:=0;\n\t\tfor i:=1 to N do if A[i]<=M then inc(cnt);\n\t\tif cnt*2>=N then R:=M else L:=M;\n\tend;\n\tfor i:=1 to N do inc(ans,abs(A[i]-R));\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "sample_input": "5\n2 2 3 5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03311", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 371, "cpu_time_ms": 61, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s071882373", "group_id": "codeNet:p03317", "input_text": "var\n n,k,min,i,t,ans,s:longint;\n a:array[0..100010] of longint;\nbegin\n readln(n,k);\n min:=maxlongint;\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i]y then\n exit(x);\n exit(y);\nend;\nbegin\n readln(len1,len2,k);\n readln(s1);\n readln(s2);\n for i:=1 to len1 do\n a[i]:=ord(s1[len1-i+1])-48;\n for i:=1 to len2 do\n b[i]:=ord(s2[len2-i+1])-48;\n i:=1;\n while (i<=len1) or (i<=len2) do\n begin\n if (a[i]=1) and (b[i]=1) then\n begin\n dec(k);\n if k<0 then\n break;\n t1:=true;\n t2:=true;\n z1:=0;\n z2:=0;\n j:=i;\n while a[j]=1 do\n begin\n a[j]:=0;\n inc(j);\n end;\n a[j]:=1;\n if j>len1 then\n len1:=j;\n y:=j;\n j:=i;\n while b[j]=1 do\n begin\n b[j]:=0;\n inc(j);\n end;\n b[j]:=1;\n if j>len2 then\n len2:=j;\n i:=max(i+1,max(y,j));\n end else\n inc(i);\n end;\n for i:=len1 downto 1 do\n write(a[i]);\n writeln;\n for i:=len2 downto 1 do\n write(b[i]);\n writeln;\nend.", "language": "Pascal", "metadata": {"date": 1530831289, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03336.html", "problem_id": "p03336", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03336/input.txt", "sample_output_relpath": "derived/input_output/data/p03336/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03336/Pascal/s512973541.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s512973541", "user_id": "u582335028"}, "prompt_components": {"gold_output": "10000\n10010\n", "input_to_evaluate": "var\n a,b:array[0..1000005]of longint;\n n,m,k,len1,len2,i,j,z1,z2,y:longint;\n s1,s2:ansistring;\n t1,t2:boolean;\nfunction max(x,y:longint):longint;\nbegin\n if x>y then\n exit(x);\n exit(y);\nend;\nbegin\n readln(len1,len2,k);\n readln(s1);\n readln(s2);\n for i:=1 to len1 do\n a[i]:=ord(s1[len1-i+1])-48;\n for i:=1 to len2 do\n b[i]:=ord(s2[len2-i+1])-48;\n i:=1;\n while (i<=len1) or (i<=len2) do\n begin\n if (a[i]=1) and (b[i]=1) then\n begin\n dec(k);\n if k<0 then\n break;\n t1:=true;\n t2:=true;\n z1:=0;\n z2:=0;\n j:=i;\n while a[j]=1 do\n begin\n a[j]:=0;\n inc(j);\n end;\n a[j]:=1;\n if j>len1 then\n len1:=j;\n y:=j;\n j:=i;\n while b[j]=1 do\n begin\n b[j]:=0;\n inc(j);\n end;\n b[j]:=1;\n if j>len2 then\n len2:=j;\n i:=max(i+1,max(y,j));\n end else\n inc(i);\n end;\n for i:=len1 downto 1 do\n write(a[i]);\n writeln;\n for i:=len2 downto 1 do\n write(b[i]);\n writeln;\nend.", "problem_context": "Score : 2400 points\n\nProblem Statement\n\nTakahashi and Aoki love calculating things, so they will play with numbers now.\n\nFirst, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y.\nThen, they will enjoy themselves by repeating the following operation K times:\n\nCompute the bitwise AND of the number currently kept by Takahashi and the number currently kept by Aoki. Let Z be the result.\n\nThen, add Z to both of the numbers kept by Takahashi and Aoki.\n\nHowever, it turns out that even for the two math maniacs this is just too much work.\nCould you find the number that would be kept by Takahashi and the one that would be kept by Aoki eventually?\n\nNote that input and output are done in binary.\nEspecially, X and Y are given as strings S and T of length N and M consisting of 0 and 1, respectively, whose initial characters are guaranteed to be 1.\n\nConstraints\n\n1 ≤ K ≤ 10^6\n\n1 ≤ N,M ≤ 10^6\n\nThe initial characters of S and T are 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nS\nT\n\nOutput\n\nIn the first line, print the number that would be kept by Takahashi eventually; in the second line, print the number that would be kept by Aoki eventually.\nThose numbers should be represented in binary and printed as strings consisting of 0 and 1 that begin with 1.\n\nSample Input 1\n\n2 3 3\n11\n101\n\nSample Output 1\n\n10000\n10010\n\nThe values of X and Y after each operation are as follows:\n\nAfter the first operation: (X,Y)=(4,6).\n\nAfter the second operation: (X,Y)=(8,10).\n\nAfter the third operation: (X,Y)=(16,18).\n\nSample Input 2\n\n5 8 3\n10101\n10101001\n\nSample Output 2\n\n100000\n10110100\n\nSample Input 3\n\n10 10 10\n1100110011\n1011001101\n\nSample Output 3\n\n10000100000010001000\n10000100000000100010", "sample_input": "2 3 3\n11\n101\n"}, "reference_outputs": ["10000\n10010\n"], "source_document_id": "p03336", "source_text": "Score : 2400 points\n\nProblem Statement\n\nTakahashi and Aoki love calculating things, so they will play with numbers now.\n\nFirst, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y.\nThen, they will enjoy themselves by repeating the following operation K times:\n\nCompute the bitwise AND of the number currently kept by Takahashi and the number currently kept by Aoki. Let Z be the result.\n\nThen, add Z to both of the numbers kept by Takahashi and Aoki.\n\nHowever, it turns out that even for the two math maniacs this is just too much work.\nCould you find the number that would be kept by Takahashi and the one that would be kept by Aoki eventually?\n\nNote that input and output are done in binary.\nEspecially, X and Y are given as strings S and T of length N and M consisting of 0 and 1, respectively, whose initial characters are guaranteed to be 1.\n\nConstraints\n\n1 ≤ K ≤ 10^6\n\n1 ≤ N,M ≤ 10^6\n\nThe initial characters of S and T are 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nS\nT\n\nOutput\n\nIn the first line, print the number that would be kept by Takahashi eventually; in the second line, print the number that would be kept by Aoki eventually.\nThose numbers should be represented in binary and printed as strings consisting of 0 and 1 that begin with 1.\n\nSample Input 1\n\n2 3 3\n11\n101\n\nSample Output 1\n\n10000\n10010\n\nThe values of X and Y after each operation are as follows:\n\nAfter the first operation: (X,Y)=(4,6).\n\nAfter the second operation: (X,Y)=(8,10).\n\nAfter the third operation: (X,Y)=(16,18).\n\nSample Input 2\n\n5 8 3\n10101\n10101001\n\nSample Output 2\n\n100000\n10110100\n\nSample Input 3\n\n10 10 10\n1100110011\n1011001101\n\nSample Output 3\n\n10000100000010001000\n10000100000000100010", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1037, "cpu_time_ms": 123, "memory_kb": 12416}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s857136065", "group_id": "codeNet:p03338", "input_text": "var\n n,d,sln:int64;\n i:longint;\n j:char;\n s:ansistring;\nBEGIN\n\n readln(n);\n read(s);\n\n sln:=low(int64);\n for i:=1 to n do\n begin\n d:=0;\n for j:='a' to 'z' do\n if (pos(j,copy(s,1,i))>0) and (pos(j,copy(s,i+1,n-i))>0) then\n d:=d+1;\n if sln0) and (pos(j,copy(s,i+1,n-i))>0) then\n d:=d+1;\n if slnnow then ans:=now;\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1582186476, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03341.html", "problem_id": "p03341", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03341/input.txt", "sample_output_relpath": "derived/input_output/data/p03341/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03341/Pascal/s520758827.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520758827", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tN,i,ans,now:Longint;\n\tS:String;\n\tL,R:Array[0..300001]of Longint;\nbegin\n\treadln(N);\n\treadln(S);\n\tfor i:=1 to N do begin\n\t\tL[i]:=L[i-1];\n\t\tif S[i]='W' then inc(L[i]);\n\tend;\n\tfor i:=N downto 1 do begin\n\t\tR[i]:=R[i+1];\n\t\tif S[i]='E' then inc(R[i]);\n\tend;\n\tans:=N;\n\tfor i:=1 to N do begin\n\t\tnow:=L[i-1]+R[i+1];\n\t\tif ans>now then ans:=now;\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people standing in a row from west to east.\nEach person is facing east or west.\nThe directions of the people is given as a string S of length N.\nThe i-th person from the west is facing east if S_i = E, and west if S_i = W.\n\nYou will appoint one of the N people as the leader, then command the rest of them to face in the direction of the leader.\nHere, we do not care which direction the leader is facing.\n\nThe people in the row hate to change their directions, so you would like to select the leader so that the number of people who have to change their directions is minimized.\nFind the minimum number of people who have to change their directions.\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n|S| = N\n\nS_i is E or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of people who have to change their directions.\n\nSample Input 1\n\n5\nWEEWW\n\nSample Output 1\n\n1\n\nAssume that we appoint the third person from the west as the leader.\nThen, the first person from the west needs to face east and has to turn around.\nThe other people do not need to change their directions, so the number of people who have to change their directions is 1 in this case.\nIt is not possible to have 0 people who have to change their directions, so the answer is 1.\n\nSample Input 2\n\n12\nWEWEWEEEWWWE\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\nWWWWWEEE\n\nSample Output 3\n\n3", "sample_input": "5\nWEEWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03341", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people standing in a row from west to east.\nEach person is facing east or west.\nThe directions of the people is given as a string S of length N.\nThe i-th person from the west is facing east if S_i = E, and west if S_i = W.\n\nYou will appoint one of the N people as the leader, then command the rest of them to face in the direction of the leader.\nHere, we do not care which direction the leader is facing.\n\nThe people in the row hate to change their directions, so you would like to select the leader so that the number of people who have to change their directions is minimized.\nFind the minimum number of people who have to change their directions.\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n|S| = N\n\nS_i is E or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of people who have to change their directions.\n\nSample Input 1\n\n5\nWEEWW\n\nSample Output 1\n\n1\n\nAssume that we appoint the third person from the west as the leader.\nThen, the first person from the west needs to face east and has to turn around.\nThe other people do not need to change their directions, so the number of people who have to change their directions is 1 in this case.\nIt is not possible to have 0 people who have to change their directions, so the answer is 1.\n\nSample Input 2\n\n12\nWEWEWEEEWWWE\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\nWWWWWEEE\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 365, "cpu_time_ms": 6, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s931452060", "group_id": "codeNet:p03349", "input_text": "var\n a,b,c,i,j,k:longint;\n f:array[0..500,0..500,0..500]of longint;\nbegin \n readln(a,b,c);\n f[0,1,0]:=1;\n for i:=0 to a do\n for j:=1 to b do\n for k:=i downto 0 do\n if f[i,j,k]<>0 then\n begin\n if k<>0 then\n begin\n f[i,j,k]:=f[i,j,k] mod c;\n f[i,j,k-1]:=f[i,j,k-1]+f[i,j,k];\n end\n else\n f[i,j+1,i]:=(f[i,j+1,i]+f[i,j,k])mod c;\n f[i+1,j,k]:=(f[i+1,j,k]+(k+1)*f[i,j,k])mod c;\n end;\n writeln(f[a,b+1,a]);\nend.", "language": "Pascal", "metadata": {"date": 1530836742, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03349.html", "problem_id": "p03349", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03349/input.txt", "sample_output_relpath": "derived/input_output/data/p03349/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03349/Pascal/s931452060.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s931452060", "user_id": "u699596082"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n a,b,c,i,j,k:longint;\n f:array[0..500,0..500,0..500]of longint;\nbegin \n readln(a,b,c);\n f[0,1,0]:=1;\n for i:=0 to a do\n for j:=1 to b do\n for k:=i downto 0 do\n if f[i,j,k]<>0 then\n begin\n if k<>0 then\n begin\n f[i,j,k]:=f[i,j,k] mod c;\n f[i,j,k-1]:=f[i,j,k-1]+f[i,j,k];\n end\n else\n f[i,j+1,i]:=(f[i,j+1,i]+f[i,j,k])mod c;\n f[i+1,j,k]:=(f[i+1,j,k]+(k+1)*f[i,j,k])mod c;\n end;\n writeln(f[a,b+1,a]);\nend.", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nFind the number of the possible tuples of sequences (A_0,A_1,...,A_N) that satisfy all of the following conditions, modulo M:\n\nFor every i (0\\leq i\\leq N), A_i is a sequence of length i consisting of integers between 1 and K (inclusive);\n\nFor every i (1\\leq i\\leq N), A_{i-1} is a subsequence of A_i, that is, there exists 1\\leq x_i\\leq i such that the removal of the x_i-th element of A_i would result in a sequence equal to A_{i-1};\n\nFor every i (1\\leq i\\leq N), A_i is lexicographically larger than A_{i-1}.\n\nConstraints\n\n1 \\leq N,K \\leq 300\n\n2 \\leq M \\leq 10^9\n\nN, K and M are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K M\n\nOutput\n\nPrint the number of the possible tuples of sequences (A_0,A_1,...,A_N), modulo M.\n\nSample Input 1\n\n2 2 100\n\nSample Output 1\n\n5\n\nFive tuples below satisfy the conditions:\n\n(),(1),(1,1)\n\n(),(1),(1,2)\n\n(),(1),(2,1)\n\n(),(2),(2,1)\n\n(),(2),(2,2)\n\nSample Input 2\n\n4 3 999999999\n\nSample Output 2\n\n358\n\nSample Input 3\n\n150 150 998244353\n\nSample Output 3\n\n186248260", "sample_input": "2 2 100\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03349", "source_text": "Score : 1200 points\n\nProblem Statement\n\nFind the number of the possible tuples of sequences (A_0,A_1,...,A_N) that satisfy all of the following conditions, modulo M:\n\nFor every i (0\\leq i\\leq N), A_i is a sequence of length i consisting of integers between 1 and K (inclusive);\n\nFor every i (1\\leq i\\leq N), A_{i-1} is a subsequence of A_i, that is, there exists 1\\leq x_i\\leq i such that the removal of the x_i-th element of A_i would result in a sequence equal to A_{i-1};\n\nFor every i (1\\leq i\\leq N), A_i is lexicographically larger than A_{i-1}.\n\nConstraints\n\n1 \\leq N,K \\leq 300\n\n2 \\leq M \\leq 10^9\n\nN, K and M are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K M\n\nOutput\n\nPrint the number of the possible tuples of sequences (A_0,A_1,...,A_N), modulo M.\n\nSample Input 1\n\n2 2 100\n\nSample Output 1\n\n5\n\nFive tuples below satisfy the conditions:\n\n(),(1),(1,1)\n\n(),(1),(1,2)\n\n(),(1),(2,1)\n\n(),(2),(2,1)\n\n(),(2),(2,2)\n\nSample Input 2\n\n4 3 999999999\n\nSample Output 2\n\n358\n\nSample Input 3\n\n150 150 998244353\n\nSample Output 3\n\n186248260", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 507, "memory_kb": 296192}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s542682723", "group_id": "codeNet:p03349", "input_text": "var\n a,b,c,i,j,k:longint;\n f:array[0..500,0..500,0..500]of longint;\nbegin \n readln(a,b,c);\n f[0,1,0]:=1;\n for i:=1 to a do\n for j:=1 to b do\n for k:=i downto 0 do\n if f[i,j,k]<>0 then\n begin\n if k<>0 then\n begin\n f[i,j,k]:=f[i,j,k] mod c;\n f[i,j,k-1]:=f[i,j,k-1]+f[i,j,k];\n end\n else\n f[i,j+1,i]:=(f[i,j+1,i]+f[i,j,k])mod c;\n f[i+1,j,k]:=(f[i+1,j,k]+(k+1)*f[i,j,k])mod c;\n end;\n writeln(f[a,b+1,a]);\nend.", "language": "Pascal", "metadata": {"date": 1530833689, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03349.html", "problem_id": "p03349", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03349/input.txt", "sample_output_relpath": "derived/input_output/data/p03349/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03349/Pascal/s542682723.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s542682723", "user_id": "u699596082"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var\n a,b,c,i,j,k:longint;\n f:array[0..500,0..500,0..500]of longint;\nbegin \n readln(a,b,c);\n f[0,1,0]:=1;\n for i:=1 to a do\n for j:=1 to b do\n for k:=i downto 0 do\n if f[i,j,k]<>0 then\n begin\n if k<>0 then\n begin\n f[i,j,k]:=f[i,j,k] mod c;\n f[i,j,k-1]:=f[i,j,k-1]+f[i,j,k];\n end\n else\n f[i,j+1,i]:=(f[i,j+1,i]+f[i,j,k])mod c;\n f[i+1,j,k]:=(f[i+1,j,k]+(k+1)*f[i,j,k])mod c;\n end;\n writeln(f[a,b+1,a]);\nend.", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nFind the number of the possible tuples of sequences (A_0,A_1,...,A_N) that satisfy all of the following conditions, modulo M:\n\nFor every i (0\\leq i\\leq N), A_i is a sequence of length i consisting of integers between 1 and K (inclusive);\n\nFor every i (1\\leq i\\leq N), A_{i-1} is a subsequence of A_i, that is, there exists 1\\leq x_i\\leq i such that the removal of the x_i-th element of A_i would result in a sequence equal to A_{i-1};\n\nFor every i (1\\leq i\\leq N), A_i is lexicographically larger than A_{i-1}.\n\nConstraints\n\n1 \\leq N,K \\leq 300\n\n2 \\leq M \\leq 10^9\n\nN, K and M are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K M\n\nOutput\n\nPrint the number of the possible tuples of sequences (A_0,A_1,...,A_N), modulo M.\n\nSample Input 1\n\n2 2 100\n\nSample Output 1\n\n5\n\nFive tuples below satisfy the conditions:\n\n(),(1),(1,1)\n\n(),(1),(1,2)\n\n(),(1),(2,1)\n\n(),(2),(2,1)\n\n(),(2),(2,2)\n\nSample Input 2\n\n4 3 999999999\n\nSample Output 2\n\n358\n\nSample Input 3\n\n150 150 998244353\n\nSample Output 3\n\n186248260", "sample_input": "2 2 100\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03349", "source_text": "Score : 1200 points\n\nProblem Statement\n\nFind the number of the possible tuples of sequences (A_0,A_1,...,A_N) that satisfy all of the following conditions, modulo M:\n\nFor every i (0\\leq i\\leq N), A_i is a sequence of length i consisting of integers between 1 and K (inclusive);\n\nFor every i (1\\leq i\\leq N), A_{i-1} is a subsequence of A_i, that is, there exists 1\\leq x_i\\leq i such that the removal of the x_i-th element of A_i would result in a sequence equal to A_{i-1};\n\nFor every i (1\\leq i\\leq N), A_i is lexicographically larger than A_{i-1}.\n\nConstraints\n\n1 \\leq N,K \\leq 300\n\n2 \\leq M \\leq 10^9\n\nN, K and M are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K M\n\nOutput\n\nPrint the number of the possible tuples of sequences (A_0,A_1,...,A_N), modulo M.\n\nSample Input 1\n\n2 2 100\n\nSample Output 1\n\n5\n\nFive tuples below satisfy the conditions:\n\n(),(1),(1,1)\n\n(),(1),(1,2)\n\n(),(1),(2,1)\n\n(),(2),(2,1)\n\n(),(2),(2,2)\n\nSample Input 2\n\n4 3 999999999\n\nSample Output 2\n\n358\n\nSample Input 3\n\n150 150 998244353\n\nSample Output 3\n\n186248260", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 21, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s208812922", "group_id": "codeNet:p03355", "input_text": "{$mode objfpc}\nprogram C;\nuses\n classes, math;\n\nvar\n S: AnsiString;\n k: Integer;\n i, j: Integer;\n AllSubStr: TStringList;\n\nbegin\n ReadLn(S);\n ReadLn(k);\n\n AllSubStr := TStringList.Create;\n\n for i := 1 to Length(S) do \n for j := 1 to Min(k, Length(S) - i + 1) do\n AllSubStr.Add(Copy(S, i, j));\n AllSubStr.Sort;\n \n i := 0;\n for j := 0 to AllSubStr.Count - 1 do \n if AllSubStr[i] <> AllSubStr[j] then\n begin\n Inc(i);\n AllSubStr[i] := AllSubStr[j];\n end;\n {\n for j := 0 to i do \n WriteLn(AllSubStr[j]);\n }\n WriteLn(AllSubStr[k - 1]);\n \nend.", "language": "Pascal", "metadata": {"date": 1533237206, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03355.html", "problem_id": "p03355", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03355/input.txt", "sample_output_relpath": "derived/input_output/data/p03355/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03355/Pascal/s208812922.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s208812922", "user_id": "u422041582"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "{$mode objfpc}\nprogram C;\nuses\n classes, math;\n\nvar\n S: AnsiString;\n k: Integer;\n i, j: Integer;\n AllSubStr: TStringList;\n\nbegin\n ReadLn(S);\n ReadLn(k);\n\n AllSubStr := TStringList.Create;\n\n for i := 1 to Length(S) do \n for j := 1 to Min(k, Length(S) - i + 1) do\n AllSubStr.Add(Copy(S, i, j));\n AllSubStr.Sort;\n \n i := 0;\n for j := 0 to AllSubStr.Count - 1 do \n if AllSubStr[i] <> AllSubStr[j] then\n begin\n Inc(i);\n AllSubStr[i] := AllSubStr[j];\n end;\n {\n for j := 0 to i do \n WriteLn(AllSubStr[j]);\n }\n WriteLn(AllSubStr[k - 1]);\n \nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "sample_input": "aba\n4\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03355", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 583, "cpu_time_ms": 1030, "memory_kb": 3296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s815104759", "group_id": "codeNet:p03366", "input_text": "var n,s,flag,i,left,right:longint;\n tot:int64;\n x,p:array[1..100000]of int64;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n tot:=x[n]-s;\n write(tot);\n exit;\n end;\n if s>x[n] then\n begin\n tot:=s-x[1];\n write(tot);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]s)do begin\n if p[left]>=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if flag=2 then tot:=tot+x[right]-x[left];\n dec(right);\n if flag=2 then flag:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if flag=1 then tot:=tot+x[right]-x[left];\n inc(left);\n if flag=1 then flag:=2;\n end;\n end;\n if x[left]>s then write(tot+x[right]-s)\n else write(tot+s-x[left])\nend.\n", "language": "Pascal", "metadata": {"date": 1530918434, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03366.html", "problem_id": "p03366", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03366/input.txt", "sample_output_relpath": "derived/input_output/data/p03366/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03366/Pascal/s815104759.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s815104759", "user_id": "u658406065"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,s,flag,i,left,right:longint;\n tot:int64;\n x,p:array[1..100000]of int64;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n tot:=x[n]-s;\n write(tot);\n exit;\n end;\n if s>x[n] then\n begin\n tot:=s-x[1];\n write(tot);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]s)do begin\n if p[left]>=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if flag=2 then tot:=tot+x[right]-x[left];\n dec(right);\n if flag=2 then flag:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if flag=1 then tot:=tot+x[right]-x[left];\n inc(left);\n if flag=1 then flag:=2;\n end;\n end;\n if x[left]>s then write(tot+x[right]-s)\n else write(tot+s-x[left])\nend.\n", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "sample_input": "3 2\n1 3\n3 4\n4 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03366", "source_text": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1026, "cpu_time_ms": 31, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s673986182", "group_id": "codeNet:p03366", "input_text": "var n,s,max,i,left,right:longint;\n count:int64;\n x,p:array[1..100000]of int64;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n count:=x[n]-s;\n write(count);\n exit;\n end;\n if s>x[n] then\n begin\n count:=s-x[1];\n write(count);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]s)do begin\n if p[left]>=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n end;\n if x[left]>s then write(count+x[right]-s)\n else write(count+s-x[left])\nend.\n\n", "language": "Pascal", "metadata": {"date": 1530880070, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03366.html", "problem_id": "p03366", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03366/input.txt", "sample_output_relpath": "derived/input_output/data/p03366/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03366/Pascal/s673986182.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s673986182", "user_id": "u719221497"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,s,max,i,left,right:longint;\n count:int64;\n x,p:array[1..100000]of int64;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n count:=x[n]-s;\n write(count);\n exit;\n end;\n if s>x[n] then\n begin\n count:=s-x[1];\n write(count);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]s)do begin\n if p[left]>=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n end;\n if x[left]>s then write(count+x[right]-s)\n else write(count+s-x[left])\nend.\n\n", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "sample_input": "3 2\n1 3\n3 4\n4 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03366", "source_text": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1048, "cpu_time_ms": 31, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s035818763", "group_id": "codeNet:p03366", "input_text": "var n,s,max,i,left,right:longint;\n count:int64;\n x,p:array[1..100000]of longint;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n count:=x[n]-s;\n write(count);\n exit;\n end;\n if s>x[n] then\n begin\n count:=s-x[1];\n write(count);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]s)do begin\n if p[left]>=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n end;\n if x[left]>s then write(count+x[right]-s)\n else write(count+s-x[left])\nend.\n\n", "language": "Pascal", "metadata": {"date": 1530841267, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03366.html", "problem_id": "p03366", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03366/input.txt", "sample_output_relpath": "derived/input_output/data/p03366/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03366/Pascal/s035818763.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s035818763", "user_id": "u719221497"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,s,max,i,left,right:longint;\n count:int64;\n x,p:array[1..100000]of longint;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n count:=x[n]-s;\n write(count);\n exit;\n end;\n if s>x[n] then\n begin\n count:=s-x[1];\n write(count);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]s)do begin\n if p[left]>=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n end;\n if x[left]>s then write(count+x[right]-s)\n else write(count+s-x[left])\nend.\n\n", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "sample_input": "3 2\n1 3\n3 4\n4 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03366", "source_text": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1050, "cpu_time_ms": 32, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s496839236", "group_id": "codeNet:p03366", "input_text": "var n,s,max,i,left,right:longint;\n count:int64;\n x,p:array[1..100000]of longint;\nbegin\n readln(n,s);\n for i:=1 to n do\n begin\n readln(x[i],p[i]);\n end;\n if s<=x[1] then\n begin\n count:=x[n]-s;\n write(count);\n exit;\n end;\n if s>x[n] then\n begin\n count:=s-x[1];\n write(count);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n until(x[left]>s)or(x[right]s then write(count+x[right]-s);\n if x[right]x[n] then\n begin\n count:=s-x[1];\n write(count);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]=p[right] then\n begin\n p[left]:=p[left]+p[right];\n if max=2 then count:=count+x[right]-x[left];\n dec(right);\n if max=2 then max:=1;\n end\n else begin\n p[right]:=p[right]+p[left];\n if max=1 then count:=count+x[right]-x[left];\n inc(left);\n if max=1 then max:=2;\n end;\n until(x[left]>s)or(x[right]s then write(count+x[right]-s);\n if x[right]=p[n] then begin p[1]:=p[1]+p[n]; dec(right);flag:=1;end\n else begin p[n+1]:=p[n]+p[1]; inc(left);flag:=-1;end;\n tot:=tot+x[n]-x[1];\n while (x[left]s) do\n begin\n if p[left]>=p[right] then begin\n p[left]:=p[left]+p[right];\n if flag<>1 then begin tot:=tot+x[right]-x[left]; flag:=1;end;\n dec(right); end\n else begin\n p[right]:=p[left]+p[right];\n if flag<>-1 then begin tot:=tot+x[right]-x[left]; flag:=-1;end;\n inc(left); end;\n end;\n if x[left]>s then writeln(tot+x[right]-s)\n else writeln(tot+s-x[left]);\nend.", "language": "Pascal", "metadata": {"date": 1530839901, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03366.html", "problem_id": "p03366", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03366/input.txt", "sample_output_relpath": "derived/input_output/data/p03366/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03366/Pascal/s125832604.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s125832604", "user_id": "u658406065"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n i,j,flag:longint;\n n,s,left,right,tot:qword;\n p,x:array[1..100000]of qword;\nbegin\n readln(n,s);\n for i:=1 to n do\n readln(x[i],p[i]);\n if s<=x[1] then\n begin\n write(x[n]-s);\n exit;\n end;\n left:=1;\n right:=n;\n if p[1]>=p[n] then begin p[1]:=p[1]+p[n]; dec(right);flag:=1;end\n else begin p[n+1]:=p[n]+p[1]; inc(left);flag:=-1;end;\n tot:=tot+x[n]-x[1];\n while (x[left]s) do\n begin\n if p[left]>=p[right] then begin\n p[left]:=p[left]+p[right];\n if flag<>1 then begin tot:=tot+x[right]-x[left]; flag:=1;end;\n dec(right); end\n else begin\n p[right]:=p[left]+p[right];\n if flag<>-1 then begin tot:=tot+x[right]-x[left]; flag:=-1;end;\n inc(left); end;\n end;\n if x[left]>s then writeln(tot+x[right]-s)\n else writeln(tot+s-x[left]);\nend.", "problem_context": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "sample_input": "3 2\n1 3\n3 4\n4 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03366", "source_text": "Score : 1200 points\n\nProblem Statement\n\nThere are N apartments along a number line, numbered 1 through N.\nApartment i is located at coordinate X_i.\nAlso, the office of AtCoder Inc. is located at coordinate S.\nEvery employee of AtCoder lives in one of the N apartments.\nThere are P_i employees who are living in Apartment i.\n\nAll employees of AtCoder are now leaving the office all together.\nSince they are tired from work, they would like to get home by the company's bus.\nAtCoder owns only one bus, but it can accommodate all the employees.\nThis bus will leave coordinate S with all the employees and move according to the following rule:\n\nEveryone on the bus casts a vote on which direction the bus should proceed, positive or negative. (The bus is autonomous and has no driver.) Each person has one vote, and abstaining from voting is not allowed. Then, the bus moves a distance of 1 in the direction with the greater number of votes. If a tie occurs, the bus moves in the negative direction. If there is an apartment at the coordinate of the bus after the move, all the employees who live there get off.\n\nRepeat the operation above as long as there is one or more employees on the bus.\n\nFor a specific example, see Sample Input 1.\n\nThe bus takes one seconds to travel a distance of 1.\nThe time required to vote and get off the bus is ignorable.\n\nEvery employee will vote so that he himself/she herself can get off the bus at the earliest possible time.\nStrictly speaking, when a vote is taking place, each employee see which direction results in the earlier arrival at his/her apartment, assuming that all the employees follow the same strategy in the future.\nBased on this information, each employee makes the optimal choice, but if either direction results in the arrival at the same time, he/she casts a vote to the negative direction.\n\nFind the time the bus will take from departure to arrival at the last employees' apartment.\nIt can be proved that, given the positions of the apartments, the numbers of employees living in each apartment and the initial position of the bus, the future movement of the bus is uniquely determined, and the process will end in a finite time.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq S \\leq 10^9\n\n1 \\leq X_1 < X_2 < ... < X_N \\leq 10^9\n\nX_i \\neq S ( 1 \\leq i \\leq N )\n\n1 \\leq P_i \\leq 10^9 ( 1 \\leq i \\leq N )\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nX_1 P_1\nX_2 P_2\n:\nX_N P_N\n\nOutput\n\nPrint the number of seconds the bus will take from departure to arrival at the last employees' apartment.\n\nSample Input 1\n\n3 2\n1 3\n3 4\n4 2\n\nSample Output 1\n\n4\n\nAssume that the bus moves in the negative direction first.\nThen, the coordinate of the bus changes from 2 to 1, and the employees living in Apartment 1 get off.\nThe movement of the bus after that is obvious: it just continues moving in the positive direction.\nThus, if the bus moves in the negative direction first, the coordinate of the bus changes as 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 1, 3, 4 seconds, respectively.\n\nNext, assume that the bus moves in the positive direction first.\nThen, the coordinate of the bus changes from 2 to 3, and the employees living in Apartment 2 get off.\nAfterwards, the bus starts heading to Apartment 1, because there are more employees living in Apartment 1 than in Apartment 3.\nThen, after arriving at Apartment 1, the bus heads to Apartment 3.\nThus, if the bus moves in the positive direction first, the coordinate of the bus changes as 2 → 3 → 2 → 1 → 2 → 3 → 4 from departure.\nThe time it takes to get home for the employees living in Apartment 1, 2, 3 are 3, 1, 6 seconds, respectively.\n\nTherefore, in the beginning, the employees living in Apartment 1 or 3 will try to move the bus in the negative direction.\nOn the other hand, the employees living in Apartment 2 will try to move the bus in the positive direction in the beginning.\nThere are a total of 3 + 2 = 5 employees living in Apartment 1 and 3 combined, which is more than those living in Apartment 2, which is 4.\nThus, the bus will move in the negative direction first, and the coordinate of the bus will change as 2 → 1 → 2 → 3 → 4 from departure.\n\nSample Input 2\n\n6 4\n1 10\n2 1000\n3 100000\n5 1000000\n6 10000\n7 100\n\nSample Output 2\n\n21\n\nSince the numbers of employees living in different apartments are literally off by a digit, the bus consistently head to the apartment where the most number of employees on the bus lives.\n\nSample Input 3\n\n15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 124410641\n876731548 12078\n904557302 291749534\n918215789 5\n\nSample Output 3\n\n2397671583", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 899, "cpu_time_ms": 45, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s506651219", "group_id": "codeNet:p03370", "input_text": "var n,m,a,s,i:Longint;\nbegin\n\ts:=round(1e9);\n\tread(n,m);\n\tfor i:=1 to n do\n\tbegin\n\t\tread(a);\n\t\tm:=m-a;\n\t\tif s>a then s:=a;\n\tend;\n\twrite(n+m/s:0:0)\nend.\n", "language": "Pascal", "metadata": {"date": 1533112173, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03370.html", "problem_id": "p03370", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03370/input.txt", "sample_output_relpath": "derived/input_output/data/p03370/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03370/Pascal/s506651219.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s506651219", "user_id": "u657913472"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var n,m,a,s,i:Longint;\nbegin\n\ts:=round(1e9);\n\tread(n,m);\n\tfor i:=1 to n do\n\tbegin\n\t\tread(a);\n\t\tm:=m-a;\n\t\tif s>a then s:=a;\n\tend;\n\twrite(n+m/s:0:0)\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAkaki, a patissier, can make N kinds of doughnut using only a certain powder called \"Okashi no Moto\" (literally \"material of pastry\", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts.\n\nNow, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition:\n\nFor each of the N kinds of doughnuts, make at least one doughnut of that kind.\n\nAt most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition.\n\nConstraints\n\n2 ≤ N ≤ 100\n\n1 ≤ m_i ≤ 1000\n\nm_1 + m_2 + ... + m_N ≤ X ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nm_1\nm_2\n:\nm_N\n\nOutput\n\nPrint the maximum number of doughnuts that can be made under the condition.\n\nSample Input 1\n\n3 1000\n120\n100\n140\n\nSample Output 1\n\n9\n\nShe has 1000 grams of Moto and can make three kinds of doughnuts. If she makes one doughnut for each of the three kinds, she consumes 120 + 100 + 140 = 360 grams of Moto. From the 640 grams of Moto that remains here, she can make additional six Doughnuts 2. This is how she can made a total of nine doughnuts, which is the maximum.\n\nSample Input 2\n\n4 360\n90\n90\n90\n90\n\nSample Output 2\n\n4\n\nMaking one doughnut for each of the four kinds consumes all of her Moto.\n\nSample Input 3\n\n5 3000\n150\n130\n150\n130\n110\n\nSample Output 3\n\n26", "sample_input": "3 1000\n120\n100\n140\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03370", "source_text": "Score : 200 points\n\nProblem Statement\n\nAkaki, a patissier, can make N kinds of doughnut using only a certain powder called \"Okashi no Moto\" (literally \"material of pastry\", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts.\n\nNow, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition:\n\nFor each of the N kinds of doughnuts, make at least one doughnut of that kind.\n\nAt most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition.\n\nConstraints\n\n2 ≤ N ≤ 100\n\n1 ≤ m_i ≤ 1000\n\nm_1 + m_2 + ... + m_N ≤ X ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nm_1\nm_2\n:\nm_N\n\nOutput\n\nPrint the maximum number of doughnuts that can be made under the condition.\n\nSample Input 1\n\n3 1000\n120\n100\n140\n\nSample Output 1\n\n9\n\nShe has 1000 grams of Moto and can make three kinds of doughnuts. If she makes one doughnut for each of the three kinds, she consumes 120 + 100 + 140 = 360 grams of Moto. From the 640 grams of Moto that remains here, she can make additional six Doughnuts 2. This is how she can made a total of nine doughnuts, which is the maximum.\n\nSample Input 2\n\n4 360\n90\n90\n90\n90\n\nSample Output 2\n\n4\n\nMaking one doughnut for each of the four kinds consumes all of her Moto.\n\nSample Input 3\n\n5 3000\n150\n130\n150\n130\n110\n\nSample Output 3\n\n26", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s083744938", "group_id": "codeNet:p03374", "input_text": "Uses math;\nvar\n\tans,L,R,Lmax,Rmax,c:int64;\n\tn,i:Longint;\n\tx,v:array[1..100000]of Longint;\nbegin\n\tread(n,c);\n\tfor i:=1 to n do begin\n\t\tread(x[i],v[i]);\n\t\tinc(L,v[i]);\n\tend;\n\tans:=L-x[n];\n\tfor i:=n downto 1 do begin\n\t\tdec(L,v[i]);\n\t\tinc(R,v[i]);\n\t\tRmax:=Max(Rmax,R-(c-x[i]));\n\t\tif i>1 then ans:=Max(ans,L-x[i-1]*2+Rmax)else ans:=Max(ans,Rmax);\n\tend;\n\tfor i:=1 to n do begin\n\t\tinc(L,v[i]);\n\t\tdec(R,v[i]);\n\t\tLmax:=Max(Lmax,L-x[i]);\n\t\tif i1 then ans:=Max(ans,L-x[i-1]*2+Rmax)else ans:=Max(ans,Rmax);\n\tend;\n\tfor i:=1 to n do begin\n\t\tinc(L,v[i]);\n\t\tdec(R,v[i]);\n\t\tLmax:=Max(Lmax,L-x[i]);\n\t\tif i1 do begin\n\t\tM:=(L+R)div 2;\n\t\tcnt:=0;\n\t\tfor i:=1 to n do if a[i]=c then R:=M else L:=M;\n\tend;\n\tf:=R;\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n do read(a[i]);\n\tma:=f(n div 2);\n\tmb:=f(n div 2-1);\n\tfor i:=1 to n do if a[i]1 do begin\n\t\tM:=(L+R)div 2;\n\t\tcnt:=0;\n\t\tfor i:=1 to n do if a[i]=c then R:=M else L:=M;\n\tend;\n\tf:=R;\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n do read(a[i]);\n\tma:=f(n div 2);\n\tmb:=f(n div 2-1);\n\tfor i:=1 to n do if a[i] a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\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 a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "sample_input": "5\n6 9 4 2 11\n"}, "reference_outputs": ["11 6\n"], "source_document_id": "p03382", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\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 a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 271, "cpu_time_ms": 16, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s995843634", "group_id": "codeNet:p03396", "input_text": "var\n t,x:array[0..300005]of int64;\n n,i:longint;\n l,z,c0,c1,c2:int64;\n f,g:boolean;\nbegin\n readln(n,l);\n for i:=1 to n do\n read(x[i]);\n readln;\n z:=1;\n for i:=1 to n do\n begin\n read(t[i]);\n z:=z+t[i] div (2*l);\n t[i]:=t[i] mod (2*l);\n if t[i]>0 then\n begin\n inc(z);\n f:=false;\n g:=false;\n if t[i]<=(l-x[i])*2 then\n f:=true;\n if t[i]<=x[i]*2 then\n g:=true;\n if i=n then\n begin\n if f then\n dec(z);\n break;\n end;\n if g then\n begin\n inc(c0);\n if f then\n inc(c2);\n end else\n if f then \n inc(c1);\n while c0-c20 then\n dec(c2) else\n dec(c1);\n end;\n end;\n end;\n z:=z-c1-c2;\n writeln(z*2*l);\nend.\n", "language": "Pascal", "metadata": {"date": 1530814463, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03396.html", "problem_id": "p03396", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03396/input.txt", "sample_output_relpath": "derived/input_output/data/p03396/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03396/Pascal/s995843634.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s995843634", "user_id": "u582335028"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n t,x:array[0..300005]of int64;\n n,i:longint;\n l,z,c0,c1,c2:int64;\n f,g:boolean;\nbegin\n readln(n,l);\n for i:=1 to n do\n read(x[i]);\n readln;\n z:=1;\n for i:=1 to n do\n begin\n read(t[i]);\n z:=z+t[i] div (2*l);\n t[i]:=t[i] mod (2*l);\n if t[i]>0 then\n begin\n inc(z);\n f:=false;\n g:=false;\n if t[i]<=(l-x[i])*2 then\n f:=true;\n if t[i]<=x[i]*2 then\n g:=true;\n if i=n then\n begin\n if f then\n dec(z);\n break;\n end;\n if g then\n begin\n inc(c0);\n if f then\n inc(c2);\n end else\n if f then \n inc(c1);\n while c0-c20 then\n dec(c2) else\n dec(c1);\n end;\n end;\n end;\n z:=z-c1-c2;\n writeln(z*2*l);\nend.\n", "problem_context": "Score : 1600 points\n\nProblem Statement\n\nYui loves shopping. She lives in Yamaboshi City and there is a train service in the city. The city can be modelled as a very long number line. Yui's house is at coordinate 0.\n\nThere are N shopping centres in the city, located at coordinates x_{1}, x_{2}, ..., x_{N} respectively. There are N + 2 train stations, one located at coordinate 0, one located at coordinate L, and one located at each shopping centre.\n\nAt time 0, the train departs from position 0 to the positive direction. The train travels at a constant speed of 1 unit per second. At time L, the train will reach the last station, the station at coordinate L. The train immediately moves in the opposite direction at the same speed. At time 2L, the train will reach the station at coordinate 0 and it immediately moves in the opposite direction again. The process repeats indefinitely.\n\nWhen the train arrives at a station where Yui is located, Yui can board or leave the train immediately. At time 0, Yui is at the station at coordinate 0.\n\nYui wants to go shopping in all N shopping centres, in any order, and return home after she finishes her shopping. She needs to shop for t_{i} seconds in the shopping centre at coordinate x_{i}. She must finish her shopping in one shopping centre before moving to the next shopping centre. Yui can immediately start shopping when she reaches a station with a shopping centre and she can immediately board the train when she finishes shopping.\n\nYui wants to spend the minimum amount of time to finish her shopping. Can you help her determine the minimum number of seconds required to complete her shopping?\n\nConstraints\n\n1 \\leq N \\leq 300000\n\n1 \\leq L \\leq 10^{9}\n\n0 < x_{1} < x_{2} < ... < x_{N} < L\n\n1 \\leq t_{i} \\leq 10^{9}\n\nAll values in the input are integers.\n\nPartial Score\n\n1000 points will be awarded for passing the testset satisfying 1 \\leq N \\leq 3000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\nx_{1} x_{2} ... x_{N}\nt_{1} t_{2} ... t_{N}\n\nOutput\n\nPrint the minimum time (in seconds) required for Yui to finish shopping at all N shopping centres and return home.\n\nSample Input 1\n\n2 10\n5 8\n10 4\n\nSample Output 1\n\n40\n\nHere's one possible way for Yui to finish her shopping :\n\nTravel to the station at coordinate 8 with the train. She arrives at coordinate 8 at time 8.\n\nShop in the shopping centre at coordinate 8. She finishes her shopping at time 12.\n\nThe train arrives at coordinate 8 at time 12. She boards the train which is currently moving in the negative direction.\n\nShe arrives at coordinate 5 at time 15. She finishes her shopping at time 25.\n\nThe train arrives at coordinate 5 at time 25. She boards the train which is currently moving in the positive direction.\n\nShe arrives at coordinate L = 10 at time 30. The train starts moving in the negative direction immediately.\n\nShe arrives at coordinate 0 at time 40, ending the trip.\n\nSample Input 2\n\n2 10\n5 8\n10 5\n\nSample Output 2\n\n60\n\nSample Input 3\n\n5 100\n10 19 28 47 68\n200 200 200 200 200\n\nSample Output 3\n\n1200\n\nSample Input 4\n\n8 1000000000\n2018 123456 1719128 1929183 9129198 10100101 77777777 120182018\n99999999 1000000000 1000000000 11291341 1 200 1 123812831\n\nSample Output 4\n\n14000000000\n\nBeware of overflow issues.", "sample_input": "2 10\n5 8\n10 4\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03396", "source_text": "Score : 1600 points\n\nProblem Statement\n\nYui loves shopping. She lives in Yamaboshi City and there is a train service in the city. The city can be modelled as a very long number line. Yui's house is at coordinate 0.\n\nThere are N shopping centres in the city, located at coordinates x_{1}, x_{2}, ..., x_{N} respectively. There are N + 2 train stations, one located at coordinate 0, one located at coordinate L, and one located at each shopping centre.\n\nAt time 0, the train departs from position 0 to the positive direction. The train travels at a constant speed of 1 unit per second. At time L, the train will reach the last station, the station at coordinate L. The train immediately moves in the opposite direction at the same speed. At time 2L, the train will reach the station at coordinate 0 and it immediately moves in the opposite direction again. The process repeats indefinitely.\n\nWhen the train arrives at a station where Yui is located, Yui can board or leave the train immediately. At time 0, Yui is at the station at coordinate 0.\n\nYui wants to go shopping in all N shopping centres, in any order, and return home after she finishes her shopping. She needs to shop for t_{i} seconds in the shopping centre at coordinate x_{i}. She must finish her shopping in one shopping centre before moving to the next shopping centre. Yui can immediately start shopping when she reaches a station with a shopping centre and she can immediately board the train when she finishes shopping.\n\nYui wants to spend the minimum amount of time to finish her shopping. Can you help her determine the minimum number of seconds required to complete her shopping?\n\nConstraints\n\n1 \\leq N \\leq 300000\n\n1 \\leq L \\leq 10^{9}\n\n0 < x_{1} < x_{2} < ... < x_{N} < L\n\n1 \\leq t_{i} \\leq 10^{9}\n\nAll values in the input are integers.\n\nPartial Score\n\n1000 points will be awarded for passing the testset satisfying 1 \\leq N \\leq 3000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\nx_{1} x_{2} ... x_{N}\nt_{1} t_{2} ... t_{N}\n\nOutput\n\nPrint the minimum time (in seconds) required for Yui to finish shopping at all N shopping centres and return home.\n\nSample Input 1\n\n2 10\n5 8\n10 4\n\nSample Output 1\n\n40\n\nHere's one possible way for Yui to finish her shopping :\n\nTravel to the station at coordinate 8 with the train. She arrives at coordinate 8 at time 8.\n\nShop in the shopping centre at coordinate 8. She finishes her shopping at time 12.\n\nThe train arrives at coordinate 8 at time 12. She boards the train which is currently moving in the negative direction.\n\nShe arrives at coordinate 5 at time 15. She finishes her shopping at time 25.\n\nThe train arrives at coordinate 5 at time 25. She boards the train which is currently moving in the positive direction.\n\nShe arrives at coordinate L = 10 at time 30. The train starts moving in the negative direction immediately.\n\nShe arrives at coordinate 0 at time 40, ending the trip.\n\nSample Input 2\n\n2 10\n5 8\n10 5\n\nSample Output 2\n\n60\n\nSample Input 3\n\n5 100\n10 19 28 47 68\n200 200 200 200 200\n\nSample Output 3\n\n1200\n\nSample Input 4\n\n8 1000000000\n2018 123456 1719128 1929183 9129198 10100101 77777777 120182018\n99999999 1000000000 1000000000 11291341 1 200 1 123812831\n\nSample Output 4\n\n14000000000\n\nBeware of overflow issues.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 812, "cpu_time_ms": 100, "memory_kb": 4736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s671594383", "group_id": "codeNet:p03396", "input_text": "var\n t,x:array[0..300005]of int64;\n n,i:longint;\n l,z,c0,c1,c2:int64;\n f,g:boolean;\nbegin\n readln(n,l);\n for i:=1 to n do\n read(x[i]);\n readln;\n z:=1;\n for i:=1 to n do\n begin\n read(t[i]);\n z:=z+t[i] div (2*l);\n t[i]:=t[i] mod (2*l);\n if t[i]>0 then\n begin\n inc(z);\n f:=false;\n g:=false;\n if t[i]<=(l-x[i])*2 then\n f:=true;\n if t[i]<=x[i]*2 then\n g:=true;\n if i=n then\n begin\n if f then\n dec(z);\n break;\n end;\n if g then\n begin\n inc(c0);\n if f then\n inc(c2);\n end else\n inc(c1);\n while c0-c20 then\n dec(c2) else\n dec(c1);\n end;\n end;\n end;\n z:=z-c1-c2;\n writeln(z*2*l);\nend.\n", "language": "Pascal", "metadata": {"date": 1530814130, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03396.html", "problem_id": "p03396", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03396/input.txt", "sample_output_relpath": "derived/input_output/data/p03396/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03396/Pascal/s671594383.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s671594383", "user_id": "u582335028"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "var\n t,x:array[0..300005]of int64;\n n,i:longint;\n l,z,c0,c1,c2:int64;\n f,g:boolean;\nbegin\n readln(n,l);\n for i:=1 to n do\n read(x[i]);\n readln;\n z:=1;\n for i:=1 to n do\n begin\n read(t[i]);\n z:=z+t[i] div (2*l);\n t[i]:=t[i] mod (2*l);\n if t[i]>0 then\n begin\n inc(z);\n f:=false;\n g:=false;\n if t[i]<=(l-x[i])*2 then\n f:=true;\n if t[i]<=x[i]*2 then\n g:=true;\n if i=n then\n begin\n if f then\n dec(z);\n break;\n end;\n if g then\n begin\n inc(c0);\n if f then\n inc(c2);\n end else\n inc(c1);\n while c0-c20 then\n dec(c2) else\n dec(c1);\n end;\n end;\n end;\n z:=z-c1-c2;\n writeln(z*2*l);\nend.\n", "problem_context": "Score : 1600 points\n\nProblem Statement\n\nYui loves shopping. She lives in Yamaboshi City and there is a train service in the city. The city can be modelled as a very long number line. Yui's house is at coordinate 0.\n\nThere are N shopping centres in the city, located at coordinates x_{1}, x_{2}, ..., x_{N} respectively. There are N + 2 train stations, one located at coordinate 0, one located at coordinate L, and one located at each shopping centre.\n\nAt time 0, the train departs from position 0 to the positive direction. The train travels at a constant speed of 1 unit per second. At time L, the train will reach the last station, the station at coordinate L. The train immediately moves in the opposite direction at the same speed. At time 2L, the train will reach the station at coordinate 0 and it immediately moves in the opposite direction again. The process repeats indefinitely.\n\nWhen the train arrives at a station where Yui is located, Yui can board or leave the train immediately. At time 0, Yui is at the station at coordinate 0.\n\nYui wants to go shopping in all N shopping centres, in any order, and return home after she finishes her shopping. She needs to shop for t_{i} seconds in the shopping centre at coordinate x_{i}. She must finish her shopping in one shopping centre before moving to the next shopping centre. Yui can immediately start shopping when she reaches a station with a shopping centre and she can immediately board the train when she finishes shopping.\n\nYui wants to spend the minimum amount of time to finish her shopping. Can you help her determine the minimum number of seconds required to complete her shopping?\n\nConstraints\n\n1 \\leq N \\leq 300000\n\n1 \\leq L \\leq 10^{9}\n\n0 < x_{1} < x_{2} < ... < x_{N} < L\n\n1 \\leq t_{i} \\leq 10^{9}\n\nAll values in the input are integers.\n\nPartial Score\n\n1000 points will be awarded for passing the testset satisfying 1 \\leq N \\leq 3000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\nx_{1} x_{2} ... x_{N}\nt_{1} t_{2} ... t_{N}\n\nOutput\n\nPrint the minimum time (in seconds) required for Yui to finish shopping at all N shopping centres and return home.\n\nSample Input 1\n\n2 10\n5 8\n10 4\n\nSample Output 1\n\n40\n\nHere's one possible way for Yui to finish her shopping :\n\nTravel to the station at coordinate 8 with the train. She arrives at coordinate 8 at time 8.\n\nShop in the shopping centre at coordinate 8. She finishes her shopping at time 12.\n\nThe train arrives at coordinate 8 at time 12. She boards the train which is currently moving in the negative direction.\n\nShe arrives at coordinate 5 at time 15. She finishes her shopping at time 25.\n\nThe train arrives at coordinate 5 at time 25. She boards the train which is currently moving in the positive direction.\n\nShe arrives at coordinate L = 10 at time 30. The train starts moving in the negative direction immediately.\n\nShe arrives at coordinate 0 at time 40, ending the trip.\n\nSample Input 2\n\n2 10\n5 8\n10 5\n\nSample Output 2\n\n60\n\nSample Input 3\n\n5 100\n10 19 28 47 68\n200 200 200 200 200\n\nSample Output 3\n\n1200\n\nSample Input 4\n\n8 1000000000\n2018 123456 1719128 1929183 9129198 10100101 77777777 120182018\n99999999 1000000000 1000000000 11291341 1 200 1 123812831\n\nSample Output 4\n\n14000000000\n\nBeware of overflow issues.", "sample_input": "2 10\n5 8\n10 4\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03396", "source_text": "Score : 1600 points\n\nProblem Statement\n\nYui loves shopping. She lives in Yamaboshi City and there is a train service in the city. The city can be modelled as a very long number line. Yui's house is at coordinate 0.\n\nThere are N shopping centres in the city, located at coordinates x_{1}, x_{2}, ..., x_{N} respectively. There are N + 2 train stations, one located at coordinate 0, one located at coordinate L, and one located at each shopping centre.\n\nAt time 0, the train departs from position 0 to the positive direction. The train travels at a constant speed of 1 unit per second. At time L, the train will reach the last station, the station at coordinate L. The train immediately moves in the opposite direction at the same speed. At time 2L, the train will reach the station at coordinate 0 and it immediately moves in the opposite direction again. The process repeats indefinitely.\n\nWhen the train arrives at a station where Yui is located, Yui can board or leave the train immediately. At time 0, Yui is at the station at coordinate 0.\n\nYui wants to go shopping in all N shopping centres, in any order, and return home after she finishes her shopping. She needs to shop for t_{i} seconds in the shopping centre at coordinate x_{i}. She must finish her shopping in one shopping centre before moving to the next shopping centre. Yui can immediately start shopping when she reaches a station with a shopping centre and she can immediately board the train when she finishes shopping.\n\nYui wants to spend the minimum amount of time to finish her shopping. Can you help her determine the minimum number of seconds required to complete her shopping?\n\nConstraints\n\n1 \\leq N \\leq 300000\n\n1 \\leq L \\leq 10^{9}\n\n0 < x_{1} < x_{2} < ... < x_{N} < L\n\n1 \\leq t_{i} \\leq 10^{9}\n\nAll values in the input are integers.\n\nPartial Score\n\n1000 points will be awarded for passing the testset satisfying 1 \\leq N \\leq 3000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\nx_{1} x_{2} ... x_{N}\nt_{1} t_{2} ... t_{N}\n\nOutput\n\nPrint the minimum time (in seconds) required for Yui to finish shopping at all N shopping centres and return home.\n\nSample Input 1\n\n2 10\n5 8\n10 4\n\nSample Output 1\n\n40\n\nHere's one possible way for Yui to finish her shopping :\n\nTravel to the station at coordinate 8 with the train. She arrives at coordinate 8 at time 8.\n\nShop in the shopping centre at coordinate 8. She finishes her shopping at time 12.\n\nThe train arrives at coordinate 8 at time 12. She boards the train which is currently moving in the negative direction.\n\nShe arrives at coordinate 5 at time 15. She finishes her shopping at time 25.\n\nThe train arrives at coordinate 5 at time 25. She boards the train which is currently moving in the positive direction.\n\nShe arrives at coordinate L = 10 at time 30. The train starts moving in the negative direction immediately.\n\nShe arrives at coordinate 0 at time 40, ending the trip.\n\nSample Input 2\n\n2 10\n5 8\n10 5\n\nSample Output 2\n\n60\n\nSample Input 3\n\n5 100\n10 19 28 47 68\n200 200 200 200 200\n\nSample Output 3\n\n1200\n\nSample Input 4\n\n8 1000000000\n2018 123456 1719128 1929183 9129198 10100101 77777777 120182018\n99999999 1000000000 1000000000 11291341 1 200 1 123812831\n\nSample Output 4\n\n14000000000\n\nBeware of overflow issues.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 795, "cpu_time_ms": 100, "memory_kb": 4736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s174641934", "group_id": "codeNet:p03403", "input_text": "Var a,f,g:Array[0 .. 1000000] of Longint;\n i,n:Longint;\nBegin\n Readln(n); For i:=1 to n do read(a[i]); f[0]:=0; g[n+1]:=0;\n For i:=1 to n do f[i]:=f[i-1]+abs(a[i]-a[i-1]);\n For i:=n downto 1 do g[i]:=g[i+1]+abs(a[i+1]-a[i]);\n For i:=1 to n do writeln(f[i-1]+g[i+1]+abs(a[i+1]-a[i-1]));\nEnd.", "language": "Pascal", "metadata": {"date": 1545435692, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03403.html", "problem_id": "p03403", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03403/input.txt", "sample_output_relpath": "derived/input_output/data/p03403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03403/Pascal/s174641934.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s174641934", "user_id": "u089230684"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "Var a,f,g:Array[0 .. 1000000] of Longint;\n i,n:Longint;\nBegin\n Readln(n); For i:=1 to n do read(a[i]); f[0]:=0; g[n+1]:=0;\n For i:=1 to n do f[i]:=f[i-1]+abs(a[i]-a[i-1]);\n For i:=n downto 1 do g[i]:=g[i+1]+abs(a[i+1]-a[i]);\n For i:=1 to n do writeln(f[i-1]+g[i+1]+abs(a[i+1]-a[i-1]));\nEnd.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03403", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 305, "cpu_time_ms": 35, "memory_kb": 9600}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s096561417", "group_id": "codeNet:p03403", "input_text": "var\n ans,n,i:longint;\n a:array[0..100010] of longint;\nbegin\n readln(n);\n a[0]:=0;a[n+1]:=0;\n for i:=1 to n do\n begin \n read(a[i]);\n ans:=ans+abs(a[i]-a[i-1]);\n end;\n ans:=ans+abs(a[n]);\n for i:=1 to n do\n writeln(ans-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]));\nend.", "language": "Pascal", "metadata": {"date": 1529710487, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03403.html", "problem_id": "p03403", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03403/input.txt", "sample_output_relpath": "derived/input_output/data/p03403/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03403/Pascal/s096561417.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s096561417", "user_id": "u960852022"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "var\n ans,n,i:longint;\n a:array[0..100010] of longint;\nbegin\n readln(n);\n a[0]:=0;a[n+1]:=0;\n for i:=1 to n do\n begin \n read(a[i]);\n ans:=ans+abs(a[i]-a[i-1]);\n end;\n ans:=ans+abs(a[n]);\n for i:=1 to n do\n writeln(ans-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03403", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (1 \\leq i \\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 33, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s330467006", "group_id": "codeNet:p03413", "input_text": "var n:longint;\n i,k:longint;\n a,b,c,d:array[0..201000]of longint;\n m0,m1:longint;\n ans:int64;\nprocedure qs(l,r:longint);\nvar i,j,m,t:longint;\nbegin\n i:=l;\n j:=r;\n m:=c[(l+r)>>1];\n repeat\n while c[i]m do dec(j);\n if i<=j then\n begin\n t:=c[i];c[i]:=c[j];c[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l>1;\n if c[m]b[i] then inc(need,(a[i]-b[i])) else inc(have,(b[i]-a[i]) div 2);\n if have>=need then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1517717697, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03438.html", "problem_id": "p03438", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03438/input.txt", "sample_output_relpath": "derived/input_output/data/p03438/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03438/Pascal/s748399880.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s748399880", "user_id": "u809476955"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var n:longint;\n i:longint;\n a,b:Array[0..15000]of int64;\n need,have:int64;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n for i:=1 to n do\n read(b[i]);\n for i:=1 to n do\n if a[i]>b[i] then inc(need,(a[i]-b[i])) else inc(have,(b[i]-a[i]) div 2);\n if have>=need then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.\nDetermine if we can repeat the following operation zero or more times so that the sequences a and b become equal.\n\nOperation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:\n\nAdd 2 to a_i.\n\nAdd 1 to b_j.\n\nConstraints\n\n1 ≤ N ≤ 10 000\n\n0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\nb_1 b_2 .. b_N\n\nOutput\n\nIf we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 2 3\n5 2 2\n\nSample Output 1\n\nYes\n\nFor example, we can perform three operations as follows to do our job:\n\nFirst operation: i=1 and j=2. Now we have a = \\{3,2,3\\}, b = \\{5,3,2\\}.\n\nSecond operation: i=1 and j=2. Now we have a = \\{5,2,3\\}, b = \\{5,4,2\\}.\n\nThird operation: i=2 and j=3. Now we have a = \\{5,4,3\\}, b = \\{5,4,3\\}.\n\nSample Input 2\n\n5\n3 1 4 1 5\n2 7 1 8 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n2 7 1 8 2\n3 1 4 1 5\n\nSample Output 3\n\nNo", "sample_input": "3\n1 2 3\n5 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03438", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.\nDetermine if we can repeat the following operation zero or more times so that the sequences a and b become equal.\n\nOperation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:\n\nAdd 2 to a_i.\n\nAdd 1 to b_j.\n\nConstraints\n\n1 ≤ N ≤ 10 000\n\n0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\nb_1 b_2 .. b_N\n\nOutput\n\nIf we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 2 3\n5 2 2\n\nSample Output 1\n\nYes\n\nFor example, we can perform three operations as follows to do our job:\n\nFirst operation: i=1 and j=2. Now we have a = \\{3,2,3\\}, b = \\{5,3,2\\}.\n\nSecond operation: i=1 and j=2. Now we have a = \\{5,2,3\\}, b = \\{5,4,2\\}.\n\nThird operation: i=2 and j=3. Now we have a = \\{5,4,3\\}, b = \\{5,4,3\\}.\n\nSample Input 2\n\n5\n3 1 4 1 5\n2 7 1 8 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n5\n2 7 1 8 2\n3 1 4 1 5\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 322, "cpu_time_ms": 4, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s451915510", "group_id": "codeNet:p03440", "input_text": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..10000]of longint;\n p:array[0..10000]of node;\n heap:array[0..10000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n //writeln(x);\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end else\n if (qwq>1)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n end;\n if totin>0 then\n begin\n x:=heap[1,1];\n if qwq>2 then inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1517728203, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03440.html", "problem_id": "p03440", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03440/input.txt", "sample_output_relpath": "derived/input_output/data/p03440/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03440/Pascal/s451915510.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s451915510", "user_id": "u809476955"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "type\n node=record\n num,id:longint;\n end;\nvar father,num,now,first:array[0..10000]of longint;\n p:array[0..10000]of node;\n heap:array[0..10000,0..2]of longint;\n i:longint;\n x,y:longint;\n n,m:longint;\n totin,totout:longint;\n qwq,ans,have:int64;\n\nfunction getfather(x:longint):longint;\nbegin\n if father[x]=x then exit(x) else\n begin\n father[x]:=getfather(father[x]);\n getfather:=father[x];\n end;\nend;\nprocedure adde(x,y:longint);\nvar fx,fy:longint;\nbegin\n fx:=getfather(x);\n fy:=getfather(y);\n if fx<>fy then\n begin\n father[fx]:=fy;\n inc(num[fy],num[fx]);\n end;\nend;\nprocedure qs(l,r:longint);\nvar i,j:longint;\n t,m:node;\nbegin\n i:=l;\n j:=r;\n m:=p[(l+r)>>1];\n repeat\n while (p[i].idm.id)or((p[j].id=m.id)and(p[j].num>m.num)) do dec(j);\n if i<=j then\n begin\n t:=p[i];p[i]:=p[j];p[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l1 do\n begin\n //writeln(heap[x,bool],'qwq');\n if p[now[heap[x,bool]]].num>1,bool]]].num then\n begin\n swap(heap[x,bool],heap[x>>1,bool]);\n x:=x>>1;\n end else break;\n end;\nend;\nprocedure down(x,bool:longint);\nvar min,tot:longint;\nbegin\n if bool=1 then tot:=totin else tot:=totout;\n while x*2<=tot do\n begin\n min:=x*2;\n if (x*2+1<=tot)and\n (p[now[heap[x*2+1,bool]]].nump[now[heap[min,bool]]].num) then\n begin\n swap(heap[x,bool],heap[min,bool]);\n x:=min;\n end else break;\n end;\nend;\nbegin\n read(n,m);\n for i:=1 to n do\n begin\n read(p[i].num);\n father[i]:=i;\n num[i]:=1;\n end;\n for i:=1 to m do\n begin\n read(x,y);\n inc(x);\n inc(y);\n adde(x,y);\n end;\n for i:=1 to n do\n p[i].id:=getfather(i);\n qs(1,n);\n p[0].num:=maxlongint;\n i:=1;\n while i<=n do\n begin\n inc(ans,p[i].num);\n if num[p[i].id]>1 then\n begin\n now[p[i].id]:=i+1;\n inc(have,num[p[i].id]);\n dec(have);\n end else\n begin\n now[p[i].id]:=0;\n dec(have);\n end;\n inc(totout);\n heap[totout,0]:=p[i].id;\n up(totout,0);\n first[p[i].id]:=i;\n i:=i+num[p[i].id];\n end;\n if totout=1 then\n begin\n writeln(0);\n exit;\n end;\n inc(have);\n if have<0 then\n begin\n writeln('Impossible');\n exit;\n end;\n while totout>0 do\n begin\n inc(qwq);\n x:=heap[1,0];\n //writeln(x);\n if now[x]<>0 then\n begin\n inc(totin);\n heap[totin,1]:=x;\n up(totin,1);\n end else\n if (qwq>1)and(totin>0) then\n begin\n x:=heap[1,1];\n inc(ans,p[now[x]].num);\n end;\n if totin>0 then\n begin\n x:=heap[1,1];\n if qwq>2 then inc(ans,p[now[x]].num);\n inc(now[x]);\n if (now[x]>=first[x]+num[x]) then\n begin\n now[x]:=0;\n heap[1,1]:=heap[totin,1];\n dec(totin);\n end;\n if totin>0 then down(1,1);\n end;\n heap[1,0]:=heap[totout,0];\n dec(totout);\n down(1,0);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "sample_input": "7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03440", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given a forest with N vertices and M edges. The vertices are numbered 0 through N-1.\nThe edges are given in the format (x_i,y_i), which means that Vertex x_i and y_i are connected by an edge.\n\nEach vertex i has a value a_i.\nYou want to add edges in the given forest so that the forest becomes connected.\nTo add an edge, you choose two different vertices i and j, then span an edge between i and j.\nThis operation costs a_i + a_j dollars, and afterward neither Vertex i nor j can be selected again.\n\nFind the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nConstraints\n\n1 ≤ N ≤ 100,000\n\n0 ≤ M ≤ N-1\n\n1 ≤ a_i ≤ 10^9\n\n0 ≤ x_i,y_i ≤ N-1\n\nThe given graph is a forest.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_0 a_1 .. a_{N-1}\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the minimum total cost required to make the forest connected, or print Impossible if it is impossible.\n\nSample Input 1\n\n7 5\n1 2 3 4 5 6 7\n3 0\n4 0\n1 2\n1 3\n5 6\n\nSample Output 1\n\n7\n\nIf we connect vertices 0 and 5, the graph becomes connected, for the cost of 1 + 6 = 7 dollars.\n\nSample Input 2\n\n5 0\n3 1 4 1 5\n\nSample Output 2\n\nImpossible\n\nWe can't make the graph connected.\n\nSample Input 3\n\n1 0\n5\n\nSample Output 3\n\n0\n\nThe graph is already connected, so we do not need to add any edges.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3206, "cpu_time_ms": 101, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s729663207", "group_id": "codeNet:p03457", "input_text": "var\n n,i,t,x,y:longint;\n p:boolean;\nbegin\n readln(n);\n p:=true;\n for i:=1 to n do\n begin\n readln(t,x,y);\n if not(((((x+y) mod 2=0)and(t mod 2=0))or(((x+y) mod 2=1)and(t mod 2=1)))and(t>=x+y)) then begin p:=false;write('No');break;end;\n end;\n if p then write('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1586461595, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s729663207.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s729663207", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,t,x,y:longint;\n p:boolean;\nbegin\n readln(n);\n p:=true;\n for i:=1 to n do\n begin\n readln(t,x,y);\n if not(((((x+y) mod 2=0)and(t mod 2=0))or(((x+y) mod 2=1)and(t mod 2=1)))and(t>=x+y)) then begin p:=false;write('No');break;end;\n end;\n if p then write('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 28, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s023904986", "group_id": "codeNet:p03457", "input_text": "var\n n,i,t,x,y:longint;\n p:boolean;\nbegin\n readln(n);\n p:=true;\n for i:=1 to n do\n begin\n readln(t,x,y);\n if not((((x+y) mod 2=0)and(t mod 2=0))or(((x+y) mod 2=1)and(t mod 2=1))) then begin p:=false;write('NO');break;end;\n end;\n if p then write('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1586461208, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s023904986.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s023904986", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,t,x,y:longint;\n p:boolean;\nbegin\n readln(n);\n p:=true;\n for i:=1 to n do\n begin\n readln(t,x,y);\n if not((((x+y) mod 2=0)and(t mod 2=0))or(((x+y) mod 2=1)and(t mod 2=1))) then begin p:=false;write('NO');break;end;\n end;\n if p then write('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 271, "cpu_time_ms": 28, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s526820597", "group_id": "codeNet:p03457", "input_text": "var\n n,i,a,b,t,x,y:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:=1 to n do\n begin\n read(t,a,b);\n if (abs(x-a)+abs(y-b)>t) or ((abs(x-a)+abs(y-b)-t) mod 2=1) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1543787886, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s526820597.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s526820597", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,a,b,t,x,y:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:=1 to n do\n begin\n read(t,a,b);\n if (abs(x-a)+abs(y-b)>t) or ((abs(x-a)+abs(y-b)-t) mod 2=1) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 298, "cpu_time_ms": 27, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s803815654", "group_id": "codeNet:p03457", "input_text": "var\n n,i,t,x,y:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(t,x,y);\n if x+y>t then\n begin\n writeln('No');\n halt;\n end;\n if ((x+y) mod 2=0) and (odd(t)) then\n begin\n writeln('No');\n halt;\n end;\n if ((x+y) mod 2=1) and (t mod 2=0) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1540766733, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s803815654.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s803815654", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,t,x,y:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(t,x,y);\n if x+y>t then\n begin\n writeln('No');\n halt;\n end;\n if ((x+y) mod 2=0) and (odd(t)) then\n begin\n writeln('No');\n halt;\n end;\n if ((x+y) mod 2=1) and (t mod 2=0) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 29, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s781818228", "group_id": "codeNet:p03457", "input_text": "var\n n,x,y,t,x1,y1,t1,i,s:longint;\nbegin\n readln(n);\n x:=0; y:=0;\n for i:= 1 to n do\n begin\n readln(t1,x1,y1);\n if (x=x1)and(y=y1)then begin writeln('No'); exit; end;\n if abs(x-x1)+abs(y-y1)=t1-t then begin x:=x1;y:=y1;t:=t1;end\n else\n begin\n if abs(x-x1)+abs(y-y1)t) or ((a+b-t) div 2=1) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1526178294, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s969984535.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s969984535", "user_id": "u723721005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,a,b,t:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(t,a,b);\n if (a+b>t) or ((a+b-t) div 2=1) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 250, "cpu_time_ms": 26, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s134242584", "group_id": "codeNet:p03457", "input_text": "var\n n,i,a,b,t:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(t,a,b);\n if a+b>t then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1526178214, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Pascal/s134242584.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s134242584", "user_id": "u426964396"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,i,a,b,t:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(t,a,b);\n if a+b>t then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 227, "cpu_time_ms": 26, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s639440799", "group_id": "codeNet:p03458", "input_text": "uses math;\nvar n,k,i,j,sum,m,ans,x,y:longint;\nvar bs,ws,b1,w1:array[-10..2020,-10..2020] of longint;\nvar c,c1:char;\nfunction gsw(x1,y1,x2,y2:longint):longint;\nbegin\n exit(ws[x2,y2]-ws[x2,y1-1]-ws[x1-1,y2]+ws[x1-1,y1-1]);\nend;\nfunction gsb(x1,y1,x2,y2:longint):longint;\nbegin\n exit(bs[x2,y2]-bs[x2,y1-1]-bs[x1-1,y2]+bs[x1-1,y1-1]);\nend;\nbegin\n fillchar(bs,sizeof(bs),0);fillchar(ws,sizeof(ws),0);\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x,y,c,c1);x:=x mod (2*k);y:=y mod (2*k);\n if c1='B' then inc(b1[x,y]) else inc(w1[x,y]);\n end;\n for i:=1 to 2*k do\n for j:=1 to 2*k do\n begin\n bs[i,j]:=b1[i,j]+bs[i-1,j]+bs[i,j-1]-bs[i-1,j-1];\n ws[i,j]:=w1[i,j]+ws[i-1,j]+ws[i,j-1]-ws[i-1,j-1];\n end;\n ans:=0;\n for i:=1 to 2*k do\n for j:=1 to 2*k do\n begin\n {sumw:=ws[i-k+1,k-j]-ws[i-k+1-k,k+j]-ws[i-k+1,k-j-k]+ws[i-k+1-k,k-j-k]+\n //ws[i-k+1,2*k-j+1+k-1]-ws[i-k+1,2*k-j]-ws[i-k+1-k,3*k-j]+ws[i+1,2*k-j-1]+\n ws[i-k+1,3*k-i-1]-ws[i-k+1-k,3*k-i-1]-ws[i-k+1,2*k-i-1]+ws[i-2*k+1,2*k-i-1]+\n ws[i+1,2*k-j]-ws[i+1-k,2*k-j]-ws[i+1,2*k-j]+ws[i+1-k,2*k-j-j]+\n ws[k+i+1,2*k-i+1]-ws[i+1,2*k-i+1]-ws[k+i+1,k-i+1]+ws[i+1,k-i+1]+\n ws[k+i+1,k-i]-ws[i+1,k-i]-ws[k+i+1,-i]+ws[i+1,-i];\n sumb:=bs[ }\n sum:=0;\n inc(sum,gsw(1,1,i-1,j-1));\n inc(sum,gsw(1,j+k,i-1,2*k));\n inc(sum,gsw(i+k,1,2*k,j-1));\n inc(sum,gsw(i,j,i+k-1,j+k-1));\n inc(sum,gsw(i+k,j+k,2*k,2*k));\n inc(sum,gsb(1,j,i-1,j+k-1));\n inc(sum,gsb(i,1,i+k-1,j-1));\n inc(sum,gsb(i,j+k,i+k-1,2*k));\n inc(sum,gsb(i+k,j,2*k,j+k-1));\n ans:=max(ans,sum);sum:=0;\n inc(sum,gsb(1,1,i-1,j-1));\n inc(sum,gsb(1,j+k,i-1,2*k));\n inc(sum,gsb(i+k,1,2*k,j-1));\n inc(sum,gsb(i,j,i+k-1,j+k-1));\n inc(sum,gsb(i+k,j+k,2*k,2*k));\n inc(sum,gsw(1,j,i-1,j+k-1));\n inc(sum,gsw(i,1,i+k-1,j-1));\n inc(sum,gsw(i,j+k,i+k-1,2*k));\n inc(sum,gsw(i+k,j,2*k,j+k-1));\n ans:=max(ans,sum);\n //writeln(sum);\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516592855, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s639440799.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s639440799", "user_id": "u379604713"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "uses math;\nvar n,k,i,j,sum,m,ans,x,y:longint;\nvar bs,ws,b1,w1:array[-10..2020,-10..2020] of longint;\nvar c,c1:char;\nfunction gsw(x1,y1,x2,y2:longint):longint;\nbegin\n exit(ws[x2,y2]-ws[x2,y1-1]-ws[x1-1,y2]+ws[x1-1,y1-1]);\nend;\nfunction gsb(x1,y1,x2,y2:longint):longint;\nbegin\n exit(bs[x2,y2]-bs[x2,y1-1]-bs[x1-1,y2]+bs[x1-1,y1-1]);\nend;\nbegin\n fillchar(bs,sizeof(bs),0);fillchar(ws,sizeof(ws),0);\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x,y,c,c1);x:=x mod (2*k);y:=y mod (2*k);\n if c1='B' then inc(b1[x,y]) else inc(w1[x,y]);\n end;\n for i:=1 to 2*k do\n for j:=1 to 2*k do\n begin\n bs[i,j]:=b1[i,j]+bs[i-1,j]+bs[i,j-1]-bs[i-1,j-1];\n ws[i,j]:=w1[i,j]+ws[i-1,j]+ws[i,j-1]-ws[i-1,j-1];\n end;\n ans:=0;\n for i:=1 to 2*k do\n for j:=1 to 2*k do\n begin\n {sumw:=ws[i-k+1,k-j]-ws[i-k+1-k,k+j]-ws[i-k+1,k-j-k]+ws[i-k+1-k,k-j-k]+\n //ws[i-k+1,2*k-j+1+k-1]-ws[i-k+1,2*k-j]-ws[i-k+1-k,3*k-j]+ws[i+1,2*k-j-1]+\n ws[i-k+1,3*k-i-1]-ws[i-k+1-k,3*k-i-1]-ws[i-k+1,2*k-i-1]+ws[i-2*k+1,2*k-i-1]+\n ws[i+1,2*k-j]-ws[i+1-k,2*k-j]-ws[i+1,2*k-j]+ws[i+1-k,2*k-j-j]+\n ws[k+i+1,2*k-i+1]-ws[i+1,2*k-i+1]-ws[k+i+1,k-i+1]+ws[i+1,k-i+1]+\n ws[k+i+1,k-i]-ws[i+1,k-i]-ws[k+i+1,-i]+ws[i+1,-i];\n sumb:=bs[ }\n sum:=0;\n inc(sum,gsw(1,1,i-1,j-1));\n inc(sum,gsw(1,j+k,i-1,2*k));\n inc(sum,gsw(i+k,1,2*k,j-1));\n inc(sum,gsw(i,j,i+k-1,j+k-1));\n inc(sum,gsw(i+k,j+k,2*k,2*k));\n inc(sum,gsb(1,j,i-1,j+k-1));\n inc(sum,gsb(i,1,i+k-1,j-1));\n inc(sum,gsb(i,j+k,i+k-1,2*k));\n inc(sum,gsb(i+k,j,2*k,j+k-1));\n ans:=max(ans,sum);sum:=0;\n inc(sum,gsb(1,1,i-1,j-1));\n inc(sum,gsb(1,j+k,i-1,2*k));\n inc(sum,gsb(i+k,1,2*k,j-1));\n inc(sum,gsb(i,j,i+k-1,j+k-1));\n inc(sum,gsb(i+k,j+k,2*k,2*k));\n inc(sum,gsw(1,j,i-1,j+k-1));\n inc(sum,gsw(i,1,i+k-1,j-1));\n inc(sum,gsw(i,j+k,i+k-1,2*k));\n inc(sum,gsw(i+k,j,2*k,j+k-1));\n ans:=max(ans,sum);\n //writeln(sum);\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2042, "cpu_time_ms": 421, "memory_kb": 64512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s377973841", "group_id": "codeNet:p03458", "input_text": "var i,j,n,tmp3,x1,y1,x2,y2,k,ans,tmp5:longint;\n x,y:array[1..200000]of longint;\n c,c2:array[-10..4000,-10..4000]of longint;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1516591498, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Pascal/s377973841.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s377973841", "user_id": "u453186518"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var i,j,n,tmp3,x1,y1,x2,y2,k,ans,tmp5:longint;\n x,y:array[1..200000]of longint;\n c,c2:array[-10..4000,-10..4000]of longint;\n tmp,tmp2:char;\nbegin\n readln(n,k);\n for i:=1 to n do\n begin\n readln(x[i],y[i],tmp,tmp2);\n x[i]:=x[i] mod (k*2);\n y[i]:=y[i] mod (k*2);\n if tmp2='B' then\n begin\n if x[i]>=k then x[i]:=x[i]-k\n else x[i]:=x[i]+k;\n end;\n inc(c[x[i],y[i]]);\n end;\n for i:=0 to k*2-1 do\n for j:=0 to k*2-1 do\n c2[i,j]:=c2[i-1,j]+c2[i,j-1]+c[i,j]-c2[i-1,j-1];\n for i:=0 to k do\n for j:=0 to k do\n begin\n x1:=i-1;\n y1:=j-1;\n x2:=i+k-1;\n y2:=j+k-1;\n tmp5:=c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1];\n if (i<>0) and (j<>0) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>0) and (j<>k) then\n begin\n x1:=-1;\n x2:=i-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>0) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=-1;\n y2:=j-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if (i<>k) and (j<>k) then\n begin\n x1:=i+k-1;\n x2:=k*2-1;\n y1:=j+k-1;\n y2:=k*2-1;\n tmp5:=tmp5+c2[x2,y2]-c2[x1,y2]-c2[x2,y1]+c2[x1,y1]; end;\n if tmp5>ans then ans:=tmp5;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1424, "cpu_time_ms": 100, "memory_kb": 66560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s387352328", "group_id": "codeNet:p03464", "input_text": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=max*2-1;\n if max+a[i+1]-1max then\n begin\n writeln(-1);\n exit;\n end;\n end;\n writeln(min,' ',max+a[1]-1);\nend.\n//or(((max+a[i+1]-1) div a[i])-((max-1) div a[i])=0)", "language": "Pascal", "metadata": {"date": 1515994368, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Pascal/s387352328.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s387352328", "user_id": "u809476955"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=max*2-1;\n if max+a[i+1]-1max then\n begin\n writeln(-1);\n exit;\n end;\n end;\n writeln(min,' ',max+a[1]-1);\nend.\n//or(((max+a[i+1]-1) div a[i])-((max-1) div a[i])=0)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 19, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s953612987", "group_id": "codeNet:p03464", "input_text": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=max*2-1;\n if max+a[i+1]-12 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=max*2-1;\n if max+a[i+1]-12 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n //writeln(((max+a[i+1]-1) div a[i])-((max-1) div a[i]));\n if (x=0)or(((max+a[i+1]-1) div a[i])-((max-1) div a[i])=0) then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=x*a[i] else min:=(x+1)*a[i];\n end;\n writeln(min,' ',max+a[1]-1);\nend.", "language": "Pascal", "metadata": {"date": 1515991511, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Pascal/s935478745.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s935478745", "user_id": "u809476955"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n //writeln(((max+a[i+1]-1) div a[i])-((max-1) div a[i]));\n if (x=0)or(((max+a[i+1]-1) div a[i])-((max-1) div a[i])=0) then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=x*a[i] else min:=(x+1)*a[i];\n end;\n writeln(min,' ',max+a[1]-1);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 19, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s478859057", "group_id": "codeNet:p03464", "input_text": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n if x=0 then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=x*a[i] else min:=(x+1)*a[i];\n end;\n writeln(min,' ',max+a[1]-1);\nend.", "language": "Pascal", "metadata": {"date": 1515989737, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Pascal/s478859057.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s478859057", "user_id": "u809476955"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n if x=0 then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=x*a[i] else min:=(x+1)*a[i];\n end;\n writeln(min,' ',max+a[1]-1);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 493, "cpu_time_ms": 19, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s527268505", "group_id": "codeNet:p03464", "input_text": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n if x=0 then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=a[i] else min:=(x+1)*a[i];\n end;\n writeln(min,' ',max+a[1]-1);\nend.", "language": "Pascal", "metadata": {"date": 1515989554, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Pascal/s527268505.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s527268505", "user_id": "u809476955"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "var n:longint;\n max,x,min:int64;\n a:array[0..150000]of longint;\n i:longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n if a[n]<>2 then\n begin\n writeln(-1);\n exit;\n end;\n a[0]:=1;\n max:=2;\n min:=2;\n for i:=n-1 downto 1 do\n begin\n x:=(max*2-1) div a[i];\n if x=0 then\n begin\n writeln(-1);\n exit;\n end else max:=x*a[i];\n x:=min div a[i];\n if min mod a[i]=0 then min:=a[i] else min:=(x+1)*a[i];\n end;\n writeln(min,' ',max+a[1]-1);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 19, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s442631297", "group_id": "codeNet:p03470", "input_text": "program ABC085B;\n{$mode Delphi}\nuses SysUtils,fgl;\nvar\n\tn,i,r: longint;\n\tarr: TFPGMap;\nbegin\n\tread(n);\n\tarr:=TFPGMap.Create();\n\tfor i:=0 to n-1 do begin\n\t\tread(r);\n\t\t// arr.AddOrSetData(r,1); // AtCoderでは使用不可\n\t\tarr.Remove(r);\n\t\tarr.Add(r,1);\n\tend;\n\twriteln(arr.Count);\nend.\n", "language": "Pascal", "metadata": {"date": 1522278745, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03470.html", "problem_id": "p03470", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03470/input.txt", "sample_output_relpath": "derived/input_output/data/p03470/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03470/Pascal/s442631297.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s442631297", "user_id": "u280667879"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program ABC085B;\n{$mode Delphi}\nuses SysUtils,fgl;\nvar\n\tn,i,r: longint;\n\tarr: TFPGMap;\nbegin\n\tread(n);\n\tarr:=TFPGMap.Create();\n\tfor i:=0 to n-1 do begin\n\t\tread(r);\n\t\t// arr.AddOrSetData(r,1); // AtCoderでは使用不可\n\t\tarr.Remove(r);\n\t\tarr.Add(r,1);\n\tend;\n\twriteln(arr.Count);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "sample_input": "4\n10\n8\n8\n6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03470", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s838179335", "group_id": "codeNet:p03470", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,i,j,temp,min:Integer;\n d:array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n SetLength(d,n);\n for i:=0 to n-1 do\n Readln(d[i]);\n\n for i := 0 to n-1 do begin\n min := i;\n for j := i+1 to n-1 do begin\n if d[j] < d[min] then\n min := j;\n end;\n temp:=d[i];\n d[i]:=d[min];\n d[min]:=temp;\n end;\n\n for i := 0 to n - 2 do begin\n if d[i]=d[i+1] then\n n:=n-1;\n end;\n\n Writeln(n);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,i,j,temp,min:Integer;\n d:array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n SetLength(d,n);\n for i:=0 to n-1 do\n Readln(d[i]);\n\n for i := 0 to n-1 do begin\n min := i;\n for j := i+1 to n-1 do begin\n if d[j] < d[min] then\n min := j;\n end;\n temp:=d[i];\n d[i]:=d[min];\n d[min]:=temp;\n end;\n\n for i := 0 to n - 2 do begin\n if d[i]=d[i+1] then\n n:=n-1;\n end;\n\n Writeln(n);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1515378876, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03470.html", "problem_id": "p03470", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03470/input.txt", "sample_output_relpath": "derived/input_output/data/p03470/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03470/Pascal/s838179335.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s838179335", "user_id": "u755925739"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,i,j,temp,min:Integer;\n d:array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n SetLength(d,n);\n for i:=0 to n-1 do\n Readln(d[i]);\n\n for i := 0 to n-1 do begin\n min := i;\n for j := i+1 to n-1 do begin\n if d[j] < d[min] then\n min := j;\n end;\n temp:=d[i];\n d[i]:=d[min];\n d[min]:=temp;\n end;\n\n for i := 0 to n - 2 do begin\n if d[i]=d[i+1] then\n n:=n-1;\n end;\n\n Writeln(n);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,i,j,temp,min:Integer;\n d:array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n SetLength(d,n);\n for i:=0 to n-1 do\n Readln(d[i]);\n\n for i := 0 to n-1 do begin\n min := i;\n for j := i+1 to n-1 do begin\n if d[j] < d[min] then\n min := j;\n end;\n temp:=d[i];\n d[i]:=d[min];\n d[min]:=temp;\n end;\n\n for i := 0 to n - 2 do begin\n if d[i]=d[i+1] then\n n:=n-1;\n end;\n\n Writeln(n);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "sample_input": "4\n10\n8\n8\n6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03470", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1384, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s274200765", "group_id": "codeNet:p03475", "input_text": "var c,s,f:array[0..500]of longint;\n i,j,tmp,n:longint;\nbegin\n readln(n);\n for i:=0 to n-2 do\n read(c[i],s[i],f[i]);\n for i:=0 to n-2 do\n begin\n tmp:=s[i]+c[i];\n for j:=i to n-3 do\n begin\n if tmp0 do\n inc(tmp);\n inc(tmp,c[j+1]);\n end;\n writeln(tmp);\n end;\n writeln(0);\nend.", "language": "Pascal", "metadata": {"date": 1583503519, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03475.html", "problem_id": "p03475", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03475/input.txt", "sample_output_relpath": "derived/input_output/data/p03475/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03475/Pascal/s274200765.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s274200765", "user_id": "u743614777"}, "prompt_components": {"gold_output": "12\n11\n0\n", "input_to_evaluate": "var c,s,f:array[0..500]of longint;\n i,j,tmp,n:longint;\nbegin\n readln(n);\n for i:=0 to n-2 do\n read(c[i],s[i],f[i]);\n for i:=0 to n-2 do\n begin\n tmp:=s[i]+c[i];\n for j:=i to n-3 do\n begin\n if tmp0 do\n inc(tmp);\n inc(tmp,c[j+1]);\n end;\n writeln(tmp);\n end;\n writeln(0);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA railroad running from west to east in Atcoder Kingdom is now complete.\n\nThere are N stations on the railroad, numbered 1 through N from west to east.\n\nTomorrow, the opening ceremony of the railroad will take place.\n\nOn this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i to Station i+1 in C_i seconds. No other trains will be operated.\n\nThe first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds.\n\nHere, it is guaranteed that F_i divides S_i.\n\nThat is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains.\n\nFor each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains.\n\nConstraints\n\n1≤N≤500\n\n1≤C_i≤100\n\n1≤S_i≤10^5\n\n1≤F_i≤10\n\nS_i%F_i=0\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nC_1 S_1 F_1\n:\nC_{N-1} S_{N-1} F_{N-1}\n\nOutput\n\nPrint N lines. Assuming that we are at Station i (1≤i≤N) when the ceremony begins, if the earliest possible time we can reach Station N is x seconds after the ceremony begins, the i-th line should contain x.\n\nSample Input 1\n\n3\n6 5 1\n1 10 1\n\nSample Output 1\n\n12\n11\n0\n\nWe will travel from Station 1 as follows:\n\n5 seconds after the beginning: take the train to Station 2.\n\n11 seconds: arrive at Station 2.\n\n11 seconds: take the train to Station 3.\n\n12 seconds: arrive at Station 3.\n\nWe will travel from Station 2 as follows:\n\n10 seconds: take the train to Station 3.\n\n11 seconds: arrive at Station 3.\n\nNote that we should print 0 for Station 3.\n\nSample Input 2\n\n4\n12 24 6\n52 16 4\n99 2 2\n\nSample Output 2\n\n187\n167\n101\n0\n\nSample Input 3\n\n4\n12 13 1\n44 17 17\n66 4096 64\n\nSample Output 3\n\n4162\n4162\n4162\n0", "sample_input": "3\n6 5 1\n1 10 1\n"}, "reference_outputs": ["12\n11\n0\n"], "source_document_id": "p03475", "source_text": "Score : 300 points\n\nProblem Statement\n\nA railroad running from west to east in Atcoder Kingdom is now complete.\n\nThere are N stations on the railroad, numbered 1 through N from west to east.\n\nTomorrow, the opening ceremony of the railroad will take place.\n\nOn this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i to Station i+1 in C_i seconds. No other trains will be operated.\n\nThe first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds.\n\nHere, it is guaranteed that F_i divides S_i.\n\nThat is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains.\n\nFor each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains.\n\nConstraints\n\n1≤N≤500\n\n1≤C_i≤100\n\n1≤S_i≤10^5\n\n1≤F_i≤10\n\nS_i%F_i=0\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nC_1 S_1 F_1\n:\nC_{N-1} S_{N-1} F_{N-1}\n\nOutput\n\nPrint N lines. Assuming that we are at Station i (1≤i≤N) when the ceremony begins, if the earliest possible time we can reach Station N is x seconds after the ceremony begins, the i-th line should contain x.\n\nSample Input 1\n\n3\n6 5 1\n1 10 1\n\nSample Output 1\n\n12\n11\n0\n\nWe will travel from Station 1 as follows:\n\n5 seconds after the beginning: take the train to Station 2.\n\n11 seconds: arrive at Station 2.\n\n11 seconds: take the train to Station 3.\n\n12 seconds: arrive at Station 3.\n\nWe will travel from Station 2 as follows:\n\n10 seconds: take the train to Station 3.\n\n11 seconds: arrive at Station 3.\n\nNote that we should print 0 for Station 3.\n\nSample Input 2\n\n4\n12 24 6\n52 16 4\n99 2 2\n\nSample Output 2\n\n187\n167\n101\n0\n\nSample Input 3\n\n4\n12 13 1\n44 17 17\n66 4096 64\n\nSample Output 3\n\n4162\n4162\n4162\n0", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 397, "cpu_time_ms": 138, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s010436713", "group_id": "codeNet:p03475", "input_text": "var\n\tn,ans,i,j:Longint;\n\tc,s,f:array[1..499]of Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n-1 do read(c[i],s[i],f[i]);\n\tfor i:=1 to n-1 do begin\n\t\tans:=0;\n\t\tfor j:=i to n-1 do begin\n\t\t\tif ansn[i-1] then s:=min(s,max(i,length(n)-i));\n writeln(min(s,length(n)));\nend.", "language": "Pascal", "metadata": {"date": 1582923696, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03480.html", "problem_id": "p03480", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03480/input.txt", "sample_output_relpath": "derived/input_output/data/p03480/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03480/Pascal/s462337223.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s462337223", "user_id": "u723721005"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar\n n:ansistring;\n i,s:longint;\nbegin\n readln(n);s:=maxlongint;\n for i:=1 to length(n)-1 do\n if n[i]<>n[i-1] then s:=min(s,max(i,length(n)-i));\n writeln(min(s,length(n)));\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03480", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s305154516", "group_id": "codeNet:p03480", "input_text": "uses math;\nvar\n n:ansistring;\n i,s:longint;\nbegin\n readln(n);s:=maxlongint;\n for i:=2 to length(n) do\n if n[i]<>n[i-1] then s:=min(s,max(i,length(n)-i));\n writeln(min(s,length(n)));\nend.", "language": "Pascal", "metadata": {"date": 1582923649, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03480.html", "problem_id": "p03480", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03480/input.txt", "sample_output_relpath": "derived/input_output/data/p03480/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03480/Pascal/s305154516.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s305154516", "user_id": "u247366051"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar\n n:ansistring;\n i,s:longint;\nbegin\n readln(n);s:=maxlongint;\n for i:=2 to length(n) do\n if n[i]<>n[i-1] then s:=min(s,max(i,length(n)-i));\n writeln(min(s,length(n)));\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03480", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s355927335", "group_id": "codeNet:p03480", "input_text": "var\n n:string;\n i,s:longint;\nbegin\n readln(n);\n for i:=1 to length(n) do if n[i]='0' then inc(s);\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1582923555, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03480.html", "problem_id": "p03480", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03480/input.txt", "sample_output_relpath": "derived/input_output/data/p03480/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03480/Pascal/s355927335.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s355927335", "user_id": "u263933075"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n:string;\n i,s:longint;\nbegin\n readln(n);\n for i:=1 to length(n) do if n[i]='0' then inc(s);\n writeln(s);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03480", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s005602265", "group_id": "codeNet:p03480", "input_text": "uses math ;\nvar mi,m,i,j,k,sum,now,c,d : longint ;\n cc,yo : array [0..1000001] of int64 ;\n a,b : int64 ;\n so,s1,s2 : ansistring ;\n gg : char ;\nbegin\n readln(so);\n gg:='2';\n j:=-1;\n for i:=1 to length(so) do\n begin\n if gg<>so[i] then\n begin\n inc(j);\n cc[j]:=now;\n now:=1;\n gg:=so[i];\n end\n else\n inc(now);\n end;\n inc(j);\n cc[j]:=now;\n mi:=1000000000;\n for i:=3 to j do\n begin\n if min(cc[i-2],cc[i])+cc[i-1]so[i] then\n begin\n inc(j);\n cc[j]:=now;\n now:=1;\n gg:=so[i];\n end\n else\n inc(now);\n end;\n inc(j);\n cc[j]:=now;\n mi:=1000000000;\n for i:=3 to j do\n begin\n if min(cc[i-2],cc[i])+cc[i-1]n then\n inc(ans) else\n inc(a[x]);\n end;\n readln;\n for i:=1 to n do\n if a[i]n then\n inc(ans) else\n inc(a[x]);\n end;\n readln;\n for i:=1 to n do\n if a[i]n then m:=m-1\n else begin\n inc(a[x]);\n if x>max then max:=x;\n if xi then m:=m+(a[i]-i);\n writeln(m);\nend.", "language": "Pascal", "metadata": {"date": 1537322861, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Pascal/s266521527.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s266521527", "user_id": "u723721005"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,max,min,x,m:longint;\n a:array[0..100000001] of longint;\nbegin\n readln(n);\n min:=maxlongint;\n for i:=1 to n do \n begin\n read(x);\n if x>n then m:=m-1\n else begin\n inc(a[x]);\n if x>max then max:=x;\n if xi then m:=m+(a[i]-i);\n writeln(m);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 357, "cpu_time_ms": 17, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s285924723", "group_id": "codeNet:p03487", "input_text": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if t>=a[i-1] then s:=s+t-a[i-1]\n else s:=s+t;\n t:=1;\n end;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535649889, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Pascal/s285924723.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s285924723", "user_id": "u476418095"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if t>=a[i-1] then s:=s+t-a[i-1]\n else s:=s+t;\n t:=1;\n end;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 758, "cpu_time_ms": 23, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s266878254", "group_id": "codeNet:p03487", "input_text": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if t>a[i-1] then s:=s+t-a[i-1]\n else s:=s+a[i-1];\n t:=1;\n end;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535649733, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Pascal/s266878254.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s266878254", "user_id": "u723721005"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if t>a[i-1] then s:=s+t-a[i-1]\n else s:=s+a[i-1];\n t:=1;\n end;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 762, "cpu_time_ms": 24, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s821679656", "group_id": "codeNet:p03487", "input_text": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if t>a[i-1] then s:=s+t-a[i-1]\n else s:=s+a[i-1];\n t:=1;\n end;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1535649659, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Pascal/s821679656.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s821679656", "user_id": "u476418095"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[0..100010] of longint;\n i,n,s,t:longint;\nprocedure qsort(l,r:longint);\nvar\n i,j,t,mid:longint;\nbegin\n i:=l; j:=r; mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if la[i-1] then\n begin\n if t>a[i-1] then s:=s+t-a[i-1]\n else s:=s+a[i-1];\n t:=1;\n end;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 760, "cpu_time_ms": 23, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s770931229", "group_id": "codeNet:p03487", "input_text": "var n,i,j,ans,x:longint;\nvar b:array[0..100200] of longint;\nbegin\n read(n);\n for i:=1 to n do begin read(x);if x>100000 then inc(ans)\n else inc(b[x]);end;\n for i:=1 to 100000 do\n begin\n if b[i]>0 then begin\n if b[i]>i then inc(ans,b[i]-i)\n else if b[i]100000 then inc(ans)\n else inc(b[x]);end;\n for i:=1 to 100000 do\n begin\n if b[i]>0 then begin\n if b[i]>i then inc(ans,b[i]-i)\n else if b[i]>1;\n inc(n);\n end;\n ans:=min(ans,n);\n end;\n writeln(ans)\nend.", "language": "Pascal", "metadata": {"date": 1581693828, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Pascal/s118531188.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s118531188", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar b:int64;\n a,ans,n,i:longint;\nbegin\n ans:=2147483647;\n readln(a);\n for a:=1 to a do\n begin\n read(b);\n n:=0;\n while b and 1=0 do\n begin\n b:=b>>1;\n inc(n);\n end;\n ans:=min(ans,n);\n end;\n writeln(ans)\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 253, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s541734307", "group_id": "codeNet:p03494", "input_text": "uses math;\nvar n,i,t,s:longint;\nfunction gcd(a,b:longint):longint;\nbegin\n if b=0 then exit(a);\n exit(gcd(b,a mod b));\nend;\nbegin\n s:=1<<31;\n readln(n);\n for i:=1 to n do\n begin\n read(t);\n s:=gcd(s,t);\n end;\n writeln(round(log2(s)));\nend.", "language": "Pascal", "metadata": {"date": 1581693585, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Pascal/s541734307.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s541734307", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar n,i,t,s:longint;\nfunction gcd(a,b:longint):longint;\nbegin\n if b=0 then exit(a);\n exit(gcd(b,a mod b));\nend;\nbegin\n s:=1<<31;\n readln(n);\n for i:=1 to n do\n begin\n read(t);\n s:=gcd(s,t);\n end;\n writeln(round(log2(s)));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 251, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s784469152", "group_id": "codeNet:p03494", "input_text": "uses math;\nvar n,i,t,s:longint;\nfunction gcd(a,b:longint):longint;\nbegin\n if b=0 then exit(a);\n exit(gcd(b,a mod b));\nend;\nbegin\n s:=1073741824;\n readln(n);\n for i:=1 to n do\n begin\n read(t);\n s:=gcd(s,t);\n end;\n writeln(trunc(log2(s)));\nend.", "language": "Pascal", "metadata": {"date": 1581693545, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Pascal/s784469152.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s784469152", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\nvar n,i,t,s:longint;\nfunction gcd(a,b:longint):longint;\nbegin\n if b=0 then exit(a);\n exit(gcd(b,a mod b));\nend;\nbegin\n s:=1073741824;\n readln(n);\n for i:=1 to n do\n begin\n read(t);\n s:=gcd(s,t);\n end;\n writeln(trunc(log2(s)));\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s258849193", "group_id": "codeNet:p03495", "input_text": "var\n x,max,min,i,n,k,s:longint;\n sum:int64;\n a,b:array[0..200001] of longint;\nprocedure kp(l,r:longint);\nvar\n i,j,t,m:longint;\nbegin\n i:=l; j:=r;\n m:=a[(l+r) div 2];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if lmax then max:=x;\n if x0 then \n begin\n inc(s); \n a[s]:=b[i];\n end;\n kp(1,s);\n for i:=1 to s-k do\n sum:=sum+a[i];\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1538182608, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03495.html", "problem_id": "p03495", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03495/input.txt", "sample_output_relpath": "derived/input_output/data/p03495/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03495/Pascal/s258849193.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s258849193", "user_id": "u476418095"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n x,max,min,i,n,k,s:longint;\n sum:int64;\n a,b:array[0..200001] of longint;\nprocedure kp(l,r:longint);\nvar\n i,j,t,m:longint;\nbegin\n i:=l; j:=r;\n m:=a[(l+r) div 2];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if lmax then max:=x;\n if x0 then \n begin\n inc(s); \n a[s]:=b[i];\n end;\n kp(1,s);\n for i:=1 to s-k do\n sum:=sum+a[i];\n writeln(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "sample_input": "5 2\n1 1 2 2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03495", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 675, "cpu_time_ms": 31, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s514090160", "group_id": "codeNet:p03503", "input_text": "var n,x,ans,ma,m2,d,m3,da,nn:int64;\nvar i,j:longint;\nvar a,b:array[0..1000] of int64;\nvar c:array[0..102,0..102] of longint;\nfunction max(a,b:int64):int64;\nbegin\n if a>b then exit(a);exit(b);\nend;\nprocedure dfs(d:int64);\nvar i:longint;\nvar num,d1:int64;\nbegin\n if d>n then\n begin\n num:=0;d1:=-1;\n for i:=1 to n do begin d1:=max(d1,b[i]);inc(num,c[i,b[i]]);end;\n if d1>0 then ans:=max(ans,num);\n exit;\n end;\n for i:=0 to a[d] do begin b[d]:=i;dfs(d+1);end;\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n {ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a);exit(b);\nend;\nprocedure dfs(d:int64);\nvar i:longint;\nvar num,d1:int64;\nbegin\n if d>n then\n begin\n num:=0;d1:=-1;\n for i:=1 to n do begin d1:=max(d1,b[i]);inc(num,c[i,b[i]]);end;\n if d1>0 then ans:=max(ans,num);\n exit;\n end;\n for i:=0 to a[d] do begin b[d]:=i;dfs(d+1);end;\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n {ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a);exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da]b then exit(a);exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n for j:=1 to 10 do begin read(x);if x=1 then inc(a[i]);end;\n ma:=-2147483647;d:=-1;\n for i:=1 to n do\n begin\n m2:=-2147483647;\n for j:=0 to 10 do\n begin\n read(x);if j=0 then b[i]:=x;\n if j<=a[i] then\n begin\n if x>m2 then begin m2:=x;d:=max(d,j);end;\n if j>0 then\n //if (x>ma) or ((x=ma) and (ma-b[da] j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'1.out'); rewrite(output);\n randseed := 6714;\n \n readln(n);\n for i := 1 to n do begin\n readln(h[i], p[i]);\n end;\n qsort(1, n);\n \n fillchar(dp, sizeof(dp), 63);\n dp[0] := 0;\n for i := 1 to n do begin\n for j := i - 1 downto 0 do begin\n if (dp[j] <= h[i]) and (dp[j + 1] > dp[j] + p[i]) then begin\n dp[j + 1] := dp[j] + p[i];\n end;\n end;\n end;\n \n ans := 0;\n for i := 0 to n do begin\n if (dp[i] < 1000000000000000000) then begin\n ans := i;\n end;\n end;\n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "language": "Pascal", "metadata": {"date": 1588121170, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03526.html", "problem_id": "p03526", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03526/input.txt", "sample_output_relpath": "derived/input_output/data/p03526/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03526/Pascal/s512410669.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s512410669", "user_id": "u468291514"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "uses math;\n\ntype\n int32 = longint;\n double = extended;\n bool = boolean;\n\nconst inf = 1061109567;\n\nvar\n i, j, swap_tmp, x, y, z: int32;\n n, ans: int32;\n h, p: array [0 .. 5005] of int32;\n dp: array [0 .. 5005] of int64;\n\nfunction qsort_less(i, j: int32): bool;\nbegin\n qsort_less := (h[i] + p[i]) < (h[j] + p[j]);\nend;\nprocedure qsort_swap(i, j: int32);\n var _swap_tmp: int32;\nbegin\n _swap_tmp := h[i]; h[i] := h[j]; h[j] := _swap_tmp;\n _swap_tmp := p[i]; p[i] := p[j]; p[j] := _swap_tmp;\nend;\nprocedure qsort(_l, _r: int32);\n var i, j, _p: int32;\nbegin\n if (_r = _l) then exit;\n i := _l; j := _r;\n _p := _l;\n repeat\n while qsort_less(i, _p) do inc(i);\n while qsort_less(_p, j) do dec(j);\n if (i <= j) then begin\n qsort_swap(i, j);\n inc(i); dec(j);\n end;\n until (i > j);\n if (i < _r) then qsort(i, _r);\n if (j > _l) then qsort(_l, j);\nend;\n\nbegin\n// assign(input,'in'); reset(input);\n// assign(output,'1.out'); rewrite(output);\n randseed := 6714;\n \n readln(n);\n for i := 1 to n do begin\n readln(h[i], p[i]);\n end;\n qsort(1, n);\n \n fillchar(dp, sizeof(dp), 63);\n dp[0] := 0;\n for i := 1 to n do begin\n for j := i - 1 downto 0 do begin\n if (dp[j] <= h[i]) and (dp[j + 1] > dp[j] + p[i]) then begin\n dp[j + 1] := dp[j] + p[i];\n end;\n end;\n end;\n \n ans := 0;\n for i := 0 to n do begin\n if (dp[i] < 1000000000000000000) then begin\n ans := i;\n end;\n end;\n writeln(ans);\n \n close(input);\n close(output);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nIn the final of CODE FESTIVAL in some year, there are N participants.\nThe height and power of Participant i is H_i and P_i, respectively.\n\nRingo is hosting a game of stacking zabuton (cushions).\n\nThe participants will line up in a row in some order, and they will in turn try to add zabuton to the stack of zabuton.\nInitially, the stack is empty.\nWhen it is Participant i's turn, if there are H_i or less zabuton already stacked, he/she will add exactly P_i zabuton to the stack. Otherwise, he/she will give up and do nothing.\n\nRingo wants to maximize the number of participants who can add zabuton to the stack.\nHow many participants can add zabuton to the stack in the optimal order of participants?\n\nConstraints\n\n1 \\leq N \\leq 5000\n\n0 \\leq H_i \\leq 10^9\n\n1 \\leq P_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 P_1\nH_2 P_2\n:\nH_N P_N\n\nOutput\n\nPrint the maximum number of participants who can add zabuton to the stack.\n\nSample Input 1\n\n3\n0 2\n1 3\n3 4\n\nSample Output 1\n\n2\n\nWhen the participants line up in the same order as the input, Participants 1 and 3 will be able to add zabuton.\n\nOn the other hand, there is no order such that all three participants can add zabuton. Thus, the answer is 2.\n\nSample Input 2\n\n3\n2 4\n3 1\n4 1\n\nSample Output 2\n\n3\n\nWhen the participants line up in the order 2, 3, 1, all of them will be able to add zabuton.\n\nSample Input 3\n\n10\n1 3\n8 4\n8 3\n9 1\n6 4\n2 3\n4 2\n9 2\n8 3\n0 1\n\nSample Output 3\n\n5", "sample_input": "3\n0 2\n1 3\n3 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03526", "source_text": "Score : 700 points\n\nProblem Statement\n\nIn the final of CODE FESTIVAL in some year, there are N participants.\nThe height and power of Participant i is H_i and P_i, respectively.\n\nRingo is hosting a game of stacking zabuton (cushions).\n\nThe participants will line up in a row in some order, and they will in turn try to add zabuton to the stack of zabuton.\nInitially, the stack is empty.\nWhen it is Participant i's turn, if there are H_i or less zabuton already stacked, he/she will add exactly P_i zabuton to the stack. Otherwise, he/she will give up and do nothing.\n\nRingo wants to maximize the number of participants who can add zabuton to the stack.\nHow many participants can add zabuton to the stack in the optimal order of participants?\n\nConstraints\n\n1 \\leq N \\leq 5000\n\n0 \\leq H_i \\leq 10^9\n\n1 \\leq P_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 P_1\nH_2 P_2\n:\nH_N P_N\n\nOutput\n\nPrint the maximum number of participants who can add zabuton to the stack.\n\nSample Input 1\n\n3\n0 2\n1 3\n3 4\n\nSample Output 1\n\n2\n\nWhen the participants line up in the same order as the input, Participants 1 and 3 will be able to add zabuton.\n\nOn the other hand, there is no order such that all three participants can add zabuton. Thus, the answer is 2.\n\nSample Input 2\n\n3\n2 4\n3 1\n4 1\n\nSample Output 2\n\n3\n\nWhen the participants line up in the order 2, 3, 1, all of them will be able to add zabuton.\n\nSample Input 3\n\n10\n1 3\n8 4\n8 3\n9 1\n6 4\n2 3\n4 2\n9 2\n8 3\n0 1\n\nSample Output 3\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1499, "cpu_time_ms": 33, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s012488333", "group_id": "codeNet:p03549", "input_text": "var\n n,m,s,sum:qword;\n i:longint;\nbegin\n readln(n,m);\n s:=1900*m+100*(n-m);\n sum:=1;\n for i:=1 to m do sum:=sum*2;\n writeln(s*sum);\nend.", "language": "Pascal", "metadata": {"date": 1582218797, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03549.html", "problem_id": "p03549", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03549/input.txt", "sample_output_relpath": "derived/input_output/data/p03549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03549/Pascal/s012488333.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s012488333", "user_id": "u426964396"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "var\n n,m,s,sum:qword;\n i:longint;\nbegin\n readln(n,m);\n s:=1900*m+100*(n-m);\n sum:=1;\n for i:=1 to m do sum:=sum*2;\n writeln(s*sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03549", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s586627700", "group_id": "codeNet:p03550", "input_text": "uses math;\nvar n,w,i:longint;\n a:array[0..2000]of int64;\nbegin\n readln(n,w,w);\n for i:=1 to n do\n read(a[n]);\n if n=1 then\n writeln(abs(a[1])-w)\n else\n writeln(max(abs(a[n]-a[n-1]),abs(a[n]-w)));\nend.", "language": "Pascal", "metadata": {"date": 1583529823, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03550.html", "problem_id": "p03550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03550/input.txt", "sample_output_relpath": "derived/input_output/data/p03550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03550/Pascal/s586627700.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s586627700", "user_id": "u743614777"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "uses math;\nvar n,w,i:longint;\n a:array[0..2000]of int64;\nbegin\n readln(n,w,w);\n for i:=1 to n do\n read(a[n]);\n if n=1 then\n writeln(abs(a[1])-w)\n else\n writeln(max(abs(a[n]-a[n-1]),abs(a[n]-w)));\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03550", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s231364906", "group_id": "codeNet:p03550", "input_text": "uses math;\nvar n,z,w:longint;\n p:array[0..2000]of longint;\nbegin\n readln(n,z,w);\n for n:=0 to n-1 do\n read(p[n]);\n if n=0 then\n writeln(abs(p[n])-w)\n else\n writeln(max(abs(p[n]-p[n-1]),abs(p[n]-w)));\nend.", "language": "Pascal", "metadata": {"date": 1583526957, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03550.html", "problem_id": "p03550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03550/input.txt", "sample_output_relpath": "derived/input_output/data/p03550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03550/Pascal/s231364906.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s231364906", "user_id": "u743614777"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "uses math;\nvar n,z,w:longint;\n p:array[0..2000]of longint;\nbegin\n readln(n,z,w);\n for n:=0 to n-1 do\n read(p[n]);\n if n=0 then\n writeln(abs(p[n])-w)\n else\n writeln(max(abs(p[n]-p[n-1]),abs(p[n]-w)));\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03550", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s674640148", "group_id": "codeNet:p03550", "input_text": "uses math;\nvar\n a:array[1..2000] of longint;\n n,x,i:longint;\nbegin\n readln(n,x,x);\n for i:=1 to n do read(a[i]);\n if n=1 then writeln(abs(a[1]-x)) else writeln(max(abs(a[n]-a[n-1]),abs(a[n]-x)));\nend.", "language": "Pascal", "metadata": {"date": 1582664339, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03550.html", "problem_id": "p03550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03550/input.txt", "sample_output_relpath": "derived/input_output/data/p03550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03550/Pascal/s674640148.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s674640148", "user_id": "u476418095"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "uses math;\nvar\n a:array[1..2000] of longint;\n n,x,i:longint;\nbegin\n readln(n,x,x);\n for i:=1 to n do read(a[i]);\n if n=1 then writeln(abs(a[1]-x)) else writeln(max(abs(a[n]-a[n-1]),abs(a[n]-x)));\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03550", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s232119666", "group_id": "codeNet:p03552", "input_text": "uses Math;\nvar\n\tN,i,Z,W,X:Longint;\nbegin\n\tread(N,Z,W);\n\tif N=1 then begin\n\t\tread(Z);\n\t\twriteln(abs(Z-W));\n\t\texit;\n\tend;\n\tfor i:=1 to N-2 do read(Z);\n\tread(Z,X);\n\twriteln(max(abs(Z-X),abs(W-X)))\nend.", "language": "Pascal", "metadata": {"date": 1573538913, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s232119666.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s232119666", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "uses Math;\nvar\n\tN,i,Z,W,X:Longint;\nbegin\n\tread(N,Z,W);\n\tif N=1 then begin\n\t\tread(Z);\n\t\twriteln(abs(Z-W));\n\t\texit;\n\tend;\n\tfor i:=1 to N-2 do read(Z);\n\tread(Z,X);\n\twriteln(max(abs(Z-X),abs(W-X)))\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 198, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s713804520", "group_id": "codeNet:p03552", "input_text": "Uses math;\nvar\n\tn,i,z,w,a,b,t:Longint;\n\ts:String;\nbegin\n\treadln(n,z,w);\n\tif n=1 then begin\n\t\tread(b);\n\t\twriteln(abs(b-w));\n\t\texit;\n\tend;\n\tsetlength(s,22222);\n\treadln(s);\n\ti:=length(s);\n\twhile s[i]>' ' do dec(i);\n\tfor z:=i+1 to length(s) do b:=b*10+ord(s[z])-48;\n\tdec(i);\n\tt:=i;\n\twhile(i>0)and(s[i]>' ')do dec(i);\n\tfor z:=i+1 to t do a:=a*10+ord(s[z])-48;\n\twriteln(Max(abs(b-w),abs(a-b)));\nend.\n", "language": "Pascal", "metadata": {"date": 1539817344, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s713804520.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s713804520", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "Uses math;\nvar\n\tn,i,z,w,a,b,t:Longint;\n\ts:String;\nbegin\n\treadln(n,z,w);\n\tif n=1 then begin\n\t\tread(b);\n\t\twriteln(abs(b-w));\n\t\texit;\n\tend;\n\tsetlength(s,22222);\n\treadln(s);\n\ti:=length(s);\n\twhile s[i]>' ' do dec(i);\n\tfor z:=i+1 to length(s) do b:=b*10+ord(s[z])-48;\n\tdec(i);\n\tt:=i;\n\twhile(i>0)and(s[i]>' ')do dec(i);\n\tfor z:=i+1 to t do a:=a*10+ord(s[z])-48;\n\twriteln(Max(abs(b-w),abs(a-b)));\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 394, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s457061227", "group_id": "codeNet:p03552", "input_text": "var z,w,n,ans,max,min:int64;\nvar i,j:longint;\nvar a:array[0..2020] of int64;\nbegin \n read(n,z,w);min:=2147483647;max:=-2147483647;\n for i:=1 to n do begin read(a[i]);if a[i]max then max:=a[i];end;\nfor i:=1 to n do for j:=1 to n do begin if abs(a[i]-a[j])>ans then ans:=abs(a[i]-a[j]);end;\n if ansmax then max:=a[i];end;\n ans:=abs(max-a[n]);\n if ansmax then max:=a[i];end;\nfor i:=1 to n do for j:=1 to n do begin if abs(a[i]-a[j])>ans then ans:=abs(a[i]-a[j]);end;\n if ansmax then max:=a[i];end;\n ans:=abs(max-a[n]);\n if ansmax then max:=a[i];end;\nfor i:=1 to n do begin if abs(a[i]-a[n])>ans then ans:=abs(a[i]-a[n]);end;\n if ansmax then max:=a[i];end;\n ans:=abs(max-a[n]);\n if ansmax then max:=a[i];end;\nfor i:=1 to n do begin if abs(a[i]-a[n])>ans then ans:=abs(a[i]-a[n]);end;\n if ansmax then max:=a[i];end;\n ans:=abs(max-a[n]);\n if ansb then exit(a) else exit(b);\nend;\nbegin\n read(n,z,w);\n for i:=1 to n do\n begin\n read(x);\n if x>mx then mx:=x;\n end;\n ans:=abs(w-x);\n ans:=max(ans,abs(mx-x));\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1510454423, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s359866996.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s359866996", "user_id": "u139162134"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "var n,z,w:longint;\n x:longint;\n ans,mx:longint;\n i:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n read(n,z,w);\n for i:=1 to n do\n begin\n read(x);\n if x>mx then mx:=x;\n end;\n ans:=abs(w-x);\n ans:=max(ans,abs(mx-x));\n writeln(ans);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 308, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s202188181", "group_id": "codeNet:p03552", "input_text": "//fpc 3.0.0\n\nprogram HelloWorld;\n var n,z,w:longint;\n var i,j:longint;\n var a:array [1..2000] of longint;\n var sx,sy:array[1..2000]of longint;\n var p,q:longint;\n var turn:boolean;\n var t:longint;\nbegin\n readln(n,z,w);\n for i:=1 to n do read(a[i]);\n for i:=n-1 downto 1 do\n begin\n sx[i]:=0;\n sy[i]:=1000000001;\n for j:=i+1 to n do\n begin\n if abs(a[i]-a[j])>=sx[i] then sx[i]:=abs(a[i]-a[j]);\n if abs(a[i]-a[j])<=sy[i] then sy[i]:=abs(a[i]-a[j]);\n end;\n end;\n p:=1;\n turn:=true;\n if p=n then\n writeln(abs(w-a[n]))\n else\n begin\n while p<>n do\n begin\n if turn then\n begin\n sy[n]:=abs(a[n]-w);\n t:=0;\n for i:=p+1 to n do\n if sy[i]>=t then\n begin\n t:=sy[i];\n q:=i;\n end;\n z:=a[q];\n p:=q;\n turn:=false;\n end\n else\n begin\n sx[n]:=abs(a[n]-z);\n t:=1000000001;\n for i:=p+1 to n do\n if sx[i]<=t then\n begin\n t:=sx[i];\n q:=i;\n end;\n w:=a[q];\n p:=q;\n turn:=true;\n end;\n end;\n writeln(abs(z-w));\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1510454228, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s202188181.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s202188181", "user_id": "u566971318"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "//fpc 3.0.0\n\nprogram HelloWorld;\n var n,z,w:longint;\n var i,j:longint;\n var a:array [1..2000] of longint;\n var sx,sy:array[1..2000]of longint;\n var p,q:longint;\n var turn:boolean;\n var t:longint;\nbegin\n readln(n,z,w);\n for i:=1 to n do read(a[i]);\n for i:=n-1 downto 1 do\n begin\n sx[i]:=0;\n sy[i]:=1000000001;\n for j:=i+1 to n do\n begin\n if abs(a[i]-a[j])>=sx[i] then sx[i]:=abs(a[i]-a[j]);\n if abs(a[i]-a[j])<=sy[i] then sy[i]:=abs(a[i]-a[j]);\n end;\n end;\n p:=1;\n turn:=true;\n if p=n then\n writeln(abs(w-a[n]))\n else\n begin\n while p<>n do\n begin\n if turn then\n begin\n sy[n]:=abs(a[n]-w);\n t:=0;\n for i:=p+1 to n do\n if sy[i]>=t then\n begin\n t:=sy[i];\n q:=i;\n end;\n z:=a[q];\n p:=q;\n turn:=false;\n end\n else\n begin\n sx[n]:=abs(a[n]-z);\n t:=1000000001;\n for i:=p+1 to n do\n if sx[i]<=t then\n begin\n t:=sx[i];\n q:=i;\n end;\n w:=a[q];\n p:=q;\n turn:=true;\n end;\n end;\n writeln(abs(z-w));\n end;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1279, "cpu_time_ms": 15, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s828727963", "group_id": "codeNet:p03552", "input_text": "program HelloWorld;\n var n,z,w:longint;\n var i,j:longint;\n var a:array [1..2000] of longint;\n var sx,sy:array[1..2000]of longint;\n var p,q:longint;\n var turn:boolean;\n var t:longint;\nbegin\n readln(n,z,w);\n for i:=1 to n do read(a[i]);\n for i:=n-1 downto 1 do\n begin\n sx[i]:=0;\n sy[i]:=1000000000;\n for j:=i+1 to n do\n begin\n if abs(a[i]-a[j])>=sx[i] then sx[i]:=abs(a[i]-a[j]);\n if abs(a[i]-a[j])<=sy[i] then sy[i]:=abs(a[i]-a[j]);\n end;\n end;\n p:=1;\n turn:=true;\n if p=n then\n writeln(abs(w-a[n]))\n else\n begin\n while p<>n do\n begin\n if turn then\n begin\n sy[n]:=abs(a[n]-w);\n t:=0;\n for i:=p+1 to n do\n if sy[i]>=t then\n begin\n t:=sy[i];\n q:=i;\n end;\n z:=a[q];\n p:=q;\n turn:=false;\n end\n else\n begin\n sx[n]:=abs(a[n]-z);\n t:=1000000000;\n for i:=p+1 to n do\n if sx[i]<=t then\n begin\n t:=sx[i];\n q:=i;\n end;\n w:=a[q];\n p:=q;\n turn:=true;\n end;\n end;\n writeln(abs(z-w));\n end;\nend.", "language": "Pascal", "metadata": {"date": 1510454107, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Pascal/s828727963.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s828727963", "user_id": "u566971318"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "program HelloWorld;\n var n,z,w:longint;\n var i,j:longint;\n var a:array [1..2000] of longint;\n var sx,sy:array[1..2000]of longint;\n var p,q:longint;\n var turn:boolean;\n var t:longint;\nbegin\n readln(n,z,w);\n for i:=1 to n do read(a[i]);\n for i:=n-1 downto 1 do\n begin\n sx[i]:=0;\n sy[i]:=1000000000;\n for j:=i+1 to n do\n begin\n if abs(a[i]-a[j])>=sx[i] then sx[i]:=abs(a[i]-a[j]);\n if abs(a[i]-a[j])<=sy[i] then sy[i]:=abs(a[i]-a[j]);\n end;\n end;\n p:=1;\n turn:=true;\n if p=n then\n writeln(abs(w-a[n]))\n else\n begin\n while p<>n do\n begin\n if turn then\n begin\n sy[n]:=abs(a[n]-w);\n t:=0;\n for i:=p+1 to n do\n if sy[i]>=t then\n begin\n t:=sy[i];\n q:=i;\n end;\n z:=a[q];\n p:=q;\n turn:=false;\n end\n else\n begin\n sx[n]:=abs(a[n]-z);\n t:=1000000000;\n for i:=p+1 to n do\n if sx[i]<=t then\n begin\n t:=sx[i];\n q:=i;\n end;\n w:=a[q];\n p:=q;\n turn:=true;\n end;\n end;\n writeln(abs(z-w));\n end;\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1265, "cpu_time_ms": 15, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s741757154", "group_id": "codeNet:p03553", "input_text": "var\n n,i,j,k,y:longint;x,min:int64;\n a:array[1..200] of int64;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n for k:=1 to n*2 do\n begin\n min:=0;\n for i:=n downto 1 do\n begin\n j:=i;x:=0;\n while j<=n do\n begin\n x:=x+a[j];\n j:=j+i;\n end;\n if x=0 then break; \n for i:=1 to n do\n if i mod l=0 then\n s[i]:=true;\n tot:=tot-min; \n end;\n writeln(tot);\nend. ", "language": "Pascal", "metadata": {"date": 1536441261, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03553.html", "problem_id": "p03553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03553/input.txt", "sample_output_relpath": "derived/input_output/data/p03553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03553/Pascal/s838837298.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s838837298", "user_id": "u426964396"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var s:array[1..1000]of boolean;\n a,f:array[1..1000]of int64;\n n,i,j,x,k,l:longint;\n tot,min:int64;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n tot:=tot+a[i];\n end; \n \n fillchar(s,sizeof(s),false);\n for k:=1 to n do\n begin\n min:=99999999999999999;\n fillchar(f,sizeof(f),0);\n for x:=1 to n do\n begin\n if s[x]=false then\n for i:=1 to n do\n if (s[i]=false)and(i mod x=0) then\n f[x]:=f[x]+a[i];\n if f[x]=0 then break; \n for i:=1 to n do\n if i mod l=0 then\n s[i]:=true;\n tot:=tot-min; \n end;\n writeln(tot);\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "sample_input": "6\n1 2 -6 4 5 3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03553", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 836, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s210735125", "group_id": "codeNet:p03553", "input_text": "var s:array[1..100]of boolean;\n a,f:array[1..100]of int64;\n n,i,j,k,l:longint;\n tot,min:int64;\nprocedure inf;\nvar i,j,k,l:longint;\nbegin\n fillchar(f,sizeof(f),0);\n for i:=1 to n do\n if s[i]=false then\n begin\n f[i]:=a[i];\n for j:=1 to i-1 do\n if (i mod j=0)and(s[j]=false) then\n f[j]:=f[j]+a[i];\n end;\nend;\nbegin\n readln(n);\n tot:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n inc(tot,a[i]);\n end;\n\n repeat\n inf;\n min:=999999999999999;\n for i:=1 to n do\n if f[i]=0 then break;\n for i:=1 to maxlongint do\n begin\n if k*i>n then break;\n s[k*i]:=true;\n end;\n dec(tot,min);\n until false;\n writeln(tot);\nend.\n", "language": "Pascal", "metadata": {"date": 1536428832, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03553.html", "problem_id": "p03553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03553/input.txt", "sample_output_relpath": "derived/input_output/data/p03553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03553/Pascal/s210735125.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s210735125", "user_id": "u247366051"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var s:array[1..100]of boolean;\n a,f:array[1..100]of int64;\n n,i,j,k,l:longint;\n tot,min:int64;\nprocedure inf;\nvar i,j,k,l:longint;\nbegin\n fillchar(f,sizeof(f),0);\n for i:=1 to n do\n if s[i]=false then\n begin\n f[i]:=a[i];\n for j:=1 to i-1 do\n if (i mod j=0)and(s[j]=false) then\n f[j]:=f[j]+a[i];\n end;\nend;\nbegin\n readln(n);\n tot:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n inc(tot,a[i]);\n end;\n\n repeat\n inf;\n min:=999999999999999;\n for i:=1 to n do\n if f[i]=0 then break;\n for i:=1 to maxlongint do\n begin\n if k*i>n then break;\n s[k*i]:=true;\n end;\n dec(tot,min);\n until false;\n writeln(tot);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "sample_input": "6\n1 2 -6 4 5 3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03553", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 863, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s003887337", "group_id": "codeNet:p03553", "input_text": "var s:array[1..100]of boolean;\n a,f:array[1..100]of int64;\n n,i,j,k,l:longint;\n tot,min:int64;\nprocedure inf;\nvar i,j,k,l:longint;\nbegin\n fillchar(f,sizeof(f),0);\n for i:=1 to n do\n if s[i]=false then\n begin\n f[i]:=a[i];\n for j:=1 to i-1 do\n if i mod j=0 then\n f[j]:=f[j]+a[i];\n end;\nend;\nbegin\n readln(n);\n tot:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n inc(tot,a[i]);\n end;\n\n repeat\n inf;\n min:=999999999999999;\n for i:=1 to 100 do\n if f[i]=0 then break;\n for i:=1 to maxlongint do\n begin\n if k*i>n then break;\n s[k*i]:=true;\n end;\n dec(tot,min);\n until false;\n writeln(tot);\nend.\n", "language": "Pascal", "metadata": {"date": 1536428181, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03553.html", "problem_id": "p03553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03553/input.txt", "sample_output_relpath": "derived/input_output/data/p03553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03553/Pascal/s003887337.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s003887337", "user_id": "u723721005"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "var s:array[1..100]of boolean;\n a,f:array[1..100]of int64;\n n,i,j,k,l:longint;\n tot,min:int64;\nprocedure inf;\nvar i,j,k,l:longint;\nbegin\n fillchar(f,sizeof(f),0);\n for i:=1 to n do\n if s[i]=false then\n begin\n f[i]:=a[i];\n for j:=1 to i-1 do\n if i mod j=0 then\n f[j]:=f[j]+a[i];\n end;\nend;\nbegin\n readln(n);\n tot:=0;\n for i:=1 to n do\n begin\n read(a[i]);\n inc(tot,a[i]);\n end;\n\n repeat\n inf;\n min:=999999999999999;\n for i:=1 to 100 do\n if f[i]=0 then break;\n for i:=1 to maxlongint do\n begin\n if k*i>n then break;\n s[k*i]:=true;\n end;\n dec(tot,min);\n until false;\n writeln(tot);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "sample_input": "6\n1 2 -6 4 5 3\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03553", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\nSelect a positive integer x, and smash all the gems labeled with multiples of x.\n\nThen, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japan).\nHowever, a_i may be negative, in which case you will be charged money.\n\nBy optimally performing the operation, how much yen can you earn?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n|a_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum amount of money that can be earned.\n\nSample Input 1\n\n6\n1 2 -6 4 5 3\n\nSample Output 1\n\n12\n\nIt is optimal to smash Gem 3 and 6.\n\nSample Input 2\n\n6\n100 -100 -100 -100 100 -100\n\nSample Output 2\n\n200\n\nSample Input 3\n\n5\n-1 -2 -3 -4 -5\n\nSample Output 3\n\n0\n\nIt is optimal to smash all the gems.\n\nSample Input 4\n\n2\n-1000 100000\n\nSample Output 4\n\n99000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 848, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s607016145", "group_id": "codeNet:p03556", "input_text": "var\n n,i:longint;\nbegin\n readln(n);\n for i:=n downto 1 do if trunc(sqrt(i))=sqrt(i) then begin writeln(i);exit;end;\nend.", "language": "Pascal", "metadata": {"date": 1582067838, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03556.html", "problem_id": "p03556", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03556/input.txt", "sample_output_relpath": "derived/input_output/data/p03556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03556/Pascal/s607016145.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s607016145", "user_id": "u476418095"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "var\n n,i:longint;\nbegin\n readln(n);\n for i:=n downto 1 do if trunc(sqrt(i))=sqrt(i) then begin writeln(i);exit;end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03556", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s455392542", "group_id": "codeNet:p03557", "input_text": "program ec12;\nvar \n\tn,m,i,j:longint;\n\tans:int64;\n\ta,b,c,s,sum:array[0..100001] of int64;\nprocedure qsrt(l,r:longint);\nvar \n\tv,s:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; v:=b[(l+r) div 2];\n\trepeat\n\twhile b[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=b[i];\n\t\tb[i]:=b[j];\n\t\tb[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=c[i];\n\t\tc[i]:=c[j];\n\t\tc[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=c[j] then \n\t\tinc(j)\n\t\telse\n\t\tbegin \n\t\t\ts[i]:=n-j+1;\n\t\t\tinc(i);\n\t\tend;\n\tend;\n\ti:=1;\n\tj:=1;\n\tsum[0]:=0;\n\tfor i:=1 to n do \n\tsum[i]:=sum[i-1]+s[i];\n\tans:=0;\n\ti:=1;\n\tj:=1;\n\twhile (i<=n) and (j<=n) do \n\tbegin \n\t\tif a[i]>=b[j] then \n\t\tinc(j)\n\t\telse\n\t\tbegin \n\t\t\tans:=ans+sum[n]-sum[j-1];\n\t\t\tinc(i);\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1510180875, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03557.html", "problem_id": "p03557", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03557/input.txt", "sample_output_relpath": "derived/input_output/data/p03557/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03557/Pascal/s455392542.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s455392542", "user_id": "u018679195"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j:longint;\n\tans:int64;\n\ta,b,c,s,sum:array[0..100001] of int64;\nprocedure qsrt(l,r:longint);\nvar \n\tv,s:int64;\n\ti,j:longint;\nbegin\n\ti:=l; j:=r; v:=b[(l+r) div 2];\n\trepeat\n\twhile b[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=b[i];\n\t\tb[i]:=b[j];\n\t\tb[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=c[i];\n\t\tc[i]:=c[j];\n\t\tc[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=c[j] then \n\t\tinc(j)\n\t\telse\n\t\tbegin \n\t\t\ts[i]:=n-j+1;\n\t\t\tinc(i);\n\t\tend;\n\tend;\n\ti:=1;\n\tj:=1;\n\tsum[0]:=0;\n\tfor i:=1 to n do \n\tsum[i]:=sum[i-1]+s[i];\n\tans:=0;\n\ti:=1;\n\tj:=1;\n\twhile (i<=n) and (j<=n) do \n\tbegin \n\t\tif a[i]>=b[j] then \n\t\tinc(j)\n\t\telse\n\t\tbegin \n\t\t\tans:=ans+sum[n]-sum[j-1];\n\t\t\tinc(i);\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03557", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1552, "cpu_time_ms": 76, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s746583523", "group_id": "codeNet:p03558", "input_text": "var n:string;\n i,w,ans,min,k,j:longint;\n a,b:array[0..100000]of longint;\nprocedure gao;\nvar i:longint;\nbegin\n for i:=1 to k do \n a[i]:=a[i]+b[i];\n for i:=1 to w do \n if a[i]>9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 800000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[length(n)-i+1];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 800000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[i];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 200000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=0;\n for i:=length(n) downto 1 do\n begin\n a[length(n)-i+1]:=ord(n[i])-48;\n min:=min+a[i];\n end; \n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 200000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=maxlongint;\n for i:=length(n) downto 1 do\n a[length(n)-i+1]:=ord(n[i])-48;\n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 20000 do \n begin\n ans:=0;\n gao;\n if ans9\n then begin\n a[i+1]:=a[i+1]+1;\n a[i]:=a[i]-10;\n end; \n if a[w+1]>0\n then w:=w+1;\n for i:=1 to w do \n ans:=ans+a[i];\nend;\nbegin\n readln(n);\n min:=maxlongint;\n for i:=length(n) downto 1 do\n a[length(n)-i+1]:=ord(n[i])-48;\n for i:=1 to length(n) do\n b[i]:=a[i]; \n k:=length(n);\n w:=length(n); \n for i:=1 to 20000 do \n begin\n ans:=0;\n gao;\n if ansdist[now]+i then\n begin\n dist[y]:=dist[now]+i;\n if not v[y] then\n begin\n v[y]:=true;\n inc(tail);\n q[tail]:=y;\n end;\n end;\n end;\n inc(head);\n v[y]:=false;\n end;\nend;\nbegin\n read(n);\n spfa;\n writeln(dist[0]);\nend.\n", "language": "Pascal", "metadata": {"date": 1509850347, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03560.html", "problem_id": "p03560", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03560/input.txt", "sample_output_relpath": "derived/input_output/data/p03560/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03560/Pascal/s209060475.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s209060475", "user_id": "u809476955"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n:longint;\n dist:array[0..100050]of longint;\n q:array[0..5000050]of longint;\n v:array[0..100050]of boolean;\nprocedure spfa;\nvar head,tail:longint;\n i,now,y:longint;\nbegin\n head:=1;\n tail:=0;\n for i:=1 to n-1 do\n dist[i]:=i;\n dist[0]:=1 << 25;\n for i:=0 to n-1 do\n begin\n inc(tail);\n q[tail]:=i;\n v[i]:=true;\n end;\n while head<=tail do\n begin\n now:=q[head];\n for i:=0 to 9 do\n begin\n y:=(now*10+i) mod n;\n if dist[y]>dist[now]+i then\n begin\n dist[y]:=dist[now]+i;\n if not v[y] then\n begin\n v[y]:=true;\n inc(tail);\n q[tail]:=y;\n end;\n end;\n end;\n inc(head);\n v[y]:=false;\n end;\nend;\nbegin\n read(n);\n spfa;\n writeln(dist[0]);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nConstraints\n\n2 \\leq K \\leq 10^5\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\n12=6×2 yields the smallest sum.\n\nSample Input 2\n\n41\n\nSample Output 2\n\n5\n\n11111=41×271 yields the smallest sum.\n\nSample Input 3\n\n79992\n\nSample Output 3\n\n36", "sample_input": "6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03560", "source_text": "Score : 700 points\n\nProblem Statement\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nConstraints\n\n2 \\leq K \\leq 10^5\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\n12=6×2 yields the smallest sum.\n\nSample Input 2\n\n41\n\nSample Output 2\n\n5\n\n11111=41×271 yields the smallest sum.\n\nSample Input 3\n\n79992\n\nSample Output 3\n\n36", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 762, "cpu_time_ms": 45, "memory_kb": 1920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s229516574", "group_id": "codeNet:p03566", "input_text": "var\n\tn,i,j,ans,p,f,now,c:Longint;\n\tsum,t,v:array[0..101]of Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(t[i]);\n\t\tt[i]:=t[i]*2;\n\t\tsum[i]:=sum[i-1]+t[i];\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(v[i]);\n\t\tv[i]:=v[i]*2;\n\tend;\n\tfor i:=1 to sum[n]do begin\n\t\tif i>sum[f] then inc(f);\n\t\tnow:=v[f];\n\t\tfor j:=0 to n+1 do begin\n\t\t\tif jf then c:=v[j]+sum[j-1]-i else c:=now;\n\t\t\tif now>c then now:=c;\n\t\tend;\n\t\tans:=ans+p+now;\n\t\tp:=now;\n\tend;\n\twriteln(ans/8:0:9);\nend.\n", "language": "Pascal", "metadata": {"date": 1539083361, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03566.html", "problem_id": "p03566", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03566/input.txt", "sample_output_relpath": "derived/input_output/data/p03566/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03566/Pascal/s229516574.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s229516574", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2100.000000000000000\n", "input_to_evaluate": "var\n\tn,i,j,ans,p,f,now,c:Longint;\n\tsum,t,v:array[0..101]of Longint;\nbegin\n\tread(n);\n\tfor i:=1 to n do begin\n\t\tread(t[i]);\n\t\tt[i]:=t[i]*2;\n\t\tsum[i]:=sum[i-1]+t[i];\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(v[i]);\n\t\tv[i]:=v[i]*2;\n\tend;\n\tfor i:=1 to sum[n]do begin\n\t\tif i>sum[f] then inc(f);\n\t\tnow:=v[f];\n\t\tfor j:=0 to n+1 do begin\n\t\t\tif jf then c:=v[j]+sum[j-1]-i else c:=now;\n\t\t\tif now>c then now:=c;\n\t\tend;\n\t\tans:=ans+p+now;\n\t\tp:=now;\n\tend;\n\twriteln(ans/8:0:9);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express.\n\nIn the plan developed by the president Takahashi, the trains will run as follows:\n\nA train will run for (t_1 + t_2 + t_3 + ... + t_N) seconds.\n\nIn the first t_1 seconds, a train must run at a speed of at most v_1 m/s (meters per second). Similarly, in the subsequent t_2 seconds, a train must run at a speed of at most v_2 m/s, and so on.\n\nAccording to the specifications of the trains, the acceleration of a train must be always within ±1m/s^2. Additionally, a train must stop at the beginning and the end of the run.\n\nFind the maximum possible distance that a train can cover in the run.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq t_i \\leq 200\n\n1 \\leq v_i \\leq 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 t_2 t_3 … t_N\nv_1 v_2 v_3 … v_N\n\nOutput\n\nPrint the maximum possible that a train can cover in the run.\n\nOutput is considered correct if its absolute difference from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n1\n100\n30\n\nSample Output 1\n\n2100.000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 30 seconds, it accelerates at a rate of 1m/s^2, covering 450 meters.\n\nIn the subsequent 40 seconds, it maintains the velocity of 30m/s, covering 1200 meters.\n\nIn the last 30 seconds, it decelerates at the acceleration of -1m/s^2, covering 450 meters.\n\nThe total distance covered is 450 + 1200 + 450 = 2100 meters.\n\nSample Input 2\n\n2\n60 50\n34 38\n\nSample Output 2\n\n2632.000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 34 seconds, it accelerates at a rate of 1m/s^2, covering 578 meters.\n\nIn the subsequent 26 seconds, it maintains the velocity of 34m/s, covering 884 meters.\n\nIn the subsequent 4 seconds, it accelerates at a rate of 1m/s^2, covering 144 meters.\n\nIn the subsequent 8 seconds, it maintains the velocity of 38m/s, covering 304 meters.\n\nIn the last 38 seconds, it decelerates at the acceleration of -1m/s^2, covering 722 meters.\n\nThe total distance covered is 578 + 884 + 144 + 304 + 722 = 2632 meters.\n\nSample Input 3\n\n3\n12 14 2\n6 2 7\n\nSample Output 3\n\n76.000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 6 seconds, it accelerates at a rate of 1m/s^2, covering 18 meters.\n\nIn the subsequent 2 seconds, it maintains the velocity of 6m/s, covering 12 meters.\n\nIn the subsequent 4 seconds, it decelerates at the acceleration of -1m/s^2, covering 16 meters.\n\nIn the subsequent 14 seconds, it maintains the velocity of 2m/s, covering 28 meters.\n\nIn the last 2 seconds, it decelerates at the acceleration of -1m/s^2, covering 2 meters.\n\nThe total distance covered is 18 + 12 + 16 + 28 + 2 = 76 meters.\n\nSample Input 4\n\n1\n9\n10\n\nSample Output 4\n\n20.250000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 4.5 seconds, it accelerates at a rate of 1m/s^2, covering 10.125 meters.\n\nIn the last 4.5 seconds, it decelerates at the acceleration of -1m/s^2, covering 10.125 meters.\n\nThe total distance covered is 10.125 + 10.125 = 20.25 meters.\n\nSample Input 5\n\n10\n64 55 27 35 76 119 7 18 49 100\n29 19 31 39 27 48 41 87 55 70\n\nSample Output 5\n\n20291.000000000000", "sample_input": "1\n100\n30\n"}, "reference_outputs": ["2100.000000000000000\n"], "source_document_id": "p03566", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express.\n\nIn the plan developed by the president Takahashi, the trains will run as follows:\n\nA train will run for (t_1 + t_2 + t_3 + ... + t_N) seconds.\n\nIn the first t_1 seconds, a train must run at a speed of at most v_1 m/s (meters per second). Similarly, in the subsequent t_2 seconds, a train must run at a speed of at most v_2 m/s, and so on.\n\nAccording to the specifications of the trains, the acceleration of a train must be always within ±1m/s^2. Additionally, a train must stop at the beginning and the end of the run.\n\nFind the maximum possible distance that a train can cover in the run.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq t_i \\leq 200\n\n1 \\leq v_i \\leq 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 t_2 t_3 … t_N\nv_1 v_2 v_3 … v_N\n\nOutput\n\nPrint the maximum possible that a train can cover in the run.\n\nOutput is considered correct if its absolute difference from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n1\n100\n30\n\nSample Output 1\n\n2100.000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 30 seconds, it accelerates at a rate of 1m/s^2, covering 450 meters.\n\nIn the subsequent 40 seconds, it maintains the velocity of 30m/s, covering 1200 meters.\n\nIn the last 30 seconds, it decelerates at the acceleration of -1m/s^2, covering 450 meters.\n\nThe total distance covered is 450 + 1200 + 450 = 2100 meters.\n\nSample Input 2\n\n2\n60 50\n34 38\n\nSample Output 2\n\n2632.000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 34 seconds, it accelerates at a rate of 1m/s^2, covering 578 meters.\n\nIn the subsequent 26 seconds, it maintains the velocity of 34m/s, covering 884 meters.\n\nIn the subsequent 4 seconds, it accelerates at a rate of 1m/s^2, covering 144 meters.\n\nIn the subsequent 8 seconds, it maintains the velocity of 38m/s, covering 304 meters.\n\nIn the last 38 seconds, it decelerates at the acceleration of -1m/s^2, covering 722 meters.\n\nThe total distance covered is 578 + 884 + 144 + 304 + 722 = 2632 meters.\n\nSample Input 3\n\n3\n12 14 2\n6 2 7\n\nSample Output 3\n\n76.000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 6 seconds, it accelerates at a rate of 1m/s^2, covering 18 meters.\n\nIn the subsequent 2 seconds, it maintains the velocity of 6m/s, covering 12 meters.\n\nIn the subsequent 4 seconds, it decelerates at the acceleration of -1m/s^2, covering 16 meters.\n\nIn the subsequent 14 seconds, it maintains the velocity of 2m/s, covering 28 meters.\n\nIn the last 2 seconds, it decelerates at the acceleration of -1m/s^2, covering 2 meters.\n\nThe total distance covered is 18 + 12 + 16 + 28 + 2 = 76 meters.\n\nSample Input 4\n\n1\n9\n10\n\nSample Output 4\n\n20.250000000000000000\n\nThe maximum distance is achieved when a train runs as follows:\n\nIn the first 4.5 seconds, it accelerates at a rate of 1m/s^2, covering 10.125 meters.\n\nIn the last 4.5 seconds, it decelerates at the acceleration of -1m/s^2, covering 10.125 meters.\n\nThe total distance covered is 10.125 + 10.125 = 20.25 meters.\n\nSample Input 5\n\n10\n64 55 27 35 76 119 7 18 49 100\n29 19 31 39 27 48 41 87 55 70\n\nSample Output 5\n\n20291.000000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 497, "cpu_time_ms": 12, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s774345975", "group_id": "codeNet:p03570", "input_text": "var s:ansistring;\n num:array[0..200050,'a'..'z']of longint;\n ans:int64;\n cannot:boolean;\n i,j,x:longint;\n can:longint;\n n:longint;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n do\n begin\n inc(num[i,s[i]]);\n for j:=97 to 122 do\n num[i,char(j)]:=num[i,char(j)]+num[i-1,char(j)];\n end;\n i:=n;\n while i>0 do\n begin\n for x:=0 to i-1 do\n begin\n cannot:=false;\n if (i-x) mod 2=1 then can:=1 else can:=0;\n for j:=97 to 122 do\n if (num[i,char(j)]-num[x,char(j)])mod 2=1 then\n begin\n dec(can);\n if can<0 then\n begin\n cannot:=true;\n break;\n end;\n end;\n if not cannot then\n begin\n inc(ans);\n i:=x;\n break;\n end;\n end;\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1508726993, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03570.html", "problem_id": "p03570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03570/input.txt", "sample_output_relpath": "derived/input_output/data/p03570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03570/Pascal/s774345975.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s774345975", "user_id": "u809476955"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var s:ansistring;\n num:array[0..200050,'a'..'z']of longint;\n ans:int64;\n cannot:boolean;\n i,j,x:longint;\n can:longint;\n n:longint;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n do\n begin\n inc(num[i,s[i]]);\n for j:=97 to 122 do\n num[i,char(j)]:=num[i,char(j)]+num[i-1,char(j)];\n end;\n i:=n;\n while i>0 do\n begin\n for x:=0 to i-1 do\n begin\n cannot:=false;\n if (i-x) mod 2=1 then can:=1 else can:=0;\n for j:=97 to 122 do\n if (num[i,char(j)]-num[x,char(j)])mod 2=1 then\n begin\n dec(can);\n if can<0 then\n begin\n cannot:=true;\n break;\n end;\n end;\n if not cannot then\n begin\n inc(ans);\n i:=x;\n break;\n end;\n end;\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "sample_input": "aabxyyzz\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03570", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 792, "cpu_time_ms": 3155, "memory_kb": 20608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s832827714", "group_id": "codeNet:p03570", "input_text": "var s:ansistring;\n num:array[0..200050,'a'..'z']of longint;\n dp:array[0..200050]of longint;\n cannot:boolean;\n i,j,x:longint;\n can:longint;\n n:longint;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n do\n begin\n inc(num[i,s[i]]);\n if i mod 2=1 then can:=1 else can:=0;\n for j:=97 to 122 do\n num[i,char(j)]:=num[i,char(j)]+num[i-1,char(j)];\n end;\n for i:=1 to n do\n begin\n for x:=0 to i-1 do\n begin\n cannot:=false;\n if (i-x) mod 2=1 then can:=1 else can:=0;\n for j:=97 to 122 do\n if (num[i,char(j)]-num[x,char(j)]) mod 2=1 then\n begin\n dec(can);\n if can<0 then\n begin\n cannot:=true;\n break;\n end;\n end;\n if not cannot then\n begin\n dp[i]:=dp[x]+1;\n break;\n end;\n end;\n end;\n writeln(dp[n]);\nend.\n", "language": "Pascal", "metadata": {"date": 1508725222, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03570.html", "problem_id": "p03570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03570/input.txt", "sample_output_relpath": "derived/input_output/data/p03570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03570/Pascal/s832827714.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s832827714", "user_id": "u809476955"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var s:ansistring;\n num:array[0..200050,'a'..'z']of longint;\n dp:array[0..200050]of longint;\n cannot:boolean;\n i,j,x:longint;\n can:longint;\n n:longint;\nbegin\n readln(s);\n n:=length(s);\n for i:=1 to n do\n begin\n inc(num[i,s[i]]);\n if i mod 2=1 then can:=1 else can:=0;\n for j:=97 to 122 do\n num[i,char(j)]:=num[i,char(j)]+num[i-1,char(j)];\n end;\n for i:=1 to n do\n begin\n for x:=0 to i-1 do\n begin\n cannot:=false;\n if (i-x) mod 2=1 then can:=1 else can:=0;\n for j:=97 to 122 do\n if (num[i,char(j)]-num[x,char(j)]) mod 2=1 then\n begin\n dec(can);\n if can<0 then\n begin\n cannot:=true;\n break;\n end;\n end;\n if not cannot then\n begin\n dp[i]:=dp[x]+1;\n break;\n end;\n end;\n end;\n writeln(dp[n]);\nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "sample_input": "aabxyyzz\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03570", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke is partitioning s into some number of non-empty substrings.\nLet the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)\nSnuke wants to satisfy the following condition:\n\nFor each i (1 \\leq i \\leq N), it is possible to permute the characters in s_i and obtain a palindrome.\n\nFind the minimum possible value of N when the partition satisfies the condition.\n\nConstraints\n\n1 \\leq |s| \\leq 2 \\times 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum possible value of N when the partition satisfies the condition.\n\nSample Input 1\n\naabxyyzz\n\nSample Output 1\n\n2\n\nThe solution is to partition s as aabxyyzz = aab + xyyzz.\nHere, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.\n\nSample Input 2\n\nbyebye\n\nSample Output 2\n\n1\n\nbyebye can be permuted to form a palindrome byeeyb.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\n\nSample Output 3\n\n26\n\nSample Input 4\n\nabcabcxabcx\n\nSample Output 4\n\n3\n\nThe solution is to partition s as abcabcxabcx = a + b + cabcxabcx.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 845, "cpu_time_ms": 3155, "memory_kb": 21376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s309213197", "group_id": "codeNet:p03575", "input_text": "uses math;\nvar\n head,next,d,dfn,low,a:array[0..200005]of longint;\n insta:array[0..200005]of boolean;\n n,m,i,x,y,k,num,s,son,ans:longint;\nprocedure add(x,y:longint);\nbegin\n inc(num);\n d[num]:=y;\n next[num]:=head[x];\n head[x]:=num;\nend;\nprocedure dfs(u,fa:longint);\nvar\n v,ll:longint;\n flag:boolean;\nbegin\n inc(s);\n dfn[u]:=s;\n low[u]:=s;\n ll:=head[u];\n insta[u]:=true;\n flag:=true;\n while ll<>0 do\n begin\n v:=d[ll];\n if v=fa then\n begin\n ll:=next[ll];\n continue;\n end;\n if dfn[v]=0 then\n begin\n dfs(v,u);\n low[u]:=min(low[u],low[v]);\n if low[v]>dfn[u] then\n inc(ans);\n end else\n low[u]:=min(low[u],dfn[v]);\n ll:=next[ll];\n end;\n insta[u]:=false;\nend;\nprocedure qsort(l,r:longint);\nvar\n i,j,k,t:longint;\nbegin\n i:=l;\n j:=r;\n k:=(i+j) div 2;\n t:=a[k];\n a[k]:=a[i];\n while it) do\n dec(j);\n if il then\n qsort(l,i-1);\n if i+10 do\n begin\n v:=d[ll];\n if v=fa then\n begin\n ll:=next[ll];\n continue;\n end;\n if dfn[v]=0 then\n begin\n dfs(v,u);\n low[u]:=min(low[u],low[v]);\n if low[v]>dfn[u] then\n inc(ans);\n end else\n low[u]:=min(low[u],dfn[v]);\n ll:=next[ll];\n end;\n insta[u]:=false;\nend;\nprocedure qsort(l,r:longint);\nvar\n i,j,k,t:longint;\nbegin\n i:=l;\n j:=r;\n k:=(i+j) div 2;\n t:=a[k];\n a[k]:=a[i];\n while it) do\n dec(j);\n if il then\n qsort(l,i-1);\n if i+1d[x]) do dec(j);\n if(i<=j)then\n begin\n e:=d[i];d[i]:=d[j];d[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if it[x]) do dec(j);\n if(i<=j)then\n begin\n e:=t[i];t[i]:=t[j];t[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if i=1)and(tt>=1)do\n begin\n if t[tt]=d[td] then begin dec(tt);dec(td);end\n else if t[tt]d[td])or(td=0))then begin writeln('NO');exit;end;\n end;\n writeln('YES');\nend.\n\n", "language": "Pascal", "metadata": {"date": 1507513433, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03578.html", "problem_id": "p03578", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03578/input.txt", "sample_output_relpath": "derived/input_output/data/p03578/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03578/Pascal/s670901200.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s670901200", "user_id": "u144400850"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var\n n,m,i:longint;\n d,t:array[1..200000]of longint;\n bd,bt:array[1..200000]of boolean;\n td,tt:longint;\n\nprocedure sort( l,r:longint);\nvar\n x,e,j,i:longint;\nbegin\n i:=l;j:=r;x:=(l+r)div 2;\n repeat\n while (d[i]d[x]) do dec(j);\n if(i<=j)then\n begin\n e:=d[i];d[i]:=d[j];d[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if it[x]) do dec(j);\n if(i<=j)then\n begin\n e:=t[i];t[i]:=t[j];t[j]:=e;inc(i);dec(j);end;\n until(i>j);\n if i=1)and(tt>=1)do\n begin\n if t[tt]=d[td] then begin dec(tt);dec(td);end\n else if t[tt]d[td])or(td=0))then begin writeln('NO');exit;end;\n end;\n writeln('YES');\nend.\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRng is preparing a problem set for a qualification round of CODEFESTIVAL.\n\nHe has N candidates of problems. The difficulty of the i-th candidate is D_i.\n\nThere must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.\n\nDetermine whether Rng can complete the problem set without creating new candidates of problems.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq D_i \\leq 10^9\n\n1 \\leq M \\leq 200,000\n\n1 \\leq T_i \\leq 10^9\n\nAll numbers in the input are integers.\n\nPartial Score\n\n100 points will be awarded for passing the test set satisfying N \\leq 100 and M \\leq 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD_1 D_2 ... D_N\nM\nT_1 T_2 ... T_M\n\nOutput\n\nPrint YES if Rng can complete the problem set without creating new candidates of problems; print NO if he cannot.\n\nSample Input 1\n\n5\n3 1 4 1 5\n3\n5 4 3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n7\n100 200 500 700 1200 1600 2000\n6\n100 200 500 700 1600 1600\n\nSample Output 2\n\nNO\n\nNot enough 1600s.\n\nSample Input 3\n\n1\n800\n5\n100 100 100 100 100\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n15\n1 2 2 3 3 3 4 4 4 4 5 5 5 5 5\n9\n5 4 3 2 1 2 3 4 5\n\nSample Output 4\n\nYES", "sample_input": "5\n3 1 4 1 5\n3\n5 4 3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03578", "source_text": "Score : 200 points\n\nProblem Statement\n\nRng is preparing a problem set for a qualification round of CODEFESTIVAL.\n\nHe has N candidates of problems. The difficulty of the i-th candidate is D_i.\n\nThere must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.\n\nDetermine whether Rng can complete the problem set without creating new candidates of problems.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq D_i \\leq 10^9\n\n1 \\leq M \\leq 200,000\n\n1 \\leq T_i \\leq 10^9\n\nAll numbers in the input are integers.\n\nPartial Score\n\n100 points will be awarded for passing the test set satisfying N \\leq 100 and M \\leq 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD_1 D_2 ... D_N\nM\nT_1 T_2 ... T_M\n\nOutput\n\nPrint YES if Rng can complete the problem set without creating new candidates of problems; print NO if he cannot.\n\nSample Input 1\n\n5\n3 1 4 1 5\n3\n5 4 3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n7\n100 200 500 700 1200 1600 2000\n6\n100 200 500 700 1600 1600\n\nSample Output 2\n\nNO\n\nNot enough 1600s.\n\nSample Input 3\n\n1\n800\n5\n100 100 100 100 100\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n15\n1 2 2 3 3 3 4 4 4 4 5 5 5 5 5\n9\n5 4 3 2 1 2 3 4 5\n\nSample Output 4\n\nYES", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1124, "cpu_time_ms": 93, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s418421648", "group_id": "codeNet:p03578", "input_text": "type\n arr=array[1..200000]of longint;\nvar\n n,i,m,j,x:longint;\n d,t:arr;\n\n procedure sort(l,r:longint;var a:arr);\n var\n i,j,x,y:longint;\n begin\n i:=l; j:=r;\n x:=a[(l+r) div 2];\n while i<=j do\n begin\n while a[i]t[j] then begin writeln('NO'); halt; end;\n end;\n writeln('NO');\nend.", "language": "Pascal", "metadata": {"date": 1507511920, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03578.html", "problem_id": "p03578", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03578/input.txt", "sample_output_relpath": "derived/input_output/data/p03578/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03578/Pascal/s418421648.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s418421648", "user_id": "u741737016"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "type\n arr=array[1..200000]of longint;\nvar\n n,i,m,j,x:longint;\n d,t:arr;\n\n procedure sort(l,r:longint;var a:arr);\n var\n i,j,x,y:longint;\n begin\n i:=l; j:=r;\n x:=a[(l+r) div 2];\n while i<=j do\n begin\n while a[i]t[j] then begin writeln('NO'); halt; end;\n end;\n writeln('NO');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRng is preparing a problem set for a qualification round of CODEFESTIVAL.\n\nHe has N candidates of problems. The difficulty of the i-th candidate is D_i.\n\nThere must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.\n\nDetermine whether Rng can complete the problem set without creating new candidates of problems.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq D_i \\leq 10^9\n\n1 \\leq M \\leq 200,000\n\n1 \\leq T_i \\leq 10^9\n\nAll numbers in the input are integers.\n\nPartial Score\n\n100 points will be awarded for passing the test set satisfying N \\leq 100 and M \\leq 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD_1 D_2 ... D_N\nM\nT_1 T_2 ... T_M\n\nOutput\n\nPrint YES if Rng can complete the problem set without creating new candidates of problems; print NO if he cannot.\n\nSample Input 1\n\n5\n3 1 4 1 5\n3\n5 4 3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n7\n100 200 500 700 1200 1600 2000\n6\n100 200 500 700 1600 1600\n\nSample Output 2\n\nNO\n\nNot enough 1600s.\n\nSample Input 3\n\n1\n800\n5\n100 100 100 100 100\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n15\n1 2 2 3 3 3 4 4 4 4 5 5 5 5 5\n9\n5 4 3 2 1 2 3 4 5\n\nSample Output 4\n\nYES", "sample_input": "5\n3 1 4 1 5\n3\n5 4 3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03578", "source_text": "Score : 200 points\n\nProblem Statement\n\nRng is preparing a problem set for a qualification round of CODEFESTIVAL.\n\nHe has N candidates of problems. The difficulty of the i-th candidate is D_i.\n\nThere must be M problems in the problem set, and the difficulty of the i-th problem must be T_i. Here, one candidate of a problem cannot be used as multiple problems.\n\nDetermine whether Rng can complete the problem set without creating new candidates of problems.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq D_i \\leq 10^9\n\n1 \\leq M \\leq 200,000\n\n1 \\leq T_i \\leq 10^9\n\nAll numbers in the input are integers.\n\nPartial Score\n\n100 points will be awarded for passing the test set satisfying N \\leq 100 and M \\leq 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD_1 D_2 ... D_N\nM\nT_1 T_2 ... T_M\n\nOutput\n\nPrint YES if Rng can complete the problem set without creating new candidates of problems; print NO if he cannot.\n\nSample Input 1\n\n5\n3 1 4 1 5\n3\n5 4 3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n7\n100 200 500 700 1200 1600 2000\n6\n100 200 500 700 1600 1600\n\nSample Output 2\n\nNO\n\nNot enough 1600s.\n\nSample Input 3\n\n1\n800\n5\n100 100 100 100 100\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n15\n1 2 2 3 3 3 4 4 4 4 5 5 5 5 5\n9\n5 4 3 2 1 2 3 4 5\n\nSample Output 4\n\nYES", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 897, "cpu_time_ms": 100, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s077659075", "group_id": "codeNet:p03578", "input_text": "type\n arr=array[0..200500]of longint;\n\nvar x:longint;\n a,b:arr;\n n,m:longint;\n i,j:longint;\nprocedure qs(var a:arr;l,r:longint);\nvar i,j:longint;\n m,t:longint;\nbegin\n i:=l;\n j:=r;\n m:=a[(l+r)>>1];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l>1];\n repeat\n while a[i]m do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);\n dec(j);\n end;\n until i>j;\n if l0 do\n begin\n //if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=0 then cg:=ss(t[i],3-sc) and cg;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;//writeln(q,' ',t[i],' ',cg);\n i:=nx[i];\n end;//writeln(q,' ',cg);\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "language": "Pascal", "metadata": {"date": 1569856669, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s464483717.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s464483717", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin //writeln(' ',q,' ',sc);\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n //if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=0 then cg:=ss(t[i],3-sc) and cg;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;//writeln(q,' ',t[i],' ',cg);\n i:=nx[i];\n end;//writeln(q,' ',cg);\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1208, "cpu_time_ms": 30, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s088543036", "group_id": "codeNet:p03579", "input_text": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin //writeln(' ',q,' ',sc);\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n //if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=0 then cg:=ss(t[i],3-sc) and cg;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;//writeln(q,' ',t[i],' ',cg);\n i:=nx[i];\n end;//writeln(q,' ',cg);\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "language": "Pascal", "metadata": {"date": 1569853428, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s088543036.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s088543036", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin //writeln(' ',q,' ',sc);\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n //if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=0 then cg:=ss(t[i],3-sc) and cg;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;//writeln(q,' ',t[i],' ',cg);\n i:=nx[i];\n end;//writeln(q,' ',cg);\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1208, "cpu_time_ms": 30, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s146432598", "group_id": "codeNet:p03579", "input_text": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin writeln(' ',q,' ',sc);\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n //if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=0 then cg:=ss(t[i],3-sc) and cg;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;writeln(q,' ',t[i],' ',cg);\n i:=nx[i];\n end;writeln(q,' ',cg);\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "language": "Pascal", "metadata": {"date": 1569853388, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s146432598.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s146432598", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin writeln(' ',q,' ',sc);\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n //if (ys[t[i]]=0)and(ss(t[i],3-sc)=false) then cg:=false;\n if ys[t[i]]=0 then cg:=ss(t[i],3-sc) and cg;\n if ys[t[i]]=sc then\n begin\n cg:=false;\n flag:=false;\n end;writeln(q,' ',t[i],' ',cg);\n i:=nx[i];\n end;writeln(q,' ',cg);\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n if ss(i,1)<>flag then writeln('?');\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1202, "cpu_time_ms": 139, "memory_kb": 8576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s705729458", "group_id": "codeNet:p03579", "input_text": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n if ys[t[i]]=0 then cg:=cg and ss(t[i],3-sc);\n if ys[t[i]]=sc then flag:=false;\n i:=nx[i];\n end;\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n ss(i,1);\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "language": "Pascal", "metadata": {"date": 1569851191, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Pascal/s705729458.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705729458", "user_id": "u005813231"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n flag:boolean;\n da,sl:int64;\n hs:array[1..2] of int64;\n x,y,n,u,m,i:longint;\n hd,nx,t,ys:array[0..200100] of longint;\n procedure jb(x,y:longint);\n begin\n u:=u+1;\n nx[u]:=hd[x];\n hd[x]:=u;\n t[u]:=y;\n end;\n function ss(q,sc:longint):boolean;\n var\n i:longint;\n cg:boolean;\n begin\n ys[q]:=sc;\n sl:=sl+1;\n hs[sc]:=hs[sc]+1;\n cg:=true;\n i:=hd[q];\n while i<>0 do\n begin\n if ys[t[i]]=0 then cg:=cg and ss(t[i],3-sc);\n if ys[t[i]]=sc then flag:=false;\n i:=nx[i];\n end;\n exit(cg);\n end;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x,y);\n jb(x,y);\n jb(y,x);\n end;\n for i:=1 to n do\n if ys[i]=0 then\n begin\n hs[1]:=0;\n hs[2]:=0;\n sl:=0;\n flag:=true;\n ss(i,1);\n if flag then da:=da+hs[1]*hs[2]\n else da:=da+sl*(sl-1) div 2;\n end;\n writeln(da-m);\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 965, "cpu_time_ms": 30, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s488855815", "group_id": "codeNet:p03580", "input_text": " Uses Math;\n\n\n const MAX_N = 500000 + 120;\n \n var S : AnsiString;\n N : LongInt;\n ans : Int64;\n \n \n var dp : array [ 0 .. MAX_N , 1 .. 2 ] of LongInt;\n size : array [ 1 .. MAX_N + 12 ] of LongInt;\n \n procedure Solve ( l , R : LongInt ) ;\n var i : LongInt;\n x , cnt : LongInt;\n begin\n if ( L + 2 > R ) then exit();\n \n for i := 1 to R - L + 10 do\n begin\n dp[i][1] := 0;\n dp[i][2] := 0;\n size[i] := 0;\n end;\n \n cnt := 0;\n x := 0;\n \n \n if ( S[R] = '0' ) then halt(1);\n \n for i := L to R do\n begin\n if ( s[i] = '1' ) then\n begin\n cnt += 1;\n end\n else\n begin\n inc ( x ) ;\n size[x] := cnt - 1;\n cnt := 0;\n end;\n end;\n size[x+1] := cnt - 1;\n \n \n \n \n dp[0][1] := 0;\n dp[0][2] := 0;\n \n dp[1][1] := size[1] + 1;\n if ( X <> 1 ) then\n dp[1][2] := 1 + (size[2] - 1)\n else\n dp[1][2] := 1 + (size[2]);\n \n for i := 2 to X do\n begin\n \n if ( size[i] <> 0 ) then // not 10101\n begin\n dp[i][1] := max ( dp[i-1][1] + (size[i] - 1) + 1 , dp[i-1][2] + 1 ); \n if ( i = X ) then\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] + 1\n else\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] - 1 + 1;\n end\n else\n begin\n dp[i][1] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + 1 );\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] + 1 );\n end;\n dp[i][1] := max ( dp[i][1] , dp[i][2] );\n end;\n \n \n \n ans += max ( dp[x][1] , dp[x][2] );\n \n end;\n \n var last : LongINt;\n \n var i : LongInt;\n \nbegin\n ans := 0;\n \n readLn ( N ) ; \n readLn ( S ) ;\n \n last := 0;\n \n for i := 1 to N do\n begin\n if ( S[i] = '0' ) and ( S[i+1] = '0' ) then\n begin\n Solve ( last + 1 , i - 1 );\n last := i + 1;\n end;\n end;\n \n if ( S[n] = '0' ) then\n Solve ( last + 1 , n-1 )\n else\n Solve ( last + 1 , n );\n \n writeLn ( ans );\n \n \nend.\n", "language": "Pascal", "metadata": {"date": 1507517615, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03580.html", "problem_id": "p03580", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03580/input.txt", "sample_output_relpath": "derived/input_output/data/p03580/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03580/Pascal/s488855815.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s488855815", "user_id": "u941440321"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " Uses Math;\n\n\n const MAX_N = 500000 + 120;\n \n var S : AnsiString;\n N : LongInt;\n ans : Int64;\n \n \n var dp : array [ 0 .. MAX_N , 1 .. 2 ] of LongInt;\n size : array [ 1 .. MAX_N + 12 ] of LongInt;\n \n procedure Solve ( l , R : LongInt ) ;\n var i : LongInt;\n x , cnt : LongInt;\n begin\n if ( L + 2 > R ) then exit();\n \n for i := 1 to R - L + 10 do\n begin\n dp[i][1] := 0;\n dp[i][2] := 0;\n size[i] := 0;\n end;\n \n cnt := 0;\n x := 0;\n \n \n if ( S[R] = '0' ) then halt(1);\n \n for i := L to R do\n begin\n if ( s[i] = '1' ) then\n begin\n cnt += 1;\n end\n else\n begin\n inc ( x ) ;\n size[x] := cnt - 1;\n cnt := 0;\n end;\n end;\n size[x+1] := cnt - 1;\n \n \n \n \n dp[0][1] := 0;\n dp[0][2] := 0;\n \n dp[1][1] := size[1] + 1;\n if ( X <> 1 ) then\n dp[1][2] := 1 + (size[2] - 1)\n else\n dp[1][2] := 1 + (size[2]);\n \n for i := 2 to X do\n begin\n \n if ( size[i] <> 0 ) then // not 10101\n begin\n dp[i][1] := max ( dp[i-1][1] + (size[i] - 1) + 1 , dp[i-1][2] + 1 ); \n if ( i = X ) then\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] + 1\n else\n dp[i][2] := max ( dp[i-1][1] , dp[i-1][2] ) + size[i+1] - 1 + 1;\n end\n else\n begin\n dp[i][1] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + 1 );\n dp[i][2] := max ( max ( dp[i-1][1] , dp[i-1][2] ) , max(dp[i-2][1] , dp[i-2][2] ) + size[x+1] + 1 );\n end;\n dp[i][1] := max ( dp[i][1] , dp[i][2] );\n end;\n \n \n \n ans += max ( dp[x][1] , dp[x][2] );\n \n end;\n \n var last : LongINt;\n \n var i : LongInt;\n \nbegin\n ans := 0;\n \n readLn ( N ) ; \n readLn ( S ) ;\n \n last := 0;\n \n for i := 1 to N do\n begin\n if ( S[i] = '0' ) and ( S[i+1] = '0' ) then\n begin\n Solve ( last + 1 , i - 1 );\n last := i + 1;\n end;\n end;\n \n if ( S[n] = '0' ) then\n Solve ( last + 1 , n-1 )\n else\n Solve ( last + 1 , n );\n \n writeLn ( ans );\n \n \nend.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nN cells are arranged in a row.\nSome of them may contain tokens.\nYou are given a string s that consists of 0s and 1s.\nIf the i-th character of s is 1, the i-th cell (from left) contains a token.\nOtherwise, it doesn't contain a token.\n\nSnuke wants to perform the following operation as many times as possible.\nIn each operation, he chooses three consecutive cells.\nLet's call the cells X, Y, Z from left to right.\nIn order for the operation to be valid, both X and Z must contain tokens and Y must not contain a token.\nThen, he removes these two tokens and puts a new token on Y.\n\nHow many operations can he perform if he performs operations in the optimal way?\n\nConstraints\n\n1 \\leq N \\leq 500,000\n\n|s| = N\n\nEach character in s is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n1010101\n\nSample Output 1\n\n2\n\nFor example, he can perform two operations in the following way:\n\nPerform an operation on the last three cells. Now the string that represents tokens becomes 1010010.\n\nPerform an operation on the first three cells. Now the string that represents tokens becomes 0100010.\n\nNote that the choice of operations matters.\nFor example, if he chooses three cells in the middle first, he can perform no more operations.\n\nSample Input 2\n\n50\n10101000010011011110001001111110000101010111100110\n\nSample Output 2\n\n10", "sample_input": "7\n1010101\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03580", "source_text": "Score : 700 points\n\nProblem Statement\n\nN cells are arranged in a row.\nSome of them may contain tokens.\nYou are given a string s that consists of 0s and 1s.\nIf the i-th character of s is 1, the i-th cell (from left) contains a token.\nOtherwise, it doesn't contain a token.\n\nSnuke wants to perform the following operation as many times as possible.\nIn each operation, he chooses three consecutive cells.\nLet's call the cells X, Y, Z from left to right.\nIn order for the operation to be valid, both X and Z must contain tokens and Y must not contain a token.\nThen, he removes these two tokens and puts a new token on Y.\n\nHow many operations can he perform if he performs operations in the optimal way?\n\nConstraints\n\n1 \\leq N \\leq 500,000\n\n|s| = N\n\nEach character in s is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n1010101\n\nSample Output 1\n\n2\n\nFor example, he can perform two operations in the following way:\n\nPerform an operation on the last three cells. Now the string that represents tokens becomes 1010010.\n\nPerform an operation on the first three cells. Now the string that represents tokens becomes 0100010.\n\nNote that the choice of operations matters.\nFor example, if he chooses three cells in the middle first, he can perform no more operations.\n\nSample Input 2\n\n50\n10101000010011011110001001111110000101010111100110\n\nSample Output 2\n\n10", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1979, "cpu_time_ms": 9, "memory_kb": 6784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s644428051", "group_id": "codeNet:p03583", "input_text": "var\n\tN,B,C:int64;\n\tA:Longint;\nbegin\n\tread(N);\n\tif N mod 2=0 then begin\n\t\twriteln(N,' ',N,' ',N div 2);\n\t\texit;\n\tend else if N mod 3=0 then begin\n\t\twriteln(N*2,' ',N*2,' ',N div 3);\n\t\texit;\n\tend;\n\tfor A:=3*N div 4 downto 1 do begin\n\t\tB:=2*N*A div(4*A-N);\n\t\twhile 4*A*B>N*(A+B)do begin\n\t\t\tif N*A*B mod(4*A*B-N*(A+B))=0 then begin\n\t\t\t\twriteln(A,' ',B,' ',N*A*B div(4*A*B-N*(A+B)));\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tdec(B);\n\t\tend;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1579344216, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03583.html", "problem_id": "p03583", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03583/input.txt", "sample_output_relpath": "derived/input_output/data/p03583/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03583/Pascal/s644428051.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644428051", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 2 2\n", "input_to_evaluate": "var\n\tN,B,C:int64;\n\tA:Longint;\nbegin\n\tread(N);\n\tif N mod 2=0 then begin\n\t\twriteln(N,' ',N,' ',N div 2);\n\t\texit;\n\tend else if N mod 3=0 then begin\n\t\twriteln(N*2,' ',N*2,' ',N div 3);\n\t\texit;\n\tend;\n\tfor A:=3*N div 4 downto 1 do begin\n\t\tB:=2*N*A div(4*A-N);\n\t\twhile 4*A*B>N*(A+B)do begin\n\t\t\tif N*A*B mod(4*A*B-N*(A+B))=0 then begin\n\t\t\t\twriteln(A,' ',B,' ',N*A*B div(4*A*B-N*(A+B)));\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tdec(B);\n\t\tend;\n\tend;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "sample_input": "2\n"}, "reference_outputs": ["1 2 2\n"], "source_document_id": "p03583", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 425, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s496665699", "group_id": "codeNet:p03583", "input_text": "var\n\tN,B,C:int64;\n\tA:Longint;\nbegin\n\tread(N);\n\tif N mod 2=0 then begin\n\t\twriteln(N,' ',N,' ',N div 2);\n\t\texit;\n\tend else if N mod 3=0 then begin\n\t\twriteln(N*2,' ',N*2,' ',N div 3);\n\t\texit;\n\tend;\n\tfor A:=3*N div 4 downto 1 do begin\n\t\tB:=A;\n\t\twhile 4*A*B>N*(A+B)do begin\n\t\t\tif N*A*B mod(4*A*B-N*(A+B))=0 then begin\n\t\t\t\twriteln(A,' ',B,' ',N*A*B div(4*A*B-N*(A+B)));\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tdec(B);\n\t\tend;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1579343702, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03583.html", "problem_id": "p03583", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03583/input.txt", "sample_output_relpath": "derived/input_output/data/p03583/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03583/Pascal/s496665699.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s496665699", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 2 2\n", "input_to_evaluate": "var\n\tN,B,C:int64;\n\tA:Longint;\nbegin\n\tread(N);\n\tif N mod 2=0 then begin\n\t\twriteln(N,' ',N,' ',N div 2);\n\t\texit;\n\tend else if N mod 3=0 then begin\n\t\twriteln(N*2,' ',N*2,' ',N div 3);\n\t\texit;\n\tend;\n\tfor A:=3*N div 4 downto 1 do begin\n\t\tB:=A;\n\t\twhile 4*A*B>N*(A+B)do begin\n\t\t\tif N*A*B mod(4*A*B-N*(A+B))=0 then begin\n\t\t\t\twriteln(A,' ',B,' ',N*A*B div(4*A*B-N*(A+B)));\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tdec(B);\n\t\tend;\n\tend;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "sample_input": "2\n"}, "reference_outputs": ["1 2 2\n"], "source_document_id": "p03583", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 410, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s003245505", "group_id": "codeNet:p03588", "input_text": "var\n a,t,i,j:longint;\n b,c,d:array[0..100009]of longint;\nbegin\nreadln(a);\nfor i:=1 to a do\nbegin\nreadln(b[i],c[i]);\nd[i]:=b[i]+c[i];\nend;\nfor i:=1 to a do\n for j:=i+1 to a do\n if d[i]>d[j] then begin t:=d[i];d[i]:=d[j];d[j]:=t; end;\nwriteln(d[1]);\nend.", "language": "Pascal", "metadata": {"date": 1506823737, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03588.html", "problem_id": "p03588", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03588/input.txt", "sample_output_relpath": "derived/input_output/data/p03588/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03588/Pascal/s003245505.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s003245505", "user_id": "u052575225"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var\n a,t,i,j:longint;\n b,c,d:array[0..100009]of longint;\nbegin\nreadln(a);\nfor i:=1 to a do\nbegin\nreadln(b[i],c[i]);\nd[i]:=b[i]+c[i];\nend;\nfor i:=1 to a do\n for j:=i+1 to a do\n if d[i]>d[j] then begin t:=d[i];d[i]:=d[j];d[j]:=t; end;\nwriteln(d[1]);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA group of people played a game. All players had distinct scores, which are positive integers.\n\nTakahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.\n\nFind the maximum possible number of players in the game.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n0 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\nIf i ≠ j, A_i ≠ A_j.\n\nThere exists a possible outcome of the game that are consistent with the facts.\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutputs\n\nPrint the maximum possible number of players in the game.\n\nSample Input 1\n\n3\n4 7\n2 9\n6 2\n\nSample Output 1\n\n8\n\nThe maximum possible number of players is achieved when, for example, the players have the following scores: 12,9,8,7,5,2,1,0.\n\nSample Input 2\n\n5\n1 10\n3 6\n5 2\n4 4\n2 8\n\nSample Output 2\n\n7\n\nSample Input 3\n\n2\n1 1000000000\n1000000000 1\n\nSample Output 3\n\n1000000001", "sample_input": "3\n4 7\n2 9\n6 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03588", "source_text": "Score : 200 points\n\nProblem Statement\n\nA group of people played a game. All players had distinct scores, which are positive integers.\n\nTakahashi knows N facts on the players' scores. The i-th fact is as follows: the A_i-th highest score among the players is B_i.\n\nFind the maximum possible number of players in the game.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n0 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\nIf i ≠ j, A_i ≠ A_j.\n\nThere exists a possible outcome of the game that are consistent with the facts.\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutputs\n\nPrint the maximum possible number of players in the game.\n\nSample Input 1\n\n3\n4 7\n2 9\n6 2\n\nSample Output 1\n\n8\n\nThe maximum possible number of players is achieved when, for example, the players have the following scores: 12,9,8,7,5,2,1,0.\n\nSample Input 2\n\n5\n1 10\n3 6\n5 2\n4 4\n2 8\n\nSample Output 2\n\n7\n\nSample Input 3\n\n2\n1 1000000000\n1000000000 1\n\nSample Output 3\n\n1000000001", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 2103, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s735751531", "group_id": "codeNet:p03589", "input_text": "var n,i,j,k,num:longint;\nbegin\n read(n);\n for i:=1 to 3500 do\n for j:=i to 3500 do\n begin\n if (4*i*j-n*i-n*j)<=0 then continue;\n num:=trunc((n*i*j)/(4*i*j-n*i-n*j));\n if ((n*i*j)/(4*i*j-n*i-n*j)=num) then begin writeln(i,' ',j,' ',num);exit;end;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1506824432, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03589.html", "problem_id": "p03589", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03589/input.txt", "sample_output_relpath": "derived/input_output/data/p03589/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03589/Pascal/s735751531.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s735751531", "user_id": "u379604713"}, "prompt_components": {"gold_output": "1 2 2\n", "input_to_evaluate": "var n,i,j,k,num:longint;\nbegin\n read(n);\n for i:=1 to 3500 do\n for j:=i to 3500 do\n begin\n if (4*i*j-n*i-n*j)<=0 then continue;\n num:=trunc((n*i*j)/(4*i*j-n*i-n*j));\n if ((n*i*j)/(4*i*j-n*i-n*j)=num) then begin writeln(i,' ',j,' ',num);exit;end;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "sample_input": "2\n"}, "reference_outputs": ["1 2 2\n"], "source_document_id": "p03589", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 8, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s334616530", "group_id": "codeNet:p03589", "input_text": "var n,z:int64;\n x,y:longint;\nbegin\n readln(n);\n for x:=1 to 3500 do\n for y:=1 to 3500 do\n if 4*x*y-(n*(x+y))>0 then\n if (x*y*n) mod (4*x*y-n*(x+y))=0 then\n begin\n z:=(x*y*n) div (4*x*y-n*(x+y));\n writeln(x,' ',y,' ',z);\n exit;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1506821245, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03589.html", "problem_id": "p03589", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03589/input.txt", "sample_output_relpath": "derived/input_output/data/p03589/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03589/Pascal/s334616530.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s334616530", "user_id": "u809476955"}, "prompt_components": {"gold_output": "1 2 2\n", "input_to_evaluate": "var n,z:int64;\n x,y:longint;\nbegin\n readln(n);\n for x:=1 to 3500 do\n for y:=1 to 3500 do\n if 4*x*y-(n*(x+y))>0 then\n if (x*y*n) mod (4*x*y-n*(x+y))=0 then\n begin\n z:=(x*y*n) div (4*x*y-n*(x+y));\n writeln(x,' ',y,' ',z);\n exit;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "sample_input": "2\n"}, "reference_outputs": ["1 2 2\n"], "source_document_id": "p03589", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 8, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s271824227", "group_id": "codeNet:p03591", "input_text": "var\na:array [1..255] of char;\nb:string;\nh,i:longint;\nbegin\nread(b);\nfor i:=1 to length(b) do\nbegin\nif length(b)<4 then h:=1\nelse a[i]:=b[i];\nend;\nif h<>1 then\nif (a[1]='Y') and (a[2]='A') and (a[3]='K') and (a[4]='I') then\nwrite('Yes')\nelse write('No')\nelse write('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1538699429, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03591.html", "problem_id": "p03591", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03591/input.txt", "sample_output_relpath": "derived/input_output/data/p03591/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03591/Pascal/s271824227.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s271824227", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\na:array [1..255] of char;\nb:string;\nh,i:longint;\nbegin\nread(b);\nfor i:=1 to length(b) do\nbegin\nif length(b)<4 then h:=1\nelse a[i]:=b[i];\nend;\nif h<>1 then\nif (a[1]='Y') and (a[2]='A') and (a[3]='K') and (a[4]='I') then\nwrite('Yes')\nelse write('No')\nelse write('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nRingo is giving a present to Snuke.\n\nRingo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with YAKI in Japanese, and does not like other things.\n\nYou are given a string S representing the Japanese name of Ringo's present to Snuke. Determine whether S starts with YAKI.\n\nConstraints\n\n1 \\leq |S| \\leq 10\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S starts with YAKI, print Yes; otherwise, print No.\n\nSample Input 1\n\nYAKINIKU\n\nSample Output 1\n\nYes\n\nYAKINIKU starts with YAKI.\n\nSample Input 2\n\nTAKOYAKI\n\nSample Output 2\n\nNo\n\nTAKOYAKI (a Japanese snack. tako: octopus) does not start with YAKI.\n\nSample Input 3\n\nYAK\n\nSample Output 3\n\nNo", "sample_input": "YAKINIKU\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03591", "source_text": "Score : 100 points\n\nProblem Statement\n\nRingo is giving a present to Snuke.\n\nRingo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with YAKI in Japanese, and does not like other things.\n\nYou are given a string S representing the Japanese name of Ringo's present to Snuke. Determine whether S starts with YAKI.\n\nConstraints\n\n1 \\leq |S| \\leq 10\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S starts with YAKI, print Yes; otherwise, print No.\n\nSample Input 1\n\nYAKINIKU\n\nSample Output 1\n\nYes\n\nYAKINIKU starts with YAKI.\n\nSample Input 2\n\nTAKOYAKI\n\nSample Output 2\n\nNo\n\nTAKOYAKI (a Japanese snack. tako: octopus) does not start with YAKI.\n\nSample Input 3\n\nYAK\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 277, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s902135657", "group_id": "codeNet:p03591", "input_text": "var\ns:string;\nbegin\nread(s);\nif pos('YAKI',s)=1 then writeln('Yes')\nelse\nwriteln('No');\nend.", "language": "Pascal", "metadata": {"date": 1534347350, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03591.html", "problem_id": "p03591", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03591/input.txt", "sample_output_relpath": "derived/input_output/data/p03591/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03591/Pascal/s902135657.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s902135657", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\ns:string;\nbegin\nread(s);\nif pos('YAKI',s)=1 then writeln('Yes')\nelse\nwriteln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nRingo is giving a present to Snuke.\n\nRingo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with YAKI in Japanese, and does not like other things.\n\nYou are given a string S representing the Japanese name of Ringo's present to Snuke. Determine whether S starts with YAKI.\n\nConstraints\n\n1 \\leq |S| \\leq 10\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S starts with YAKI, print Yes; otherwise, print No.\n\nSample Input 1\n\nYAKINIKU\n\nSample Output 1\n\nYes\n\nYAKINIKU starts with YAKI.\n\nSample Input 2\n\nTAKOYAKI\n\nSample Output 2\n\nNo\n\nTAKOYAKI (a Japanese snack. tako: octopus) does not start with YAKI.\n\nSample Input 3\n\nYAK\n\nSample Output 3\n\nNo", "sample_input": "YAKINIKU\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03591", "source_text": "Score : 100 points\n\nProblem Statement\n\nRingo is giving a present to Snuke.\n\nRingo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: grilled, niku: meat). He supposes that Snuke likes grilled things starting with YAKI in Japanese, and does not like other things.\n\nYou are given a string S representing the Japanese name of Ringo's present to Snuke. Determine whether S starts with YAKI.\n\nConstraints\n\n1 \\leq |S| \\leq 10\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S starts with YAKI, print Yes; otherwise, print No.\n\nSample Input 1\n\nYAKINIKU\n\nSample Output 1\n\nYes\n\nYAKINIKU starts with YAKI.\n\nSample Input 2\n\nTAKOYAKI\n\nSample Output 2\n\nNo\n\nTAKOYAKI (a Japanese snack. tako: octopus) does not start with YAKI.\n\nSample Input 3\n\nYAK\n\nSample Output 3\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 92, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s819497171", "group_id": "codeNet:p03592", "input_text": "var\n n,m,k,i,j:longint;\nbegin\n readln(n,m,k);\n for i:=0 to n do\n for j:=0 to m do\n if m*i+n*j-2*i*j=k then begin writeln('Yes'); halt; end;\n writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1506219736, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03592.html", "problem_id": "p03592", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03592/input.txt", "sample_output_relpath": "derived/input_output/data/p03592/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03592/Pascal/s819497171.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s819497171", "user_id": "u741737016"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n n,m,k,i,j:longint;\nbegin\n readln(n,m,k);\n for i:=0 to n do\n for j:=0 to m do\n if m*i+n*j-2*i*j=k then begin writeln('Yes'); halt; end;\n writeln('No');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03592", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 173, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s355515970", "group_id": "codeNet:p03592", "input_text": "var i,j,k,n,m,num:longint;\nbegin\n read(n,m,k);\n for i:=0 to n do\n for j:=0 to m do\n begin\n num:=i*m+j*n-i*j*2;//writeln(i,' ',j,' ',num);\n if num=k then begin writeln('Yes');exit;end;\n end;\n writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1506217536, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03592.html", "problem_id": "p03592", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03592/input.txt", "sample_output_relpath": "derived/input_output/data/p03592/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03592/Pascal/s355515970.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355515970", "user_id": "u379604713"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,j,k,n,m,num:longint;\nbegin\n read(n,m,k);\n for i:=0 to n do\n for j:=0 to m do\n begin\n num:=i*m+j*n-i*j*2;//writeln(i,' ',j,' ',num);\n if num=k then begin writeln('Yes');exit;end;\n end;\n writeln('No');\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03592", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 232, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s209040945", "group_id": "codeNet:p03593", "input_text": "var\n h,w,i,j,t,q:longint;\n ch:char;\n a:array['a'..'z']of longint;\nbegin\n readln(h,w);\n for i:=1 to h do\n begin\n for j:=1 to w do begin read(ch); inc(a[ch]); end;\n readln;\n end;\n if (h mod 2=0)and(w mod 2=0) then\n begin\n for ch:='a' to 'z' do\n if a[ch] mod 4<>0 then begin writeln('No'); halt; end;\n writeln('Yes'); halt;\n end;\n if ((h mod 2=1)and(w mod 2=0))or((h mod 2=0)and(w mod 2=1)) then\n begin\n if w mod 2=0 then begin h:=h xor w; w:=h xor w; h:=h xor w; end;\n for ch:='a' to 'z' do\n begin\n if a[ch] mod 2<>0 then begin writeln('No'); halt; end;\n if a[ch] mod 4=2 then\n begin\n inc(t); if t>h div 2 then begin writeln('No'); halt; end;\n end;\n end;\n writeln('Yes'); halt;\n end;\n for ch:='a' to 'z' do\n begin\n if a[ch]mod 4=1 then\n begin\n inc(t); if t>1 then begin writeln('No'); halt; end;\n end;\n if a[ch] mod 4=2 then\n begin\n inc(q); if q>h div 2+w div 2 then begin writeln('No'); halt; end;\n end;\n if a[ch] mod 4=3 then\n begin\n inc(t); inc(q);\n if t>1 then begin writeln('No'); halt; end;\n if q>h div 2+w div 2 then begin writeln('No'); halt; end;\n end;\n end;\n writeln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1506221937, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03593.html", "problem_id": "p03593", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03593/input.txt", "sample_output_relpath": "derived/input_output/data/p03593/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03593/Pascal/s209040945.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s209040945", "user_id": "u741737016"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n h,w,i,j,t,q:longint;\n ch:char;\n a:array['a'..'z']of longint;\nbegin\n readln(h,w);\n for i:=1 to h do\n begin\n for j:=1 to w do begin read(ch); inc(a[ch]); end;\n readln;\n end;\n if (h mod 2=0)and(w mod 2=0) then\n begin\n for ch:='a' to 'z' do\n if a[ch] mod 4<>0 then begin writeln('No'); halt; end;\n writeln('Yes'); halt;\n end;\n if ((h mod 2=1)and(w mod 2=0))or((h mod 2=0)and(w mod 2=1)) then\n begin\n if w mod 2=0 then begin h:=h xor w; w:=h xor w; h:=h xor w; end;\n for ch:='a' to 'z' do\n begin\n if a[ch] mod 2<>0 then begin writeln('No'); halt; end;\n if a[ch] mod 4=2 then\n begin\n inc(t); if t>h div 2 then begin writeln('No'); halt; end;\n end;\n end;\n writeln('Yes'); halt;\n end;\n for ch:='a' to 'z' do\n begin\n if a[ch]mod 4=1 then\n begin\n inc(t); if t>1 then begin writeln('No'); halt; end;\n end;\n if a[ch] mod 4=2 then\n begin\n inc(q); if q>h div 2+w div 2 then begin writeln('No'); halt; end;\n end;\n if a[ch] mod 4=3 then\n begin\n inc(t); inc(q);\n if t>1 then begin writeln('No'); halt; end;\n if q>h div 2+w div 2 then begin writeln('No'); halt; end;\n end;\n end;\n writeln('Yes');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11}a_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "sample_input": "3 4\naabb\naabb\naacc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03593", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11}a_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1331, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s095157816", "group_id": "codeNet:p03594", "input_text": "var\n n,m,j,i,d,x,y:longint;\nbegin\n readln(n,m,d);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n x:=(i+j+m-2) div d mod 2;\n y:=(i-j+m) div d mod 2;\n case 2*x+y of\n 0:write('R');\n 1:write('G');\n 2:write('B');\n 3:write('Y');\n end;\n end;\n writeln;\n end; \nend.", "language": "Pascal", "metadata": {"date": 1530839547, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03594.html", "problem_id": "p03594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03594/input.txt", "sample_output_relpath": "derived/input_output/data/p03594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03594/Pascal/s095157816.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s095157816", "user_id": "u577102971"}, "prompt_components": {"gold_output": "RY\nGR\n", "input_to_evaluate": "var\n n,m,j,i,d,x,y:longint;\nbegin\n readln(n,m,d);\n for i:=1 to n do\n begin\n for j:=1 to m do\n begin\n x:=(i+j+m-2) div d mod 2;\n y:=(i-j+m) div d mod 2;\n case 2*x+y of\n 0:write('R');\n 1:write('G');\n 2:write('B');\n 3:write('Y');\n end;\n end;\n writeln;\n end; \nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "sample_input": "2 2 1\n"}, "reference_outputs": ["RY\nGR\n"], "source_document_id": "p03594", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nWe will represent the square at the i-th row from the top and j-th column from the left as (i,\\ j).\nAlso, we will define the distance between the squares (i_1,\\ j_1) and (i_2,\\ j_2) as |i_1 - i_2| + |j_1 - j_2|.\n\nSnuke is painting each square in red, yellow, green or blue.\nHere, for a given positive integer d, he wants to satisfy the following condition:\n\nNo two squares with distance exactly d have the same color.\n\nFind a way to paint the squares satisfying the condition.\nIt can be shown that a solution always exists.\n\nConstraints\n\n2 ≤ H, W ≤ 500\n\n1 ≤ d ≤ H + W - 2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W d\n\nOutput\n\nPrint a way to paint the squares satisfying the condition, in the following format. If the square (i,\\ j) is painted in red, yellow, green or blue, c_{ij} should be R, Y, G or B, respectively.\n\nc_{11}c_{12}...c_{1W}\n:\nc_{H1}c_{H2}...c_{HW}\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\nRY\nGR\n\nThere are four pairs of squares with distance exactly 1.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1), (1,\\ 2) : R, Y\n\n(1,\\ 2), (2,\\ 2) : Y, R\n\n(2,\\ 2), (2,\\ 1) : R, G\n\n(2,\\ 1), (1,\\ 1) : G, R\n\nSample Input 2\n\n2 3 2\n\nSample Output 2\n\nRYB\nRGB\n\nThere are six pairs of squares with distance exactly 2.\nAs shown below, no two such squares have the same color.\n\n(1,\\ 1) , (1,\\ 3) : R , B\n\n(1,\\ 3) , (2,\\ 2) : B , G\n\n(2,\\ 2) , (1,\\ 1) : G , R\n\n(2,\\ 1) , (2,\\ 3) : R , B\n\n(2,\\ 3) , (1,\\ 2) : B , Y\n\n(1,\\ 2) , (2,\\ 1) : Y , R", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 16, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s401692855", "group_id": "codeNet:p03601", "input_text": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tif(a=1)and(b=2)and(c=1)and(d=2)and(e=100)and(f=1000)then begin\n\t\twriteln('200 100');\n\t\texit;\n\tend;\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to f div(100*b)do begin\n\t\t\ttmp:=a*i+b*j;\n\t\t\tfor k:=0 to (f-100*b*j)div c do begin\n\t\t\t\tfor l:=0 to (f-100*b*j-c*k)div d do begin\n\t\t\t\t\tif(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+ansb;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tdec(f,100*a);\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.\n", "language": "Pascal", "metadata": {"date": 1538095029, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s401692855.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s401692855", "user_id": "u657913472"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tif(a=1)and(b=2)and(c=1)and(d=2)and(e=100)and(f=1000)then begin\n\t\twriteln('200 100');\n\t\texit;\n\tend;\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to f div(100*b)do begin\n\t\t\ttmp:=a*i+b*j;\n\t\t\tfor k:=0 to (f-100*b*j)div c do begin\n\t\t\t\tfor l:=0 to (f-100*b*j-c*k)div d do begin\n\t\t\t\t\tif(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+ansb;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\t\tdec(f,100*a);\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 595, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s840028726", "group_id": "codeNet:p03601", "input_text": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to (f-100*a*i)div(100*b)do begin\n\t\t\ttmp:=a*i+b*j;\n\t\t\tfor k:=0 to (f-100*tmp)div c do begin\n\t\t\t\tfor l:=0 to (f-100*tmp-c*k)div d do begin\n\t\t\t\t\tif(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+ansb;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.\n", "language": "Pascal", "metadata": {"date": 1538094197, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s840028726.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s840028726", "user_id": "u657913472"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var\n\ta,b,c,d,e,f,i,j,k,l,ansa,ansb,tmp:Longint;\nbegin\n\tread(a,b,c,d,e,f);\n\tansa:=100*a;\n\tfor i:=0 to f div(100*a) do begin\n\t\tfor j:=0 to (f-100*a*i)div(100*b)do begin\n\t\t\ttmp:=a*i+b*j;\n\t\t\tfor k:=0 to (f-100*tmp)div c do begin\n\t\t\t\tfor l:=0 to (f-100*tmp-c*k)div d do begin\n\t\t\t\t\tif(tmp*e>=c*k+d*l)and(ansa*(c*k+d*l)>ansb*(100*tmp+c*k+d*l))then begin\n\t\t\t\t\t\tansb:=c*k+d*l;\n\t\t\t\t\t\tansa:=100*(a*i+b*j)+ansb;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twrite(ansa);\n\twrite(' ');\n\twriteln(ansb);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 488, "cpu_time_ms": 6, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s624849347", "group_id": "codeNet:p03601", "input_text": "var\n a,b,c,d,e,f,tx,ty:longint;\n g:array[0..3000,0..3000]of integer;\n\n procedure s(su,wa:longint);\n begin\n if g[su,wa]>-1 then exit; g[su,wa]:=0;\n if su+wa*100>f then exit;\n if su>wa*e then exit;\n if (ty=0)or(su*(tx+ty*100)>(su+wa*100)*tx) then begin tx:=su; ty:=wa; end;\n s(su,wa+a); s(su,wa+b);\n s(su+c,wa); s(su+d,wa);\n end;\n\nbegin\n readln(a,b,c,d,e,f);\n tx:=0; ty:=0;\n fillchar(g,sizeof(g),255);\n s(0,0);\n writeln(tx+ty*100,' ',tx);\nend.", "language": "Pascal", "metadata": {"date": 1505614208, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Pascal/s624849347.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s624849347", "user_id": "u741737016"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "var\n a,b,c,d,e,f,tx,ty:longint;\n g:array[0..3000,0..3000]of integer;\n\n procedure s(su,wa:longint);\n begin\n if g[su,wa]>-1 then exit; g[su,wa]:=0;\n if su+wa*100>f then exit;\n if su>wa*e then exit;\n if (ty=0)or(su*(tx+ty*100)>(su+wa*100)*tx) then begin tx:=su; ty:=wa; end;\n s(su,wa+a); s(su,wa+b);\n s(su+c,wa); s(su+d,wa);\n end;\n\nbegin\n readln(a,b,c,d,e,f);\n tx:=0; ty:=0;\n fillchar(g,sizeof(g),255);\n s(0,0);\n writeln(tx+ty*100,' ',tx);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03601", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 478, "cpu_time_ms": 18, "memory_kb": 35328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s566804329", "group_id": "codeNet:p03607", "input_text": "var\n a:array[1..100001] of longint;\n n,i,s,sum:longint;\nprocedure kp(l,r:longint);\n var\n i,j,t,mid:longint;\n begin\n i:=l;j:=r;mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if il then kp(l,j);\n end;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i]);\n kp(1,n);\n s:=1;\n for i:=2 to n+1 do\n if a[i]=a[i-1] then inc(s)\n else begin\n if odd(s) then inc(sum);\n s:=1;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1581088059, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s566804329.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s566804329", "user_id": "u476418095"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[1..100001] of longint;\n n,i,s,sum:longint;\nprocedure kp(l,r:longint);\n var\n i,j,t,mid:longint;\n begin\n i:=l;j:=r;mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if il then kp(l,j);\n end;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i]);\n kp(1,n);\n s:=1;\n for i:=2 to n+1 do\n if a[i]=a[i-1] then inc(s)\n else begin\n if odd(s) then inc(sum);\n s:=1;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 583, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s729616184", "group_id": "codeNet:p03607", "input_text": "var\n a:array[1..100001] of longint;\n n,i,s,sum:longint;\n procedure kp(l,r:longint);\n var\n i,j,t,mid:longint;\n begin\n i:=l; j:=r; mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if il then kp(l,j);\n end;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i]);\n kp(1,n);\n s:=1;\n for i:=2 to n+1 do\n if a[i]=a[i-1] then inc(s)\n else\n begin\n if odd(s) then inc(sum);\n s:=1;\n end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1581030523, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s729616184.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s729616184", "user_id": "u476418095"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[1..100001] of longint;\n n,i,s,sum:longint;\n procedure kp(l,r:longint);\n var\n i,j,t,mid:longint;\n begin\n i:=l; j:=r; mid:=a[(i+j) div 2];\n repeat\n while a[i]mid do dec(j);\n if i<=j then\n begin\n t:=a[i]; a[i]:=a[j]; a[j]:=t;\n inc(i); dec(j);\n end;\n until i>j;\n if il then kp(l,j);\n end;\nbegin\n readln(n);\n for i:=1 to n do readln(a[i]);\n kp(1,n);\n s:=1;\n for i:=2 to n+1 do\n if a[i]=a[i-1] then inc(s)\n else\n begin\n if odd(s) then inc(sum);\n s:=1;\n end;\n writeln(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 651, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s305061961", "group_id": "codeNet:p03607", "input_text": "var\n n,i,j,k,l,max:longint;\n a:array[0..100000000] of boolean;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(k);\n a[k]:=not(a[k]);\n if k>max then max:=k;\n end;\n for i:=1 to max do\n begin\n if a[i] then inc(l);\n end;\n writeln(l);\nend.", "language": "Pascal", "metadata": {"date": 1541212517, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s305061961.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s305061961", "user_id": "u426964396"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,j,k,l,max:longint;\n a:array[0..100000000] of boolean;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(k);\n a[k]:=not(a[k]);\n if k>max then max:=k;\n end;\n for i:=1 to max do\n begin\n if a[i] then inc(l);\n end;\n writeln(l);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 259, "cpu_time_ms": 9, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s071333585", "group_id": "codeNet:p03607", "input_text": "var\n n,i,x,s:longint;\n a:array[0..100001] of longint;\nbegin\n readln(n);\n for i:=1 to n do \n begin\n readln(x);\n if a[x]=0 then begin inc(a[x]); inc(s); end\n else begin s:=s-a[x]; a[x]:=0; end;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1540168993, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s071333585.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s071333585", "user_id": "u723721005"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,x,s:longint;\n a:array[0..100001] of longint;\nbegin\n readln(n);\n for i:=1 to n do \n begin\n readln(x);\n if a[x]=0 then begin inc(a[x]); inc(s); end\n else begin s:=s-a[x]; a[x]:=0; end;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 9, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s598199196", "group_id": "codeNet:p03607", "input_text": "var\nn,i,j,c,d,e,b:longint;\nx:array[0..100000000] of 0..50;\nbegin\nreadln(n);\nfor i:=1 to n do begin\nread(c);\ninc(x[c]);\nend;\nfor i:=0 to 100000000 do\nif x[i]=1 then inc(e);\nwriteln(e);\nend.", "language": "Pascal", "metadata": {"date": 1534462195, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s598199196.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s598199196", "user_id": "u723721005"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\nn,i,j,c,d,e,b:longint;\nx:array[0..100000000] of 0..50;\nbegin\nreadln(n);\nfor i:=1 to n do begin\nread(c);\ninc(x[c]);\nend;\nfor i:=0 to 100000000 do\nif x[i]=1 then inc(e);\nwriteln(e);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 74, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s366578733", "group_id": "codeNet:p03607", "input_text": "var\n n,i,j,k,x:longint;\n a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(j);\n inc(k);\n a[k]:=j;\n dec(n);\n for x:=i-1 downto 1 do\n begin\n if(a[x]=j)then\n begin\n inc(n);\n break;\n end;\n end;\n end;\n writeln(n);\nend.\n", "language": "Pascal", "metadata": {"date": 1527040859, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Pascal/s366578733.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s366578733", "user_id": "u723721005"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n n,i,j,k,x:longint;\n a:array[1..100000]of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(j);\n inc(k);\n a[k]:=j;\n dec(n);\n for x:=i-1 downto 1 do\n begin\n if(a[x]=j)then\n begin\n inc(n);\n break;\n end;\n end;\n end;\n writeln(n);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 378, "cpu_time_ms": 2103, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s278280364", "group_id": "codeNet:p03607", "input_text": "program ec12;\nvar \n\tn,m,i,j,ans,tot:longint;\n\ta:array[1..100001] of longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin\n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat\n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l>1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l>1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if le do dec(d);\n\t\tif c<=d then begin\n\t\t\tf:=a[c];a[c]:=a[d];a[d]:=f;\n\t\t\tinc(c);\n\t\t\tdec(d);\n\t\tend;\n\tuntil c>d;\n\tif ce do dec(d);\n\t\tif c<=d then begin\n\t\t\tf:=a[c];a[c]:=a[d];a[d]:=f;\n\t\t\tinc(c);\n\t\t\tdec(d);\n\t\tend;\n\tuntil c>d;\n\tif c>1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if l>1];\n repeat\n while a[i]mid do dec(j);\n if i<=j then begin\n t:=a[i];a[i]:=a[j];a[j]:=t;\n inc(i);dec(j);\n end;\n until i>j;\n if la[i,x]+a[x,j] then a[i,j]:=a[i,x]+a[x,j];\n\n\tmin:=maxlongint div 2;\n\tfor i:=1 to r do begin\n\t\tf[b[i]]:=false;\n\t\tmain(0,b[i],2);\n\t\tf[b[i]]:=true;\n\tend;\n\twriteln(min);\nend.", "language": "Pascal", "metadata": {"date": 1505008020, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03608.html", "problem_id": "p03608", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03608/input.txt", "sample_output_relpath": "derived/input_output/data/p03608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03608/Pascal/s875153868.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s875153868", "user_id": "u768548097"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var min,n,i,j,x,m,r,a1,b1,c1:longint;\n\ta:array[-5..205,-5..205] of longint;\n\tb:array[-5..205]of longint;\n\tf:array[-5..205]of boolean;\nprocedure main(s,pre,now:longint);\nvar i,j,k:longint;\nbegin\n\tif now=r then begin\n\t\tfor i:=1 to r do if f[b[i]] then begin\n\t\t\tif s+a[pre,b[i]]a[i,x]+a[x,j] then a[i,j]:=a[i,x]+a[x,j];\n\n\tmin:=maxlongint div 2;\n\tfor i:=1 to r do begin\n\t\tf[b[i]]:=false;\n\t\tmain(0,b[i],2);\n\t\tf[b[i]]:=true;\n\tend;\n\twriteln(min);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N towns in the State of Atcoder, connected by M bidirectional roads.\n\nThe i-th road connects Town A_i and B_i and has a length of C_i.\n\nJoisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order).\n\nShe will fly to the first town she visits, and fly back from the last town she visits, but for the rest of the trip she will have to travel by road.\n\nIf she visits the towns in the order that minimizes the distance traveled by road, what will that distance be?\n\nConstraints\n\n2≤N≤200\n\n1≤M≤N×(N-1)/2\n\n2≤R≤min(8,N) (min(8,N) is the smaller of 8 and N.)\n\nr_i≠r_j (i≠j)\n\n1≤A_i,B_i≤N, A_i≠B_i\n\n(A_i,B_i)≠(A_j,B_j),(A_i,B_i)≠(B_j,A_j) (i≠j)\n\n1≤C_i≤100000\n\nEvery town can be reached from every town by road.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M R\nr_1 ... r_R\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nPrint the distance traveled by road if Joisino visits the towns in the order that minimizes it.\n\nSample Input 1\n\n3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4\n\nSample Output 1\n\n2\n\nFor example, if she visits the towns in the order of 1, 2, 3, the distance traveled will be 2, which is the minimum possible.\n\nSample Input 2\n\n3 3 2\n1 3\n2 3 2\n1 3 6\n1 2 2\n\nSample Output 2\n\n4\n\nThe shortest distance between Towns 1 and 3 is 4. Thus, whether she visits Town 1 or 3 first, the distance traveled will be 4.\n\nSample Input 3\n\n4 6 3\n2 3 4\n1 2 4\n2 3 3\n4 3 1\n1 4 1\n4 2 2\n3 1 6\n\nSample Output 3\n\n3", "sample_input": "3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03608", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N towns in the State of Atcoder, connected by M bidirectional roads.\n\nThe i-th road connects Town A_i and B_i and has a length of C_i.\n\nJoisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order).\n\nShe will fly to the first town she visits, and fly back from the last town she visits, but for the rest of the trip she will have to travel by road.\n\nIf she visits the towns in the order that minimizes the distance traveled by road, what will that distance be?\n\nConstraints\n\n2≤N≤200\n\n1≤M≤N×(N-1)/2\n\n2≤R≤min(8,N) (min(8,N) is the smaller of 8 and N.)\n\nr_i≠r_j (i≠j)\n\n1≤A_i,B_i≤N, A_i≠B_i\n\n(A_i,B_i)≠(A_j,B_j),(A_i,B_i)≠(B_j,A_j) (i≠j)\n\n1≤C_i≤100000\n\nEvery town can be reached from every town by road.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M R\nr_1 ... r_R\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nPrint the distance traveled by road if Joisino visits the towns in the order that minimizes it.\n\nSample Input 1\n\n3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4\n\nSample Output 1\n\n2\n\nFor example, if she visits the towns in the order of 1, 2, 3, the distance traveled will be 2, which is the minimum possible.\n\nSample Input 2\n\n3 3 2\n1 3\n2 3 2\n1 3 6\n1 2 2\n\nSample Output 2\n\n4\n\nThe shortest distance between Towns 1 and 3 is 4. Thus, whether she visits Town 1 or 3 first, the distance traveled will be 4.\n\nSample Input 3\n\n4 6 3\n2 3 4\n1 2 4\n2 3 3\n4 3 1\n1 4 1\n4 2 2\n3 1 6\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 851, "cpu_time_ms": 33, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s891383800", "group_id": "codeNet:p03610", "input_text": "var s,t:String;i:Longint;\nbegin\nreadln(s);\ni:=1;\nwhile i<=length(s) do begin\n\tt:=t+s[i];\n\tinc(i,2);\nend;\nwrite(t);\nend.", "language": "Pascal", "metadata": {"date": 1542913756, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s891383800.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s891383800", "user_id": "u657913472"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s,t:String;i:Longint;\nbegin\nreadln(s);\ni:=1;\nwhile i<=length(s) do begin\n\tt:=t+s[i];\n\tinc(i,2);\nend;\nwrite(t);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s517924422", "group_id": "codeNet:p03610", "input_text": "var\nf:string;\ni:longint;\nbegin\nread(f);\n for i:=1 to length(f) do\n if i mod 2<>0 then writeln(f[i]);\nend.", "language": "Pascal", "metadata": {"date": 1540349769, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s517924422.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s517924422", "user_id": "u426964396"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\nf:string;\ni:longint;\nbegin\nread(f);\n for i:=1 to length(f) do\n if i mod 2<>0 then writeln(f[i]);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 111, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s578166278", "group_id": "codeNet:p03610", "input_text": "var\na:array [1..1000] of char;\nf:string;\ni:longint;\nbegin\nread(f);\n for i:=1 to length(f) do \n begin\n a[i]:=f[i];\n if i mod 2<>0 then writeln(a[i]);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1540349714, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s578166278.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s578166278", "user_id": "u426964396"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\na:array [1..1000] of char;\nf:string;\ni:longint;\nbegin\nread(f);\n for i:=1 to length(f) do \n begin\n a[i]:=f[i];\n if i mod 2<>0 then writeln(a[i]);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s453925452", "group_id": "codeNet:p03610", "input_text": "var\n s:ansistring;\n i:longint;\nbegin\n readln(s);\n for i:=1 to length(s) div 2 do\n write(s[(i-1)*2+1]);writeln;\nend.", "language": "Pascal", "metadata": {"date": 1538795257, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s453925452.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s453925452", "user_id": "u426964396"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n s:ansistring;\n i:longint;\nbegin\n readln(s);\n for i:=1 to length(s) div 2 do\n write(s[(i-1)*2+1]);writeln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s626028957", "group_id": "codeNet:p03610", "input_text": "var\n ch,c:char;\nbegin\n while not eoln do begin\n read(ch);\n read(c);\n write(ch);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1534135339, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s626028957.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s626028957", "user_id": "u723721005"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var\n ch,c:char;\nbegin\n while not eoln do begin\n read(ch);\n read(c);\n write(ch);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s468644730", "group_id": "codeNet:p03610", "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,t:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(s);\n \n for i := 1 to (Length(s)+1) div 2 do\n Write(s[2*i-1]);\n \n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1517243773, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s468644730.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s468644730", "user_id": "u755925739"}, "prompt_components": {"gold_output": "acdr\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,t:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n //nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(s);\n \n for i := 1 to (Length(s)+1) div 2 do\n Write(s[2*i-1]);\n \n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s940086024", "group_id": "codeNet:p03610", "input_text": "var cc : ansistring ;\n a,b,c,d,e,f,g : longint ;\nbegin\n readln(cc);\nfor a:=1 to length(cc) do\n if a mod 2 = 1 then\n write(cc[a]);\nwriteln;\nend.", "language": "Pascal", "metadata": {"date": 1504403054, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s940086024.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s940086024", "user_id": "u704549083"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var cc : ansistring ;\n a,b,c,d,e,f,g : longint ;\nbegin\n readln(cc);\nfor a:=1 to length(cc) do\n if a mod 2 = 1 then\n write(cc[a]);\nwriteln;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 148, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s288187557", "group_id": "codeNet:p03610", "input_text": "var s:ansistring;\nvar i:longint;\nbegin\nreadln(s);for i:=1 to length(s) do if i mod 2=1 then write(s[i]);writeln;end.", "language": "Pascal", "metadata": {"date": 1504400609, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Pascal/s288187557.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s288187557", "user_id": "u379604713"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "var s:ansistring;\nvar i:longint;\nbegin\nreadln(s);for i:=1 to length(s) do if i mod 2=1 then write(s[i]);writeln;end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s468691284", "group_id": "codeNet:p03611", "input_text": "var\n n,i,x,max:longint;\n a:array[0..1000000] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n inc(a[x-1]);inc(a[x+1]);inc(a[x]);\n end;\n for i:=1 to 100000 do if a[i]>max then max:=a[i];\n writeln(max);\nend.", "language": "Pascal", "metadata": {"date": 1584062349, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03611.html", "problem_id": "p03611", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03611/input.txt", "sample_output_relpath": "derived/input_output/data/p03611/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03611/Pascal/s468691284.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s468691284", "user_id": "u426964396"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n n,i,x,max:longint;\n a:array[0..1000000] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n inc(a[x-1]);inc(a[x+1]);inc(a[x]);\n end;\n for i:=1 to 100000 do if a[i]>max then max:=a[i];\n writeln(max);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03611", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s612527186", "group_id": "codeNet:p03611", "input_text": "program ec12;\nvar \n\tn,m,i,j,x,max:longint;\n\ta:array[0..100002] of longint;\nbegin \n\tfillchar(a,sizeof(a),0);\n\treadln(n);\n\tfor i:=1 to n do \n\tbegin\n\t\tread(x);\n\t\tinc(a[x]);\n\tend;\n\tmax:=a[0]+a[1];\n\tfor i:=1 to 100000 do \n\tbegin \n\t\tif maxmax then\n max:=cc[a];\n writeln(max); \nend.\n", "language": "Pascal", "metadata": {"date": 1504403420, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03611.html", "problem_id": "p03611", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03611/input.txt", "sample_output_relpath": "derived/input_output/data/p03611/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03611/Pascal/s340155427.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s340155427", "user_id": "u704549083"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var cc : array [-1..100001] of longint ;\n max,n,a,b,c,d,e,f,g : longint ;\nbegin\n readln(n);\n for a:=1 to n do\n begin\n read(g);\n cc[g-1]:=cc[g-1]+1;\n cc[g]:=cc[g]+1;\n cc[g+1]:=cc[g+1]+1;\n end;\n for a:=-1 to 100001 do\n if cc[a]>max then\n max:=cc[a];\n writeln(max); \nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03611", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 285, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s578567343", "group_id": "codeNet:p03611", "input_text": "var a:array[0..100050]of longint;\n ans:longint;\n i:longint;\n n:longint;\n mx,x:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n begin\n read(x);\n inc(a[x]);\n if x>mx then mx:=x;\n end;\n ans:=a[0]+a[1];\n for i:=1 to mx do\n ans:=max(ans,a[i-1]+a[i]+a[i+1]);\n writeln(ans);\nend.\n\n\n", "language": "Pascal", "metadata": {"date": 1504401101, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03611.html", "problem_id": "p03611", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03611/input.txt", "sample_output_relpath": "derived/input_output/data/p03611/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03611/Pascal/s578567343.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s578567343", "user_id": "u809476955"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var a:array[0..100050]of longint;\n ans:longint;\n i:longint;\n n:longint;\n mx,x:longint;\nfunction max(a,b:longint):longint;\nbegin\n if a>b then exit(a) else exit(b);\nend;\nbegin\n read(n);\n for i:=1 to n do\n begin\n read(x);\n inc(a[x]);\n if x>mx then mx:=x;\n end;\n ans:=a[0]+a[1];\n for i:=1 to mx do\n ans:=max(ans,a[i-1]+a[i]+a[i+1]);\n writeln(ans);\nend.\n\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03611", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 381, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s520957606", "group_id": "codeNet:p03612", "input_text": "var cc : array [1..100001] of longint ;\n max,n,a,b,c,d,e,f,g : longint ;\nbegin\n readln(n);\n for a:=1 to n do\n begin\n read(cc[a]);\n end;\n for a:=1 to n do\n begin\n if cc[a]=a then\n b:=b+1\n else\n begin\n max:=max+((b+1)div 2);\n b:=0;\n end;\n end;\n if b>0 then\n max:=max+((b+1)div 2);\n writeln(max);\nend.\n", "language": "Pascal", "metadata": {"date": 1504403854, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03612.html", "problem_id": "p03612", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03612/input.txt", "sample_output_relpath": "derived/input_output/data/p03612/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03612/Pascal/s520957606.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520957606", "user_id": "u704549083"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var cc : array [1..100001] of longint ;\n max,n,a,b,c,d,e,f,g : longint ;\nbegin\n readln(n);\n for a:=1 to n do\n begin\n read(cc[a]);\n end;\n for a:=1 to n do\n begin\n if cc[a]=a then\n b:=b+1\n else\n begin\n max:=max+((b+1)div 2);\n b:=0;\n end;\n end;\n if b>0 then\n max:=max+((b+1)div 2);\n writeln(max);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "sample_input": "5\n1 4 3 5 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03612", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to achieve this.\n\nConstraints\n\n2≤N≤10^5\n\np_1,p_2,..,p_N is a permutation of 1,2,..,N.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 .. p_N\n\nOutput\n\nPrint the minimum required number of operations\n\nSample Input 1\n\n5\n1 4 3 5 2\n\nSample Output 1\n\n2\n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the condition.\nThis is the minimum possible number, so the answer is 2.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n\nSwapping 1 and 2 satisfies the condition.\n\nSample Input 3\n\n2\n2 1\n\nSample Output 3\n\n0\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n9\n1 2 4 9 5 8 7 3 6\n\nSample Output 4\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 11, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s281725615", "group_id": "codeNet:p03613", "input_text": "var n,i,j,ans,num,maxi:longint;\nvar a,b:array[0..100020] of longint;\nbegin\n read(n);for i:=1 to n do begin read(a[i]);inc(b[a[i]]);inc(b[a[i]+1]);\n inc(b[a[i]-1]);end;\nans:=0;\n for i:=0 to 100000 do\n if b[i]>ans then ans:=b[i];\n writeln(ans);{23333333333333333}\nend.", "language": "Pascal", "metadata": {"date": 1504402013, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03613.html", "problem_id": "p03613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03613/input.txt", "sample_output_relpath": "derived/input_output/data/p03613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03613/Pascal/s281725615.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s281725615", "user_id": "u168783191"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var n,i,j,ans,num,maxi:longint;\nvar a,b:array[0..100020] of longint;\nbegin\n read(n);for i:=1 to n do begin read(a[i]);inc(b[a[i]]);inc(b[a[i]+1]);\n inc(b[a[i]-1]);end;\nans:=0;\n for i:=0 to 100000 do\n if b[i]>ans then ans:=b[i];\n writeln(ans);{23333333333333333}\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "sample_input": "7\n3 1 4 1 5 9 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03613", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N, a_1,a_2,...,a_N.\n\nFor each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing.\n\nAfter these operations, you select an integer X and count the number of i such that a_i=X.\n\nMaximize this count by making optimal choices.\n\nConstraints\n\n1≤N≤10^5\n\n0≤a_i<10^5 (1≤i≤N)\n\na_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 .. a_N\n\nOutput\n\nPrint the maximum possible number of i such that a_i=X.\n\nSample Input 1\n\n7\n3 1 4 1 5 9 2\n\nSample Output 1\n\n4\n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4, the maximum possible count.\n\nSample Input 2\n\n10\n0 1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n3\n\nSample Input 3\n\n1\n99999\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 12, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s170793086", "group_id": "codeNet:p03617", "input_text": "uses Math;\nvar A,B,C,D,N:int64;\nbegin\nread(A,B,C,D,N);\nB:=Min(B,2*A);\nC:=Min(C,2*B);\nD:=Min(D,2*C);\nwriteln(N div 2*D+N mod 2*C);\nend.", "language": "Pascal", "metadata": {"date": 1579669683, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03617.html", "problem_id": "p03617", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03617/input.txt", "sample_output_relpath": "derived/input_output/data/p03617/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03617/Pascal/s170793086.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s170793086", "user_id": "u657913472"}, "prompt_components": {"gold_output": "150\n", "input_to_evaluate": "uses Math;\nvar A,B,C,D,N:int64;\nbegin\nread(A,B,C,D,N);\nB:=Min(B,2*A);\nC:=Min(C,2*B);\nD:=Min(D,2*C);\nwriteln(N div 2*D+N mod 2*C);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou've come to your favorite store Infinitesco to buy some ice tea.\n\nThe store sells ice tea in bottles of different volumes at different costs.\nSpecifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen.\nThe store has an infinite supply of bottles of each type.\n\nYou want to buy exactly N liters of ice tea. How many yen do you have to spend?\n\nConstraints\n\n1 \\leq Q, H, S, D \\leq 10^8\n\n1 \\leq N \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ H S D\nN\n\nOutput\n\nPrint the smallest number of yen you have to spend to buy exactly N liters of ice tea.\n\nSample Input 1\n\n20 30 70 90\n3\n\nSample Output 1\n\n150\n\nBuy one 2-liter bottle and two 0.5-liter bottles. You'll get 3 liters for 90 + 30 + 30 = 150 yen.\n\nSample Input 2\n\n10000 1000 100 10\n1\n\nSample Output 2\n\n100\n\nEven though a 2-liter bottle costs just 10 yen, you need only 1 liter.\nThus, you have to buy a 1-liter bottle for 100 yen.\n\nSample Input 3\n\n10 100 1000 10000\n1\n\nSample Output 3\n\n40\n\nNow it's better to buy four 0.25-liter bottles for 10 + 10 + 10 + 10 = 40 yen.\n\nSample Input 4\n\n12345678 87654321 12345678 87654321\n123456789\n\nSample Output 4\n\n1524157763907942", "sample_input": "20 30 70 90\n3\n"}, "reference_outputs": ["150\n"], "source_document_id": "p03617", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou've come to your favorite store Infinitesco to buy some ice tea.\n\nThe store sells ice tea in bottles of different volumes at different costs.\nSpecifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen.\nThe store has an infinite supply of bottles of each type.\n\nYou want to buy exactly N liters of ice tea. How many yen do you have to spend?\n\nConstraints\n\n1 \\leq Q, H, S, D \\leq 10^8\n\n1 \\leq N \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ H S D\nN\n\nOutput\n\nPrint the smallest number of yen you have to spend to buy exactly N liters of ice tea.\n\nSample Input 1\n\n20 30 70 90\n3\n\nSample Output 1\n\n150\n\nBuy one 2-liter bottle and two 0.5-liter bottles. You'll get 3 liters for 90 + 30 + 30 = 150 yen.\n\nSample Input 2\n\n10000 1000 100 10\n1\n\nSample Output 2\n\n100\n\nEven though a 2-liter bottle costs just 10 yen, you need only 1 liter.\nThus, you have to buy a 1-liter bottle for 100 yen.\n\nSample Input 3\n\n10 100 1000 10000\n1\n\nSample Output 3\n\n40\n\nNow it's better to buy four 0.25-liter bottles for 10 + 10 + 10 + 10 = 40 yen.\n\nSample Input 4\n\n12345678 87654321 12345678 87654321\n123456789\n\nSample Output 4\n\n1524157763907942", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s035278254", "group_id": "codeNet:p03618", "input_text": "var cc : array ['a'..'z',0..200000] of longint ;\n a,b,c,d,e,f,g,h,i,j : longint ;\n so :ansistring ;\n gg : char ;\n sum : int64 ;\nbegin\n readln(so);\n j:=length(so);\n for a:=1 to j do\n cc[so[a],a]:=cc[so[a],a]+1;\n for gg:='a' to 'z' do\n for a:=1 to j do\n begin\n cc[gg,a]:=cc[gg,a]+cc[gg,a-1];\n end;\n for a:=2 to j do\n begin\n sum:=sum+(a-(cc[so[a],a]-1)-1);\n // writeln(cc[so[a],a],' ',cc[so[a],a-1]);\n end;\n writeln(sum+1);\nend.\n", "language": "Pascal", "metadata": {"date": 1503803538, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03618.html", "problem_id": "p03618", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03618/input.txt", "sample_output_relpath": "derived/input_output/data/p03618/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03618/Pascal/s035278254.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s035278254", "user_id": "u704549083"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "var cc : array ['a'..'z',0..200000] of longint ;\n a,b,c,d,e,f,g,h,i,j : longint ;\n so :ansistring ;\n gg : char ;\n sum : int64 ;\nbegin\n readln(so);\n j:=length(so);\n for a:=1 to j do\n cc[so[a],a]:=cc[so[a],a]+1;\n for gg:='a' to 'z' do\n for a:=1 to j do\n begin\n cc[gg,a]:=cc[gg,a]+cc[gg,a-1];\n end;\n for a:=2 to j do\n begin\n sum:=sum+(a-(cc[so[a],a]-1)-1);\n // writeln(cc[so[a],a],' ',cc[so[a],a-1]);\n end;\n writeln(sum+1);\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou have a string A = A_1 A_2 ... A_n consisting of lowercase English letters.\n\nYou can choose any two indices i and j such that 1 \\leq i \\leq j \\leq n and reverse substring A_i A_{i+1} ... A_j.\n\nYou can perform this operation at most once.\n\nHow many different strings can you obtain?\n\nConstraints\n\n1 \\leq |A| \\leq 200,000\n\nA consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\n\nOutput\n\nPrint the number of different strings you can obtain by reversing any substring in A at most once.\n\nSample Input 1\n\naatt\n\nSample Output 1\n\n5\n\nYou can obtain aatt (don't do anything), atat (reverse A[2..3]), atta (reverse A[2..4]), ttaa (reverse A[1..4]) and taat (reverse A[1..3]).\n\nSample Input 2\n\nxxxxxxxxxx\n\nSample Output 2\n\n1\n\nWhatever substring you reverse, you'll always get xxxxxxxxxx.\n\nSample Input 3\n\nabracadabra\n\nSample Output 3\n\n44", "sample_input": "aatt\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03618", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou have a string A = A_1 A_2 ... A_n consisting of lowercase English letters.\n\nYou can choose any two indices i and j such that 1 \\leq i \\leq j \\leq n and reverse substring A_i A_{i+1} ... A_j.\n\nYou can perform this operation at most once.\n\nHow many different strings can you obtain?\n\nConstraints\n\n1 \\leq |A| \\leq 200,000\n\nA consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\n\nOutput\n\nPrint the number of different strings you can obtain by reversing any substring in A at most once.\n\nSample Input 1\n\naatt\n\nSample Output 1\n\n5\n\nYou can obtain aatt (don't do anything), atat (reverse A[2..3]), atta (reverse A[2..4]), ttaa (reverse A[1..4]) and taat (reverse A[1..3]).\n\nSample Input 2\n\nxxxxxxxxxx\n\nSample Output 2\n\n1\n\nWhatever substring you reverse, you'll always get xxxxxxxxxx.\n\nSample Input 3\n\nabracadabra\n\nSample Output 3\n\n44", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 458, "cpu_time_ms": 21, "memory_kb": 20608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s398238628", "group_id": "codeNet:p03625", "input_text": "var\n a:array[0..1000000000]of byte;\n i,n,c,max,m:longint;\n flag:boolean;\nbegin\n fillchar(a,sizeof(a),0);max:=0;\n read(n);\n for i:=1 to n do\n begin\n read(c);\n if c>max then max:=c;\n if (a[c]<=4)then inc(a[c]);\n end;\n flag:=true;m:=0;\n for i:=max downto 1 do\n begin\n if (a[i]>=4)and(m=0)then begin writeln(i*i);halt;end;\n if (a[i]>=2) then if m=0 then m:=i\n else begin writeln(m*i);halt;end;\n end;\n writeln(0);\nend. \n", "language": "Pascal", "metadata": {"date": 1504378383, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s398238628.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s398238628", "user_id": "u675137679"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n a:array[0..1000000000]of byte;\n i,n,c,max,m:longint;\n flag:boolean;\nbegin\n fillchar(a,sizeof(a),0);max:=0;\n read(n);\n for i:=1 to n do\n begin\n read(c);\n if c>max then max:=c;\n if (a[c]<=4)then inc(a[c]);\n end;\n flag:=true;m:=0;\n for i:=max downto 1 do\n begin\n if (a[i]>=4)and(m=0)then begin writeln(i*i);halt;end;\n if (a[i]>=2) then if m=0 then m:=i\n else begin writeln(m*i);halt;end;\n end;\n writeln(0);\nend. \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 621, "cpu_time_ms": 1294, "memory_kb": 976640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s170860279", "group_id": "codeNet:p03625", "input_text": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then break;\n end;\n writeln(x*y);\nend.\n", "language": "Pascal", "metadata": {"date": 1503280471, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s170860279.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s170860279", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then break;\n end;\n writeln(x*y);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 636, "cpu_time_ms": 23, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s893344819", "group_id": "codeNet:p03625", "input_text": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then break;\n end;\n writeln(x*y);\nend.\n", "language": "Pascal", "metadata": {"date": 1503280218, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Pascal/s893344819.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s893344819", "user_id": "u379604713"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array[0..100020] of int64;\nvar n,ans,x,y,num:int64;\nvar i:longint;\nprocedure qsort(l,r:int64);\nvar i,j,mid,t:int64;\nbegin\n i:=l;j:=r;mid:=a[(l+r)>>1];\n repeat\n while a[i]>mid do inc(i);\n while a[j]j;\n if l0 then break;\n end;\n writeln(x*y);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03625", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 637, "cpu_time_ms": 24, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s922153854", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=-1000 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "language": "Pascal", "metadata": {"date": 1509564903, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Pascal/s466425911.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s466425911", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=-1000 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 937, "cpu_time_ms": 25, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s363335157", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "language": "Pascal", "metadata": {"date": 1509564387, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Pascal/s363335157.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s363335157", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 865, "cpu_time_ms": 25, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s779166019", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "language": "Pascal", "metadata": {"date": 1509564312, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Pascal/s779166019.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s779166019", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ts,v:int64;\n\ti,j:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 865, "cpu_time_ms": 26, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s551574760", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "language": "Pascal", "metadata": {"date": 1509564251, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Pascal/s551574760.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s551574760", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\ta,b,site:array[1..100001] of int64;\n\tj:int64;\n\tn,m,i,max,tot:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l=2 then \n\t\tbegin \n\t\t\tif j=0 then \n\t\t\tbegin \t\n\t\t\t\tj:=b[i];\n\t\t\t\tcontinue;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\twriteln(j*b[i]);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(0);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 857, "cpu_time_ms": 25, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s498347971", "group_id": "codeNet:p03627", "input_text": "program ec12;\nvar \n\ta:array[1..100001] of longint;\n\tn,m,i,j,max,sum,sum1:longint;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=a[(l+r) div 2];\n\trepeat \n\twhile a[i]v do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lv do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=a[i];\n\t\ta[i]:=a[j];\n\t\ta[j]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif lmid do dec(j);\n if not(i>j) then\n begin\n swap(a[i],a[j]);\n swap(b[i],b[j]);\n inc(i);\n dec(j);\n end;\n until i>j;\n if in then\n begin\n inc(dem);\n st[dem]:=b[i];\n end;\n end;\n if dem=0 then writeln('IMPOSSIBLE')\n else\n\n begin\n for i:=1 to dem do\n for j:=h[st[dem]] to h[st[dem]+1] do\n begin\n if (b[j]=n) and (a[j]=st[dem]) then\n begin\n writeln('POSSIBLE');\n halt\n end;\n end;\n writeln('IMPOSSIBLE');\n end;\nend;\n\nbegin\n // assign(input,'at_c.inp');reset(input);\n // assign(output,'at_c.out');rewrite(output);\n nhap;\n xuli;\nend.\n", "language": "Pascal", "metadata": {"date": 1501379685, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s955563540.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s955563540", "user_id": "u418972407"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "var a,b,h,st:array[0..200005]of longint;\n n,m,dem:longint;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(a[i],b[i]);\n inc(h[a[i]]);\n end;\nend;\n\nprocedure swap(var g,h:longint);\nvar temp:longint;\nbegin\n temp:=g;\n g:=h;\n h:=temp;\nend;\n\nprocedure sort(l,r:longint);\nvar i,j,mid:longint;\nbegin\n i:=l;\n j:=r;\n mid:=a[(l+r) div 2];\n repeat\n while a[i]mid do dec(j);\n if not(i>j) then\n begin\n swap(a[i],a[j]);\n swap(b[i],b[j]);\n inc(i);\n dec(j);\n end;\n until i>j;\n if in then\n begin\n inc(dem);\n st[dem]:=b[i];\n end;\n end;\n if dem=0 then writeln('IMPOSSIBLE')\n else\n\n begin\n for i:=1 to dem do\n for j:=h[st[dem]] to h[st[dem]+1] do\n begin\n if (b[j]=n) and (a[j]=st[dem]) then\n begin\n writeln('POSSIBLE');\n halt\n end;\n end;\n writeln('IMPOSSIBLE');\n end;\nend;\n\nbegin\n // assign(input,'at_c.inp');reset(input);\n // assign(output,'at_c.out');rewrite(output);\n nhap;\n xuli;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1899, "cpu_time_ms": 68, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s761456972", "group_id": "codeNet:p03645", "input_text": "const oo=10000000;\nvar n,m,nheap:longint;x,y,h,a,pos,heap,cp,c,f:array[0..500005] of longint;free:array[0..500005] of boolean;\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x[i],y[i]);\n inc(h[x[i]]);\n inc(h[y[i]]);\n end;\n for i:=2 to n+1 do\n h[i]:=h[i-1]+h[i];\n for i:=1 to m do\n begin\n A[h[x[i]]]:=y[i];\n a[h[y[i]]]:=x[i];\n C[h[x[i]]]:=1;\n C[h[y[i]]]:=1;\n dec(h[x[i]]);\n dec(h[y[i]]);\n end;\nend;\nprocedure init;\nvar i:longint;\nbegin\n for i:=1 to n do\n cp[i]:=oo;\n fillchar(free,sizeof(free),true);\n cp[1]:=0;\nend;\n\nprocedure swap(var x,y:longint);\nvar tamp:longint;\nbegin\n tamp:=x;\n x:=y;\n y:=tamp;\nend;\nprocedure upheap(i:longint);\nbegin\n if (i=1)or (cp[heap[i]]>cp[heap[i div 2]]) then exit;\n swap(heap[i],heap[i div 2]);\n swap(pos[heap[i]],pos[heap[i div 2]]);\n upheap(i div 2);\nend;\nprocedure downheap(I:longint);\nvar j:longint;\nbegin\n j:=i*2;\n if j>nheap then exit;\n if (jcp[heap[j+1]]) then inc(j);\n if cp[heap[i]]>cp[heap[j]] then\n begin\n swap(heap[i],heap[j]);\n swap(pos[heap[i]],pos[heap[j]]);\n downheap(j);\n end;\nend;\nfunction pop(v:longint):longint;\nbegin\n pop:=heap[v];\n heap[v]:=heap[nheap];\n pos[heap[v]]:=v;\n dec(nheap);\n upheap(v);\n downheap(v);\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n pos[x]:=nheap;\n heap[nheap]:=x;\n upheap(nheap);\nend;\nprocedure dijheap;\nvar v,vjp,u:longint;\nbegin\n f[1]:=1;\n push(1);\n repeat\n u:=pop(1);\n if u=n then exit;\n free[u]:=false;\n for v:=h[u]+1 to h[u+1] do\n if (free[a[v]]) then\n begin\n if cp[a[v]]>=cp[u]+c[v] then\n begin\n if cp[a[v]]>cp[u]+c[v] then F[a[v]]:=f[u]\n else f[a[v]]:=f[a[v]]+f[u];\n cp[a[v]]:=cp[u]+c[v];\n if pos[a[v]]=0 then push(a[v]) else\n begin\n vjp:=pos[a[v]];\n upheap(vjp);\n downheap(vjp);\n end;\n end\n\n end;\n until false;\nend;\nprocedure xuat;\nbegin\n if Cp[n]>2 then writeln('IMPOSSIBLE')\n else writeln('POSSIBLE');\nend;\nbegin\n \n nhap;\n init;\n dijheap;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1501379505, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Pascal/s761456972.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s761456972", "user_id": "u568973067"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "const oo=10000000;\nvar n,m,nheap:longint;x,y,h,a,pos,heap,cp,c,f:array[0..500005] of longint;free:array[0..500005] of boolean;\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n,m);\n for i:=1 to m do\n begin\n readln(x[i],y[i]);\n inc(h[x[i]]);\n inc(h[y[i]]);\n end;\n for i:=2 to n+1 do\n h[i]:=h[i-1]+h[i];\n for i:=1 to m do\n begin\n A[h[x[i]]]:=y[i];\n a[h[y[i]]]:=x[i];\n C[h[x[i]]]:=1;\n C[h[y[i]]]:=1;\n dec(h[x[i]]);\n dec(h[y[i]]);\n end;\nend;\nprocedure init;\nvar i:longint;\nbegin\n for i:=1 to n do\n cp[i]:=oo;\n fillchar(free,sizeof(free),true);\n cp[1]:=0;\nend;\n\nprocedure swap(var x,y:longint);\nvar tamp:longint;\nbegin\n tamp:=x;\n x:=y;\n y:=tamp;\nend;\nprocedure upheap(i:longint);\nbegin\n if (i=1)or (cp[heap[i]]>cp[heap[i div 2]]) then exit;\n swap(heap[i],heap[i div 2]);\n swap(pos[heap[i]],pos[heap[i div 2]]);\n upheap(i div 2);\nend;\nprocedure downheap(I:longint);\nvar j:longint;\nbegin\n j:=i*2;\n if j>nheap then exit;\n if (jcp[heap[j+1]]) then inc(j);\n if cp[heap[i]]>cp[heap[j]] then\n begin\n swap(heap[i],heap[j]);\n swap(pos[heap[i]],pos[heap[j]]);\n downheap(j);\n end;\nend;\nfunction pop(v:longint):longint;\nbegin\n pop:=heap[v];\n heap[v]:=heap[nheap];\n pos[heap[v]]:=v;\n dec(nheap);\n upheap(v);\n downheap(v);\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n pos[x]:=nheap;\n heap[nheap]:=x;\n upheap(nheap);\nend;\nprocedure dijheap;\nvar v,vjp,u:longint;\nbegin\n f[1]:=1;\n push(1);\n repeat\n u:=pop(1);\n if u=n then exit;\n free[u]:=false;\n for v:=h[u]+1 to h[u+1] do\n if (free[a[v]]) then\n begin\n if cp[a[v]]>=cp[u]+c[v] then\n begin\n if cp[a[v]]>cp[u]+c[v] then F[a[v]]:=f[u]\n else f[a[v]]:=f[a[v]]+f[u];\n cp[a[v]]:=cp[u]+c[v];\n if pos[a[v]]=0 then push(a[v]) else\n begin\n vjp:=pos[a[v]];\n upheap(vjp);\n downheap(vjp);\n end;\n end\n\n end;\n until false;\nend;\nprocedure xuat;\nbegin\n if Cp[n]>2 then writeln('IMPOSSIBLE')\n else writeln('POSSIBLE');\nend;\nbegin\n \n nhap;\n init;\n dijheap;\n xuat;\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2661, "cpu_time_ms": 91, "memory_kb": 15872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s694213449", "group_id": "codeNet:p03647", "input_text": "var\n\tN,M,i,u,v:Longint;\n\tok:Array[1..200000]of Boolean;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tif u=1 then begin\n\t\t\tif ok[v]then begin\n\t\t\t\twriteln('POSSIBLE');\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tok[v]:=True;\n\t\tend;\n\t\tif v=N then begin\n\t\t\tif ok[u]then begin\n\t\t\t\twriteln('POSSIBLE');\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tok[u]:=True;\n\t\tend;\n\tend;\n\twriteln('IMPOSSIBLE');\nend.\n", "language": "Pascal", "metadata": {"date": 1582184535, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03647.html", "problem_id": "p03647", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03647/input.txt", "sample_output_relpath": "derived/input_output/data/p03647/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03647/Pascal/s694213449.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s694213449", "user_id": "u657913472"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "var\n\tN,M,i,u,v:Longint;\n\tok:Array[1..200000]of Boolean;\nbegin\n\tread(N,M);\n\tfor i:=1 to M do begin\n\t\tread(u,v);\n\t\tif u=1 then begin\n\t\t\tif ok[v]then begin\n\t\t\t\twriteln('POSSIBLE');\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tok[v]:=True;\n\t\tend;\n\t\tif v=N then begin\n\t\t\tif ok[u]then begin\n\t\t\t\twriteln('POSSIBLE');\n\t\t\t\texit;\n\t\t\tend;\n\t\t\tok[u]:=True;\n\t\tend;\n\tend;\n\twriteln('IMPOSSIBLE');\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03647", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 44, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s748150347", "group_id": "codeNet:p03648", "input_text": "var k:int64;i,m:Longint;begin read(k);m:=k mod 50;writeln(50);for i:=1 to m do writeln(k div 50+99-m);for i:=m to 50 do writeln(k div 50+49-m)end.", "language": "Pascal", "metadata": {"date": 1539736365, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03648.html", "problem_id": "p03648", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03648/input.txt", "sample_output_relpath": "derived/input_output/data/p03648/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03648/Pascal/s748150347.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s748150347", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n3 3 3 3\n", "input_to_evaluate": "var k:int64;i,m:Longint;begin read(k);m:=k mod 50;writeln(50);for i:=1 to m do writeln(k div 50+99-m);for i:=m to 50 do writeln(k div 50+49-m)end.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller.\n\nDetermine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.\n\nIt can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.\n\nYou are given an integer K. Find an integer sequence a_i such that the number of times we will perform the above operation is exactly K. It can be shown that there is always such a sequence under the constraints on input and output in this problem.\n\nConstraints\n\n0 ≤ K ≤ 50 \\times 10^{16}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint a solution in the following format:\n\nN\na_1 a_2 ... a_N\n\nHere, 2 ≤ N ≤ 50 and 0 ≤ a_i ≤ 10^{16} + 1000 must hold.\n\nSample Input 1\n\n0\n\nSample Output 1\n\n4\n3 3 3 3\n\nSample Input 2\n\n1\n\nSample Output 2\n\n3\n1 0 3\n\nSample Input 3\n\n2\n\nSample Output 3\n\n2\n2 2\n\nThe operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].\n\nSample Input 4\n\n3\n\nSample Output 4\n\n7\n27 0 0 0 0 0 0\n\nSample Input 5\n\n1234567894848\n\nSample Output 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425", "sample_input": "0\n"}, "reference_outputs": ["4\n3 3 3 3\n"], "source_document_id": "p03648", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller.\n\nDetermine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.\n\nIt can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.\n\nYou are given an integer K. Find an integer sequence a_i such that the number of times we will perform the above operation is exactly K. It can be shown that there is always such a sequence under the constraints on input and output in this problem.\n\nConstraints\n\n0 ≤ K ≤ 50 \\times 10^{16}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint a solution in the following format:\n\nN\na_1 a_2 ... a_N\n\nHere, 2 ≤ N ≤ 50 and 0 ≤ a_i ≤ 10^{16} + 1000 must hold.\n\nSample Input 1\n\n0\n\nSample Output 1\n\n4\n3 3 3 3\n\nSample Input 2\n\n1\n\nSample Output 2\n\n3\n1 0 3\n\nSample Input 3\n\n2\n\nSample Output 3\n\n2\n2 2\n\nThe operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].\n\nSample Input 4\n\n3\n\nSample Output 4\n\n7\n27 0 0 0 0 0 0\n\nSample Input 5\n\n1234567894848\n\nSample Output 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s530802781", "group_id": "codeNet:p03649", "input_text": "var\n\ti,j,k,n:Longint;\n\ta:array[1..50]of int64;\n\tL,ans:int64;\n\tflag:Boolean;\nbegin\n\tread(n);\n\tfor i:=1 to n do read(a[i]);\n\twhile true do begin\n\t\tfor i:=n downto 2 do begin\n\t\t\tflag:=false;\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tif a[j]=n)and(a[k]-a[k+1]<=n)do inc(k);\n\t\tif k=n then begin\n\t\t\tk:=1;\n\t\t\twhile(k+1<=n)and(a[1]-a[k+1]<=k)do inc(k);\n\t\tend;\n\t\tif kk then inc(a[i],L*k)\n\t\t\t\telse inc(a[i],L*(k-1-n));\n\t\t\tend;\n\t\tend else begin\n\t\t\tL:=a[1]-n+1;\n\t\t\tinc(ans,L*n);\n\t\t\twriteln(ans);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1552631697, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03649.html", "problem_id": "p03649", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03649/input.txt", "sample_output_relpath": "derived/input_output/data/p03649/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03649/Pascal/s530802781.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s530802781", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n\ti,j,k,n:Longint;\n\ta:array[1..50]of int64;\n\tL,ans:int64;\n\tflag:Boolean;\nbegin\n\tread(n);\n\tfor i:=1 to n do read(a[i]);\n\twhile true do begin\n\t\tfor i:=n downto 2 do begin\n\t\t\tflag:=false;\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tif a[j]=n)and(a[k]-a[k+1]<=n)do inc(k);\n\t\tif k=n then begin\n\t\t\tk:=1;\n\t\t\twhile(k+1<=n)and(a[1]-a[k+1]<=k)do inc(k);\n\t\tend;\n\t\tif kk then inc(a[i],L*k)\n\t\t\t\telse inc(a[i],L*(k-1-n));\n\t\t\tend;\n\t\tend else begin\n\t\t\tL:=a[1]-n+1;\n\t\t\tinc(ans,L*n);\n\t\t\twriteln(ans);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the same as the one in Problem D.)\n\nDetermine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.\n\nIt can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.\n\nYou are given the sequence a_i. Find the number of times we will perform the above operation.\n\nConstraints\n\n2 ≤ N ≤ 50\n\n0 ≤ a_i ≤ 10^{16} + 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of times the operation will be performed.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n0\n\nSample Input 2\n\n3\n1 0 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n2\n2 2\n\nSample Output 3\n\n2\n\nSample Input 4\n\n7\n27 0 0 0 0 0 0\n\nSample Output 4\n\n3\n\nSample Input 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425\n\nSample Output 5\n\n1234567894848", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03649", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the same as the one in Problem D.)\n\nDetermine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.\n\nIt can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.\n\nYou are given the sequence a_i. Find the number of times we will perform the above operation.\n\nConstraints\n\n2 ≤ N ≤ 50\n\n0 ≤ a_i ≤ 10^{16} + 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of times the operation will be performed.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n0\n\nSample Input 2\n\n3\n1 0 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n2\n2 2\n\nSample Output 3\n\n2\n\nSample Input 4\n\n7\n27 0 0 0 0 0 0\n\nSample Output 4\n\n3\n\nSample Input 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425\n\nSample Output 5\n\n1234567894848", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 827, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s002348672", "group_id": "codeNet:p03651", "input_text": "const\n fi='';\n fo='';\nvar n,m,res:longint;\n a:array[1..300,1..300]of longint;\n c,s:array[1..300]of longint;\n cx:array[0..300]of byte;\n g:text;\n\nprocedure solve;\nvar i,j,mj:longint;\nbegin\n for i:=1 to m do c[i]:=1;\n res:=m;\n for i:=1 to n do\n begin\n for j:=1 to n do s[j]:=0;\n mj:=1;\n for j:=1 to m do\n begin\n inc(s[a[j,c[j]]]);\n if s[mj]0 then continue;\nexit(a[x,i]);\nend;\nexit;\nend;\n\nbegin\nans:=1000;\nreadln(n,m);\nfor i:=1 to n do\nbegin\nfor j:=1 to m do\nbegin\nread(a[i,j]);\nend;\nreadln;\nend;\n\nfor i:=1 to m do\nbegin\nfillchar(c,sizeof(c),0);\nfor j:=1 to n do\ninc(c[fun(j)]);\nt:=0;\nid:=0;\nfor j:=1 to m do\nif t0 then continue;\nexit(a[x,i]);\nend;\nexit;\nend;\n\nbegin\nans:=1000;\nreadln(n,m);\nfor i:=1 to n do\nbegin\nfor j:=1 to m do\nbegin\nread(a[i,j]);\nend;\nreadln;\nend;\n\nfor i:=1 to m do\nbegin\nfillchar(c,sizeof(c),0);\nfor j:=1 to n do\ninc(c[fun(j)]);\nt:=0;\nid:=0;\nfor j:=1 to m do\nif td[maxp] then maxp:=a[i,1];\n end;\n smax:=d[maxp];\n for i:=1 to m do\n f[i]:=1;\n for i:=1 to n do\n b[i]:=1;\n for i:=2 to m do\n begin\n fillchar(d,sizeof(d),0);\n f[maxp]:=0;\n maxp:=0;\n for j:=1 to n do\n begin\n while f[a[j,b[j]]]=0 do inc(b[j]);\n if b[j]<>m+1 then\n begin\n inc(d[a[j,b[j]]]);\n if d[a[j,b[j]]]>d[maxp] then maxp:=a[j,b[j]];\n end;\n end;\n if d[maxp]d[maxp] then maxp:=a[i,1];\n end;\n smax:=d[maxp];\n for i:=1 to m do\n f[i]:=1;\n for i:=1 to n do\n b[i]:=1;\n for i:=2 to m do\n begin\n fillchar(d,sizeof(d),0);\n f[maxp]:=0;\n maxp:=0;\n for j:=1 to n do\n begin\n while f[a[j,b[j]]]=0 do inc(b[j]);\n if b[j]<>m+1 then\n begin\n inc(d[a[j,b[j]]]);\n if d[a[j,b[j]]]>d[maxp] then maxp:=a[j,b[j]];\n end;\n end;\n if d[maxp]m then \n\t\t\tbegin \n\t\t\t\twriteln(min);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(min);\nend. ", "language": "Pascal", "metadata": {"date": 1509374845, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03652.html", "problem_id": "p03652", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03652/input.txt", "sample_output_relpath": "derived/input_output/data/p03652/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03652/Pascal/s850059514.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s850059514", "user_id": "u018679195"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j,max,min:longint;\n\ta:array[1..301,1..301] of longint;\n\tvis,step:array[1..301] of longint;\n\tvis1:array[1..301] of boolean;\nbegin \n\treadln(n,m);\n\tfor i:=1 to n do \n\tfor j:=1 to m do \n\tread(a[i,j]);\n\tmin:=n;\n\tfor i:=1 to n do \n\tstep[i]:=1;\n\tfillchar(vis1,sizeof(vis1),true);\n\twhile true do \n\tbegin \t\n\t\tfillchar(vis,sizeof(vis),0);\n\t\tfor i:=1 to n do \n\t\tinc(vis[a[i,step[i]]]);\n\t\tmax:=1;\n\t\tfor i:=2 to m do \n\t\tbegin \t\n\t\t\tif vis[max]m then \n\t\t\tbegin \n\t\t\t\twriteln(min);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(min);\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "sample_input": "4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03652", "source_text": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 749, "cpu_time_ms": 10, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s710409186", "group_id": "codeNet:p03652", "input_text": "program ec12;\nvar \n\tn,m,i,j,max,min:longint;\n\ta:array[1..301,1..301] of longint;\n\tvis,step:array[1..301] of longint;\n\tvis1:array[1..301] of boolean;\nbegin \n\treadln(n,m);\n\tfor i:=1 to n do \n\tfor j:=1 to m do \n\tread(a[i,j]);\n\tmin:=n;\n\tfor i:=1 to n do \n\tstep[i]:=1;\n\tfillchar(vis1,sizeof(vis1),true);\n\twhile true do \n\tbegin \t\n\t\tfillchar(vis,sizeof(vis),0);\n\t\tfor i:=1 to n do \n\t\tinc(vis[a[i,step[i]]]);\n\t\tmax:=1;\n\t\tfor i:=2 to m do \n\t\tbegin \t\n\t\t\tif vis[max]m then \n\t\t\tbegin \n\t\t\t\twriteln(min);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(min);\nend. ", "language": "Pascal", "metadata": {"date": 1509374807, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03652.html", "problem_id": "p03652", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03652/input.txt", "sample_output_relpath": "derived/input_output/data/p03652/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03652/Pascal/s710409186.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s710409186", "user_id": "u662099472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j,max,min:longint;\n\ta:array[1..301,1..301] of longint;\n\tvis,step:array[1..301] of longint;\n\tvis1:array[1..301] of boolean;\nbegin \n\treadln(n,m);\n\tfor i:=1 to n do \n\tfor j:=1 to m do \n\tread(a[i,j]);\n\tmin:=n;\n\tfor i:=1 to n do \n\tstep[i]:=1;\n\tfillchar(vis1,sizeof(vis1),true);\n\twhile true do \n\tbegin \t\n\t\tfillchar(vis,sizeof(vis),0);\n\t\tfor i:=1 to n do \n\t\tinc(vis[a[i,step[i]]]);\n\t\tmax:=1;\n\t\tfor i:=2 to m do \n\t\tbegin \t\n\t\t\tif vis[max]m then \n\t\t\tbegin \n\t\t\t\twriteln(min);\n\t\t\t\thalt;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(min);\nend. ", "problem_context": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "sample_input": "4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03652", "source_text": "Score : 700 points\n\nProblem Statement\n\nTakahashi is hosting an sports meet.\nThere are N people who will participate. These people are conveniently numbered 1 through N.\nAlso, there are M options of sports for this event. These sports are numbered 1 through M.\nAmong these options, Takahashi will select one or more sports (possibly all) to be played in the event.\n\nTakahashi knows that Person i's j-th favorite sport is Sport A_{ij}.\nEach person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.\n\nTakahashi is worried that one of the sports will attract too many people.\nTherefore, he would like to carefully select sports to be played so that the number of the participants in the sport with the largest number of participants is minimized.\nFind the minimum possible number of the participants in the sport with the largest number of participants.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n1 \\leq M \\leq 300\n\nA_{i1} , A_{i2} , ... , A_{iM} is a permutation of the integers from 1 to M.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n:\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the minimum possible number of the participants in the sport with the largest number of participants.\n\nSample Input 1\n\n4 5\n5 1 3 4 2\n2 5 3 1 4\n2 3 1 4 5\n2 5 4 3 1\n\nSample Output 1\n\n2\n\nAssume that Sports 1, 3 and 4 are selected to be played. In this case, Person 1 will participate in Sport 1, Person 2 in Sport 3, Person 3 in Sport 3 and Person 4 in Sport 4.\nHere, the sport with the largest number of participants is Sport 3, with two participants.\nThere is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.\n\nSample Input 2\n\n3 3\n2 1 3\n2 1 3\n2 1 3\n\nSample Output 2\n\n3\n\nSince all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected.\nTherefore, the answer is 3.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 749, "cpu_time_ms": 9, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s018639888", "group_id": "codeNet:p03658", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nfunction med3(x,y,z:Integer):Integer;\nbegin\n if (x < y) then begin\n if (y < z) then\n result:= y\n else if(z < x) then\n result:= x\n else\n result:= z;\n end else begin\n if (z < y) then\n result:= y\n else if (x < z) then\n result:= x\n else\n result:= z;\n end;\nend;\n\nprocedure quicksort1(var a:array of integer;const left,right:integer);\nvar\n i,j,pivot,tmp:integer;\nbegin\n if (left < right) then begin\n i := left;\n j := right;\n pivot := med3(a[i], a[i + (j - i) div 2], a[j]);\n while true do begin\n while (a[i] < pivot) do\n inc(i);\n while (pivot < a[j]) do\n dec(j);\n if (i >= j) then\n break;\n tmp := a[i];\n a[i]:= a[j];\n a[j]:= tmp;\n inc(i);\n dec(j);\n end;\n quicksort1(a, left, i - 1);\n quicksort1(a, j + 1, right);\n end;\nend;\n\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(n);\n Readln(k);\n SetLength(l,n);\n for i := 0 to n - 1 do\n Read(l[i]);\n\n QuickSort1(l, Low(l), High(l));\n\n sum:=0;\n for i := n downto n-k do\n sum:=sum+l[i];\n\n Writeln(sum);\n Readln;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1516920366, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03658.html", "problem_id": "p03658", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03658/input.txt", "sample_output_relpath": "derived/input_output/data/p03658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03658/Pascal/s018639888.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s018639888", "user_id": "u755925739"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nfunction med3(x,y,z:Integer):Integer;\nbegin\n if (x < y) then begin\n if (y < z) then\n result:= y\n else if(z < x) then\n result:= x\n else\n result:= z;\n end else begin\n if (z < y) then\n result:= y\n else if (x < z) then\n result:= x\n else\n result:= z;\n end;\nend;\n\nprocedure quicksort1(var a:array of integer;const left,right:integer);\nvar\n i,j,pivot,tmp:integer;\nbegin\n if (left < right) then begin\n i := left;\n j := right;\n pivot := med3(a[i], a[i + (j - i) div 2], a[j]);\n while true do begin\n while (a[i] < pivot) do\n inc(i);\n while (pivot < a[j]) do\n dec(j);\n if (i >= j) then\n break;\n tmp := a[i];\n a[i]:= a[j];\n a[j]:= tmp;\n inc(i);\n dec(j);\n end;\n quicksort1(a, left, i - 1);\n quicksort1(a, j + 1, right);\n end;\nend;\n\nvar\n a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;\n l:array of Integer;\n s,s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(n);\n Readln(k);\n SetLength(l,n);\n for i := 0 to n - 1 do\n Read(l[i]);\n\n QuickSort1(l, Low(l), High(l));\n\n sum:=0;\n for i := n downto n-k do\n sum:=sum+l[i];\n\n Writeln(sum);\n Readln;\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N sticks.\nThe length of the i-th stick is l_i.\n\nSnuke is making a snake toy by joining K of the sticks together.\n\nThe length of the toy is represented by the sum of the individual sticks that compose it.\nFind the maximum possible length of the toy.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 50\n\n1 \\leq l_i \\leq 50\n\nl_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nl_1 l_2 l_3 ... l_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2 3 4 5\n\nSample Output 1\n\n12\n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5, which is the maximum possible length.\n\nSample Input 2\n\n15 14\n50 26 27 21 41 7 42 35 7 5 5 36 39 1 45\n\nSample Output 2\n\n386", "sample_input": "5 3\n1 2 3 4 5\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03658", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N sticks.\nThe length of the i-th stick is l_i.\n\nSnuke is making a snake toy by joining K of the sticks together.\n\nThe length of the toy is represented by the sum of the individual sticks that compose it.\nFind the maximum possible length of the toy.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 50\n\n1 \\leq l_i \\leq 50\n\nl_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nl_1 l_2 l_3 ... l_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2 3 4 5\n\nSample Output 1\n\n12\n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5, which is the maximum possible length.\n\nSample Input 2\n\n15 14\n50 26 27 21 41 7 42 35 7 5 5 36 39 1 45\n\nSample Output 2\n\n386", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1482, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s431427819", "group_id": "codeNet:p03659", "input_text": "var a:array[0..2000000]of longint;\n i,ans,n:longint;\n sum,su,s:int64;\nbegin\n ans:=maxlongint;\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n inc(sum,a[i]);\n end;\n for i:=1 to n-1 do\n begin\n dec(sum,a[i]);\n inc(su,a[i]);\n s:=abs(sum-su);\n if sabs(sum-t*2)then ans:=abs(sum-t*2);\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1539450050, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03661.html", "problem_id": "p03661", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03661/input.txt", "sample_output_relpath": "derived/input_output/data/p03661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03661/Pascal/s435091937.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s435091937", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tn,i:Longint;\n\tans,sum,t:int64;\n\ta:array[1..200000]of Longint;\nbegin\n\tread(n);\n\tans:=1000000000000000000;\n\tfor i:=1 to n do begin\n\t\tread(a[i]);\n\t\tsum:=sum+a[i];\n\tend;\n\tfor i:=1 to n-1 do begin\n\t\tt:=t+a[i];\n\t\tif ans>abs(sum-t*2)then ans:=abs(sum-t*2);\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03661", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 281, "cpu_time_ms": 27, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s757115553", "group_id": "codeNet:p03661", "input_text": "var\n\tn,i:Longint;\n\tans,sum,t:int64;\n\ta:array[1..100000]of Longint;\nbegin\n\tread(n);\n\tans:=1000000000000000000;\n\tfor i:=1 to n do begin\n\t\tread(a[i]);\n\t\tsum:=sum+a[i];\n\tend;\n\tfor i:=1 to n-1 do begin\n\t\tt:=t+a[i];\n\t\tif ans>abs(sum-t*2)then ans:=abs(sum-t*2);\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1539450020, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03661.html", "problem_id": "p03661", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03661/input.txt", "sample_output_relpath": "derived/input_output/data/p03661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03661/Pascal/s757115553.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s757115553", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tn,i:Longint;\n\tans,sum,t:int64;\n\ta:array[1..100000]of Longint;\nbegin\n\tread(n);\n\tans:=1000000000000000000;\n\tfor i:=1 to n do begin\n\t\tread(a[i]);\n\t\tsum:=sum+a[i];\n\tend;\n\tfor i:=1 to n-1 do begin\n\t\tt:=t+a[i];\n\t\tif ans>abs(sum-t*2)then ans:=abs(sum-t*2);\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03661", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 281, "cpu_time_ms": 110, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s921982930", "group_id": "codeNet:p03661", "input_text": "program ec12;\nvar \n\tj:int64;\n\ts:array[0..200001] of int64;\n\tn,m,i,x:longint;\nbegin \n\treadln(n);\n\ts[0]:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(x);\n\t\ts[i]:=s[i-1]+x;\n\tend;\n\tj:=maxlongint-1;\n\tfor i:=1 to n-1 do \n\tbegin\n\t\tif abs(s[n]-s[i]-s[i])n then writeln('Fennec')else writeln('Snuke');\nend.\n", "language": "Pascal", "metadata": {"date": 1539448986, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03662.html", "problem_id": "p03662", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03662/input.txt", "sample_output_relpath": "derived/input_output/data/p03662/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03662/Pascal/s413742948.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s413742948", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Fennec\n", "input_to_evaluate": "var\n\tn,i,cnt,a,b:Longint;\n\tv:array[1..100000]of array of Longint;\n\tc,d1,d2:array[1..100000]of Longint;\nprocedure dfs1(u,d:Longint);\nvar i:Longint;\nbegin\n\td1[u]:=d;\n\tfor i:=0 to c[u]-1 do if d1[v[u][i]]=0 then dfs1(v[u][i],d+1);\nend;\nprocedure dfs2(u,d:Longint);\nvar i:Longint;\nbegin\n\td2[u]:=d;\n\tfor i:=0 to c[u]-1 do if d2[v[u][i]]=0 then dfs2(v[u][i],d+1);\nend;\nbegin\n\tread(n);\n\tfor i:=2 to n do begin\n\t\tread(a,b);\n\t\tinc(c[a]);\n\t\tinc(c[b]);\n\t\tsetLength(v[a],c[a]);\n\t\tsetLength(v[b],c[b]);\n\t\tv[a][c[a]-1]:=b;\n\t\tv[b][c[b]-1]:=a;\n\tend;\n\tdfs1(1,1);\n\tdfs2(n,1);\n\tfor i:=1 to n do if d1[i]<=d2[i] then inc(cnt);\n\tif cnt*2>n then writeln('Fennec')else writeln('Snuke');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFennec and Snuke are playing a board game.\n\nOn the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the graph formed by the cells and the roads is a tree.\n\nInitially, Cell 1 is painted black, and Cell N is painted white. The other cells are not yet colored.\nFennec (who goes first) and Snuke (who goes second) alternately paint an uncolored cell.\nMore specifically, each player performs the following action in her/his turn:\n\nFennec: selects an uncolored cell that is adjacent to a black cell, and paints it black.\n\nSnuke: selects an uncolored cell that is adjacent to a white cell, and paints it white.\n\nA player loses when she/he cannot paint a cell. Determine the winner of the game when Fennec and Snuke play optimally.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i \\leq N\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\n:\na_{N-1} b_{N-1}\n\nOutput\n\nIf Fennec wins, print Fennec; if Snuke wins, print Snuke.\n\nSample Input 1\n\n7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n\nSample Output 1\n\nFennec\n\nFor example, if Fennec first paints Cell 2 black, she will win regardless of Snuke's moves.\n\nSample Input 2\n\n4\n1 4\n4 2\n2 3\n\nSample Output 2\n\nSnuke", "sample_input": "7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n"}, "reference_outputs": ["Fennec\n"], "source_document_id": "p03662", "source_text": "Score : 400 points\n\nProblem Statement\n\nFennec and Snuke are playing a board game.\n\nOn the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the graph formed by the cells and the roads is a tree.\n\nInitially, Cell 1 is painted black, and Cell N is painted white. The other cells are not yet colored.\nFennec (who goes first) and Snuke (who goes second) alternately paint an uncolored cell.\nMore specifically, each player performs the following action in her/his turn:\n\nFennec: selects an uncolored cell that is adjacent to a black cell, and paints it black.\n\nSnuke: selects an uncolored cell that is adjacent to a white cell, and paints it white.\n\nA player loses when she/he cannot paint a cell. Determine the winner of the game when Fennec and Snuke play optimally.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i \\leq N\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\n:\na_{N-1} b_{N-1}\n\nOutput\n\nIf Fennec wins, print Fennec; if Snuke wins, print Snuke.\n\nSample Input 1\n\n7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n\nSample Output 1\n\nFennec\n\nFor example, if Fennec first paints Cell 2 black, she will win regardless of Snuke's moves.\n\nSample Input 2\n\n4\n1 4\n4 2\n2 3\n\nSample Output 2\n\nSnuke", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 46, "memory_kb": 9856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s472005050", "group_id": "codeNet:p03666", "input_text": "var\n\tn,a,b,c,d,c1,c1m,dif:longint;\nbegin\n\tReadln(n, a, b, c, d);\n\tdif := abs(b - a);\n\tc1 := ((dif + ((n + 1) mod 2) * c) div (c * 2)) * 2 - ((n + 1) mod 2);\n\tc1m := (n - 1) + c1;\n\tif (((n - 1) * c <= dif) and (dif <= (n - 1) * d)) or \n\t\t((c1 <= (n - 1)) and (dif <= c1 * c + c1m * (d - c))) or\n\t\t(((c1 + 2) <= (n - 1)) and (((c1 + 2) * c) - ((n - 2) - c1m) * (d - c) <= dif)) then\n\t\tWriteln('YES')\n\telse\n\t\tWriteln('NO');\nend.\n", "language": "Pascal", "metadata": {"date": 1560910644, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03666.html", "problem_id": "p03666", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03666/input.txt", "sample_output_relpath": "derived/input_output/data/p03666/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03666/Pascal/s472005050.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s472005050", "user_id": "u564847900"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var\n\tn,a,b,c,d,c1,c1m,dif:longint;\nbegin\n\tReadln(n, a, b, c, d);\n\tdif := abs(b - a);\n\tc1 := ((dif + ((n + 1) mod 2) * c) div (c * 2)) * 2 - ((n + 1) mod 2);\n\tc1m := (n - 1) + c1;\n\tif (((n - 1) * c <= dif) and (dif <= (n - 1) * d)) or \n\t\t((c1 <= (n - 1)) and (dif <= c1 * c + c1m * (d - c))) or\n\t\t(((c1 + 2) <= (n - 1)) and (((c1 + 2) * c) - ((n - 2) - c1m) * (d - c) <= dif)) then\n\t\tWriteln('YES')\n\telse\n\t\tWriteln('NO');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares in a row.\nThe leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.\n\nAohashi would like to fill the empty squares with integers so that the following condition is satisfied:\n\nFor any two adjacent squares, the (absolute) difference of the two integers in those squares is between C and D (inclusive).\n\nAs long as the condition is satisfied, it is allowed to use arbitrarily large or small integers to fill the squares.\nDetermine whether it is possible to fill the squares under the condition.\n\nConstraints\n\n3 \\leq N \\leq 500000\n\n0 \\leq A \\leq 10^9\n\n0 \\leq B \\leq 10^9\n\n0 \\leq C \\leq D \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\n\nOutput\n\nPrint YES if it is possible to fill the squares under the condition; print NO otherwise.\n\nSample Input 1\n\n5 1 5 2 4\n\nSample Output 1\n\nYES\n\nFor example, fill the squares with the following integers: 1, -1, 3, 7, 5, from left to right.\n\nSample Input 2\n\n4 7 6 4 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n48792 105960835 681218449 90629745 90632170\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n491995 412925347 825318103 59999126 59999339\n\nSample Output 4\n\nYES", "sample_input": "5 1 5 2 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03666", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares in a row.\nThe leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.\n\nAohashi would like to fill the empty squares with integers so that the following condition is satisfied:\n\nFor any two adjacent squares, the (absolute) difference of the two integers in those squares is between C and D (inclusive).\n\nAs long as the condition is satisfied, it is allowed to use arbitrarily large or small integers to fill the squares.\nDetermine whether it is possible to fill the squares under the condition.\n\nConstraints\n\n3 \\leq N \\leq 500000\n\n0 \\leq A \\leq 10^9\n\n0 \\leq B \\leq 10^9\n\n0 \\leq C \\leq D \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\n\nOutput\n\nPrint YES if it is possible to fill the squares under the condition; print NO otherwise.\n\nSample Input 1\n\n5 1 5 2 4\n\nSample Output 1\n\nYES\n\nFor example, fill the squares with the following integers: 1, -1, 3, 7, 5, from left to right.\n\nSample Input 2\n\n4 7 6 4 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n48792 105960835 681218449 90629745 90632170\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n491995 412925347 825318103 59999126 59999339\n\nSample Output 4\n\nYES", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 426, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s035662150", "group_id": "codeNet:p03673", "input_text": "var\n n,i,j:longint;\n a,b:array[0..200001] of int64;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n a[0]:=a[1];\n for i:=1 to n div 2 do\n b[i]:=a[n-(i-1)*2];\n for i:=n downto n div 2+1 do\n b[i]:=a[(n+1)-(n-i+1)*2];\n for i:=1 to n do\n write(b[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1571615992, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Pascal/s035662150.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s035662150", "user_id": "u426964396"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "var\n n,i,j:longint;\n a,b:array[0..200001] of int64;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n a[0]:=a[1];\n for i:=1 to n div 2 do\n b[i]:=a[n-(i-1)*2];\n for i:=n downto n div 2+1 do\n b[i]:=a[(n+1)-(n-i+1)*2];\n for i:=1 to n do\n write(b[i],' ');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 260, "cpu_time_ms": 73, "memory_kb": 5120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s440900265", "group_id": "codeNet:p03673", "input_text": "var\n n,i,j:longint;\n a,b:array[0..100001] of int64;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n a[0]:=a[1];\n for i:=1 to n div 2 do\n b[i]:=a[n-(i-1)*2];\n for i:=n downto n div 2+1 do\n b[i]:=a[(n+1)-(n-i+1)*2];\n for i:=1 to n do\n write(b[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1571615917, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Pascal/s440900265.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s440900265", "user_id": "u723721005"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "var\n n,i,j:longint;\n a,b:array[0..100001] of int64;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n a[0]:=a[1];\n for i:=1 to n div 2 do\n b[i]:=a[n-(i-1)*2];\n for i:=n downto n div 2+1 do\n b[i]:=a[(n+1)-(n-i+1)*2];\n for i:=1 to n do\n write(b[i],' ');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 260, "cpu_time_ms": 31, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s557521126", "group_id": "codeNet:p03673", "input_text": "var\n n,i,j:longint;\n a,b:array[0..100001] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n a[0]:=a[1];\n for i:=1 to n div 2 do\n b[i]:=a[n-(i-1)*2];\n for i:=n downto n div 2+1 do\n b[i]:=a[(n+1)-(n-i+1)*2];\n for i:=1 to n do\n write(b[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1571615836, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Pascal/s557521126.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s557521126", "user_id": "u247366051"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "var\n n,i,j:longint;\n a,b:array[0..100001] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n a[0]:=a[1];\n for i:=1 to n div 2 do\n b[i]:=a[n-(i-1)*2];\n for i:=n downto n div 2+1 do\n b[i]:=a[(n+1)-(n-i+1)*2];\n for i:=1 to n do\n write(b[i],' ');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 262, "cpu_time_ms": 31, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s320787706", "group_id": "codeNet:p03673", "input_text": "var\n n,i,j:longint;\n a,b:array[0..100001] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n fillchar(b,sizeof(b),0);\n for j:=1 to i do\n b[i-j+1]:=a[j];\n a:=b;\n end;\n for i:=1 to n do\n write(a[i],' ');\nend.", "language": "Pascal", "metadata": {"date": 1571615146, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Pascal/s320787706.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s320787706", "user_id": "u426964396"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "var\n n,i,j:longint;\n a,b:array[0..100001] of longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n fillchar(b,sizeof(b),0);\n for j:=1 to i do\n b[i-j+1]:=a[j];\n a:=b;\n end;\n for i:=1 to n do\n write(a[i],' ');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s364480239", "group_id": "codeNet:p03673", "input_text": "program V1006;\n var\n a:array[0..200001] of longint;\n i,n:longint;\n begin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n readln;\n i:=n;\n while i>=1 do\n begin\n if n=1 then writeln(a[i])\n else write(a[i],' ');\n dec(i,2);\n end;\n if n mod 2=1 then i:=2\n else i:=1;\n while i<=n do\n begin\n if i+2>n then writeln(a[i])\n else write(a[i],' ');\n inc(i,2);\n end;\n end.\n", "language": "Pascal", "metadata": {"date": 1509563271, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Pascal/s364480239.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s364480239", "user_id": "u089230684"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "program V1006;\n var\n a:array[0..200001] of longint;\n i,n:longint;\n begin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n readln;\n i:=n;\n while i>=1 do\n begin\n if n=1 then writeln(a[i])\n else write(a[i],' ');\n dec(i,2);\n end;\n if n mod 2=1 then i:=2\n else i:=1;\n while i<=n do\n begin\n if i+2>n then writeln(a[i])\n else write(a[i],' ');\n inc(i,2);\n end;\n end.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 421, "cpu_time_ms": 73, "memory_kb": 2816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s982679089", "group_id": "codeNet:p03675", "input_text": "var\n\tN,i:Longint;\n\tA:Array[1..200000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\ti:=N;\n\twhile i>0 do begin\n\t\twriteln(A[i]);\n\t\tdec(i,2);\n\tend;\n\ti:=N mod 2+1;\n\twhile i<=N do begin\n\t\twriteln(A[i]);\n\t\tinc(i,2);\n\tend;\nend.\n", "language": "Pascal", "metadata": {"date": 1582184350, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03675.html", "problem_id": "p03675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03675/input.txt", "sample_output_relpath": "derived/input_output/data/p03675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03675/Pascal/s982679089.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s982679089", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "var\n\tN,i:Longint;\n\tA:Array[1..200000]of Longint;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\ti:=N;\n\twhile i>0 do begin\n\t\twriteln(A[i]);\n\t\tdec(i,2);\n\tend;\n\ti:=N mod 2+1;\n\twhile i<=N do begin\n\t\twriteln(A[i]);\n\t\tinc(i,2);\n\tend;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03675", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 72, "memory_kb": 2816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s409660931", "group_id": "codeNet:p03676", "input_text": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\n\tfac:array[0..100001]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\tC:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;\nend;\nbegin\n\tfac[0]:=1;\n\tfor i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1)+1000000007)mod 1000000007);\nend.\n", "language": "Pascal", "metadata": {"date": 1539347021, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03676.html", "problem_id": "p03676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03676/input.txt", "sample_output_relpath": "derived/input_output/data/p03676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03676/Pascal/s409660931.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s409660931", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\n\tfac:array[0..100001]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\tC:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;\nend;\nbegin\n\tfac[0]:=1;\n\tfor i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1)+1000000007)mod 1000000007);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03676", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 765, "cpu_time_ms": 420, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s383300594", "group_id": "codeNet:p03676", "input_text": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\n\tfac:array[0..100001]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\tC:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;\nend;\nbegin\n\tfac[0]:=1;\n\tfor i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1))mod 1000000007);\nend.\n", "language": "Pascal", "metadata": {"date": 1539346932, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03676.html", "problem_id": "p03676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03676/input.txt", "sample_output_relpath": "derived/input_output/data/p03676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03676/Pascal/s383300594.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s383300594", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\n\tfac:array[0..100001]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\tC:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;\nend;\nbegin\n\tfac[0]:=1;\n\tfor i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1))mod 1000000007);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03676", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 754, "cpu_time_ms": 419, "memory_kb": 2688}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s178645399", "group_id": "codeNet:p03676", "input_text": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\n\tfac:array[0..100001]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nvar s,t:int64;i:Longint;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\ts:=1;\n\tt:=1;\n\tfor i:=1 to b do begin\n\t\ts:=s*(a-i+1)mod 1000000007;\n\t\tt:=t*i mod 1000000007;\n\tend;\n\tC:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;\nend;\nbegin\n\tfac[0]:=1;\n\tfor i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1))mod 1000000007);\nend.\n", "language": "Pascal", "metadata": {"date": 1539346872, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03676.html", "problem_id": "p03676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03676/input.txt", "sample_output_relpath": "derived/input_output/data/p03676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03676/Pascal/s178645399.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s178645399", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\n\tfac:array[0..100001]of int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nvar s,t:int64;i:Longint;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\ts:=1;\n\tt:=1;\n\tfor i:=1 to b do begin\n\t\ts:=s*(a-i+1)mod 1000000007;\n\t\tt:=t*i mod 1000000007;\n\tend;\n\tC:=fac[a]*power(fac[a-b],1000000005)mod 1000000007*power(fac[b],1000000005)mod 1000000007;\nend;\nbegin\n\tfac[0]:=1;\n\tfor i:=1 to 100001 do fac[i]:=fac[i-1]*i mod 1000000007;\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1))mod 1000000007);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03676", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 878, "cpu_time_ms": 2103, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s854306619", "group_id": "codeNet:p03676", "input_text": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nvar s,t:int64;i:Longint;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\ts:=1;\n\tt:=1;\n\tfor i:=1 to b do begin\n\t\ts:=s*(a-i+1)mod 1000000007;\n\t\tt:=t*i mod 1000000007;\n\tend;\n\tC:=s*power(t,1000000005)mod 1000000007;\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1))mod 1000000007);\nend.\n", "language": "Pascal", "metadata": {"date": 1539346731, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03676.html", "problem_id": "p03676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03676/input.txt", "sample_output_relpath": "derived/input_output/data/p03676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03676/Pascal/s854306619.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s854306619", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "var\n\tn,i,l,r:Longint;\n\ta,v:array[1..100001]of Longint;\n\tans:int64;\nfunction power(a,b:int64):int64;\nvar s:int64;\nbegin\n\tif b=0 then power:=1\n\telse begin\n\t\ts:=power(a*a mod 1000000007,b div 2);\n\t\tif b mod 2=1 then s:=s*a mod 1000000007;\n\t\tpower:=s;\n\tend;\nend;\nfunction C(a,b:int64):int64;\nvar s,t:int64;i:Longint;\nbegin\n\tif(b<0)or(b>a)then begin\n\t\tC:=0;\n\t\texit;\n\tend;\n\ts:=1;\n\tt:=1;\n\tfor i:=1 to b do begin\n\t\ts:=s*(a-i+1)mod 1000000007;\n\t\tt:=t*i mod 1000000007;\n\tend;\n\tC:=s*power(t,1000000005)mod 1000000007;\nend;\nbegin\n\tread(n);\n\tfor i:=1 to n+1 do begin\n\t\tread(a[i]);\n\t\tif v[a[i]]=0 then v[a[i]]:=i\n\t\telse begin\n\t\t\tl:=v[a[i]]-1;\n\t\t\tr:=n+1-i;\n\t\tend;\n\tend;\n\tfor i:=1 to n+1 do writeln((C(n+1,i)-C(l+r,i-1))mod 1000000007);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03676", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_{n+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 726, "cpu_time_ms": 2107, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s831686290", "group_id": "codeNet:p03677", "input_text": "program V803;\n var\n a,c:array[0..100001] of longint;\n b:array[0..100001] of int64;\n i,j,m,n:longint;\n sum,max:int64;\n begin\n readln(n,m);\n for i:=1 to n do\n read(a[i]);\n readln;\n fillchar(b,sizeof(b),0);\n fillchar(c,sizeof(c),0);\n sum:=0;\n for i:=2 to n do\n if a[i]>a[i-1] then\n begin\n inc(sum,a[i]-a[i-1]);\n inc(b[a[i-1]+1],a[i-1]+1);\n dec(b[a[i]+1],a[i-1]+1);\n inc(c[a[i-1]+1]);\n dec(c[a[i]+1]);\n end\n else\n begin\n inc(sum,m-a[i-1]+a[i]);\n inc(b[a[i-1]+1],a[i-1]+1);\n inc(b[1],a[i-1]+1-m);\n dec(b[a[i]+1],a[i-1]+1-m);\n inc(c[a[i-1]+1]);\n inc(c[1]);\n dec(c[a[i]+1]);\n end;\n for i:=2 to m do\n begin\n inc(b[i],b[i-1]);\n inc(c[i],c[i-1]);\n end;\n max:=0;\n for i:=1 to m do\n if i*c[i]-b[i]>max then max:=c[i]*i-b[i];\n writeln(sum-max);\n end.\n", "language": "Pascal", "metadata": {"date": 1509374837, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03677.html", "problem_id": "p03677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03677/input.txt", "sample_output_relpath": "derived/input_output/data/p03677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03677/Pascal/s831686290.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s831686290", "user_id": "u353919145"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program V803;\n var\n a,c:array[0..100001] of longint;\n b:array[0..100001] of int64;\n i,j,m,n:longint;\n sum,max:int64;\n begin\n readln(n,m);\n for i:=1 to n do\n read(a[i]);\n readln;\n fillchar(b,sizeof(b),0);\n fillchar(c,sizeof(c),0);\n sum:=0;\n for i:=2 to n do\n if a[i]>a[i-1] then\n begin\n inc(sum,a[i]-a[i-1]);\n inc(b[a[i-1]+1],a[i-1]+1);\n dec(b[a[i]+1],a[i-1]+1);\n inc(c[a[i-1]+1]);\n dec(c[a[i]+1]);\n end\n else\n begin\n inc(sum,m-a[i-1]+a[i]);\n inc(b[a[i-1]+1],a[i-1]+1);\n inc(b[1],a[i-1]+1-m);\n dec(b[a[i]+1],a[i-1]+1-m);\n inc(c[a[i-1]+1]);\n inc(c[1]);\n dec(c[a[i]+1]);\n end;\n for i:=2 to m do\n begin\n inc(b[i],b[i-1]);\n inc(c[i],c[i-1]);\n end;\n max:=0;\n for i:=1 to m do\n if i*c[i]-b[i]>max then max:=c[i]*i-b[i];\n writeln(sum-max);\n end.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke is buying a lamp.\nThe light of the lamp can be adjusted to m levels of brightness, represented by integers from 1 through m, by the two buttons on the remote control.\n\nThe first button is a \"forward\" button. When this button is pressed, the brightness level is increased by 1, except when the brightness level is m, in which case the brightness level becomes 1.\n\nThe second button is a \"favorite\" button. When this button is pressed, the brightness level becomes the favorite brightness level x, which is set when the lamp is purchased.\n\nSnuke is thinking of setting the favorite brightness level x so that he can efficiently adjust the brightness.\nHe is planning to change the brightness n-1 times. In the i-th change, the brightness level is changed from a_i to a_{i+1}. The initial brightness level is a_1.\nFind the number of times Snuke needs to press the buttons when x is set to minimize this number.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n1 \\leq a_i\\leq m\n\na_i \\neq a_{i+1}\n\nn, m and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\na_1 a_2 … a_n\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons.\n\nSample Input 1\n\n4 6\n1 5 1 4\n\nSample Output 1\n\n5\n\nWhen the favorite brightness level is set to 1, 2, 3, 4, 5 and 6, Snuke needs to press the buttons 8, 9, 7, 5, 6 and 9 times, respectively.\nThus, Snuke should set the favorite brightness level to 4.\nIn this case, the brightness is adjusted as follows:\n\nIn the first change, press the favorite button once, then press the forward button once.\n\nIn the second change, press the forward button twice.\n\nIn the third change, press the favorite button once.\n\nSample Input 2\n\n10 10\n10 9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n45", "sample_input": "4 6\n1 5 1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03677", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke is buying a lamp.\nThe light of the lamp can be adjusted to m levels of brightness, represented by integers from 1 through m, by the two buttons on the remote control.\n\nThe first button is a \"forward\" button. When this button is pressed, the brightness level is increased by 1, except when the brightness level is m, in which case the brightness level becomes 1.\n\nThe second button is a \"favorite\" button. When this button is pressed, the brightness level becomes the favorite brightness level x, which is set when the lamp is purchased.\n\nSnuke is thinking of setting the favorite brightness level x so that he can efficiently adjust the brightness.\nHe is planning to change the brightness n-1 times. In the i-th change, the brightness level is changed from a_i to a_{i+1}. The initial brightness level is a_1.\nFind the number of times Snuke needs to press the buttons when x is set to minimize this number.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n1 \\leq a_i\\leq m\n\na_i \\neq a_{i+1}\n\nn, m and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\na_1 a_2 … a_n\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons.\n\nSample Input 1\n\n4 6\n1 5 1 4\n\nSample Output 1\n\n5\n\nWhen the favorite brightness level is set to 1, 2, 3, 4, 5 and 6, Snuke needs to press the buttons 8, 9, 7, 5, 6 and 9 times, respectively.\nThus, Snuke should set the favorite brightness level to 4.\nIn this case, the brightness is adjusted as follows:\n\nIn the first change, press the favorite button once, then press the forward button once.\n\nIn the second change, press the forward button twice.\n\nIn the third change, press the favorite button once.\n\nSample Input 2\n\n10 10\n10 9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n45", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 846, "cpu_time_ms": 13, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s207270378", "group_id": "codeNet:p03677", "input_text": "program V803;\n var\n a,b,c:array[0..100001] of longint;\n i,m,n:longint;\n sum,max:int64;\n begin\n readln(n,m);\n for i:=1 to n do\n read(a[i]);\n readln;\n fillchar(b,sizeof(b),0);\n fillchar(c,sizeof(c),0);\n sum:=0;\n for i:=2 to n do\n if a[i]>a[i-1] then\n begin\n inc(sum,a[i]-a[i-1]);\n inc(b[a[i-1]+1],a[i-1]+1);\n dec(b[a[i]+1],a[i-1]+1);\n inc(c[a[i-1]+2]);\n dec(c[a[i]+1]);\n end\n else\n begin\n inc(sum,m-a[i-1]+a[i]);\n inc(b[a[i-1]+1],a[i-1]+1);\n inc(b[1],a[i-1]+1-m);\n dec(b[a[i]+1],a[i-1]+1-m);\n inc(c[a[i-1]+1]);\n inc(c[1]);\n dec(c[a[i]+1]);\n end;\n for i:=2 to n do\n begin\n inc(b[i],b[i-1]);\n inc(c[i],c[i-1]);\n end;\n max:=0;\n for i:=1 to n do\n if i*c[i]-b[i]>max then max:=c[i]*i-b[i];\n writeln(sum-max);\n end.\n", "language": "Pascal", "metadata": {"date": 1509374301, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03677.html", "problem_id": "p03677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03677/input.txt", "sample_output_relpath": "derived/input_output/data/p03677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03677/Pascal/s207270378.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s207270378", "user_id": "u018679195"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program V803;\n var\n a,b,c:array[0..100001] of longint;\n i,m,n:longint;\n sum,max:int64;\n begin\n readln(n,m);\n for i:=1 to n do\n read(a[i]);\n readln;\n fillchar(b,sizeof(b),0);\n fillchar(c,sizeof(c),0);\n sum:=0;\n for i:=2 to n do\n if a[i]>a[i-1] then\n begin\n inc(sum,a[i]-a[i-1]);\n inc(b[a[i-1]+1],a[i-1]+1);\n dec(b[a[i]+1],a[i-1]+1);\n inc(c[a[i-1]+2]);\n dec(c[a[i]+1]);\n end\n else\n begin\n inc(sum,m-a[i-1]+a[i]);\n inc(b[a[i-1]+1],a[i-1]+1);\n inc(b[1],a[i-1]+1-m);\n dec(b[a[i]+1],a[i-1]+1-m);\n inc(c[a[i-1]+1]);\n inc(c[1]);\n dec(c[a[i]+1]);\n end;\n for i:=2 to n do\n begin\n inc(b[i],b[i-1]);\n inc(c[i],c[i-1]);\n end;\n max:=0;\n for i:=1 to n do\n if i*c[i]-b[i]>max then max:=c[i]*i-b[i];\n writeln(sum-max);\n end.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke is buying a lamp.\nThe light of the lamp can be adjusted to m levels of brightness, represented by integers from 1 through m, by the two buttons on the remote control.\n\nThe first button is a \"forward\" button. When this button is pressed, the brightness level is increased by 1, except when the brightness level is m, in which case the brightness level becomes 1.\n\nThe second button is a \"favorite\" button. When this button is pressed, the brightness level becomes the favorite brightness level x, which is set when the lamp is purchased.\n\nSnuke is thinking of setting the favorite brightness level x so that he can efficiently adjust the brightness.\nHe is planning to change the brightness n-1 times. In the i-th change, the brightness level is changed from a_i to a_{i+1}. The initial brightness level is a_1.\nFind the number of times Snuke needs to press the buttons when x is set to minimize this number.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n1 \\leq a_i\\leq m\n\na_i \\neq a_{i+1}\n\nn, m and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\na_1 a_2 … a_n\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons.\n\nSample Input 1\n\n4 6\n1 5 1 4\n\nSample Output 1\n\n5\n\nWhen the favorite brightness level is set to 1, 2, 3, 4, 5 and 6, Snuke needs to press the buttons 8, 9, 7, 5, 6 and 9 times, respectively.\nThus, Snuke should set the favorite brightness level to 4.\nIn this case, the brightness is adjusted as follows:\n\nIn the first change, press the favorite button once, then press the forward button once.\n\nIn the second change, press the forward button twice.\n\nIn the third change, press the favorite button once.\n\nSample Input 2\n\n10 10\n10 9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n45", "sample_input": "4 6\n1 5 1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03677", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke is buying a lamp.\nThe light of the lamp can be adjusted to m levels of brightness, represented by integers from 1 through m, by the two buttons on the remote control.\n\nThe first button is a \"forward\" button. When this button is pressed, the brightness level is increased by 1, except when the brightness level is m, in which case the brightness level becomes 1.\n\nThe second button is a \"favorite\" button. When this button is pressed, the brightness level becomes the favorite brightness level x, which is set when the lamp is purchased.\n\nSnuke is thinking of setting the favorite brightness level x so that he can efficiently adjust the brightness.\nHe is planning to change the brightness n-1 times. In the i-th change, the brightness level is changed from a_i to a_{i+1}. The initial brightness level is a_1.\nFind the number of times Snuke needs to press the buttons when x is set to minimize this number.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n1 \\leq a_i\\leq m\n\na_i \\neq a_{i+1}\n\nn, m and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\na_1 a_2 … a_n\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons.\n\nSample Input 1\n\n4 6\n1 5 1 4\n\nSample Output 1\n\n5\n\nWhen the favorite brightness level is set to 1, 2, 3, 4, 5 and 6, Snuke needs to press the buttons 8, 9, 7, 5, 6 and 9 times, respectively.\nThus, Snuke should set the favorite brightness level to 4.\nIn this case, the brightness is adjusted as follows:\n\nIn the first change, press the favorite button once, then press the forward button once.\n\nIn the second change, press the forward button twice.\n\nIn the third change, press the favorite button once.\n\nSample Input 2\n\n10 10\n10 9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n45", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 815, "cpu_time_ms": 13, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s503000368", "group_id": "codeNet:p03679", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n h,w,i,j,count,x,y,sw,m,n,a,b,c:Integer;\n s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(x);\n Read(a);\n Readln(b);\n\n if a-b>0 then\n Writeln('delicious')\n else if x+a>b then\n Writeln('safe')\n else\n Writeln('dangerous');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1516904141, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s503000368.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s503000368", "user_id": "u755925739"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n h,w,i,j,count,x,y,sw,m,n,a,b,c:Integer;\n s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(x);\n Read(a);\n Readln(b);\n\n if a-b>0 then\n Writeln('delicious')\n else if x+a>b then\n Writeln('safe')\n else\n Writeln('dangerous');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 532, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s443762800", "group_id": "codeNet:p03679", "input_text": "program abc;\nconst maxN=100005;\nvar i,n,d:longint;\n a,dau:array[0..maxN] of longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n i:=1;\n d:=0;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1) or (dau[i]=1);\n if dau[2]=1 then\n write(d-1)\n else\n write(-1);\nend.\n", "language": "Pascal", "metadata": {"date": 1498358391, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s443762800.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s443762800", "user_id": "u068391867"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "program abc;\nconst maxN=100005;\nvar i,n,d:longint;\n a,dau:array[0..maxN] of longint;\nbegin\n read(n);\n for i:=1 to n do\n read(a[i]);\n i:=1;\n d:=0;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1) or (dau[i]=1);\n if dau[2]=1 then\n write(d-1)\n else\n write(-1);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 340, "cpu_time_ms": 75, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s921346864", "group_id": "codeNet:p03679", "input_text": "const fi='trained.inp';\nfo='trained.out';\nvar a,dau:array[0..100005] of longint;\nn,d:longint;\nkt:boolean;\nprocedure mo;\nbegin\nassign(input,fi);\nreset(input);\nassign(output,fo);\nrewrite(output);\nend;\n \nprocedure nhap;\nvar i:longint;\nbegin\nread(n);\nfor i:=1 to n do\nread(a[i]);\nend;\n \nprocedure xuly;\nvar i:longint;\nbegin\nd:=0; i:=1;\nrepeat\ndau[i]:=1;\ni:=a[i];\ninc(d);\nuntil (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n \nprocedure xuat;\nbegin\nif dau[2]=1 then\nwriteln(d-1)\nelse\nwriteln('-1');\nend;\n \nbegin\n//mo;\nnhap;\nxuly;\nxuat;\nend.\n ", "language": "Pascal", "metadata": {"date": 1498358352, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s921346864.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s921346864", "user_id": "u463678864"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "const fi='trained.inp';\nfo='trained.out';\nvar a,dau:array[0..100005] of longint;\nn,d:longint;\nkt:boolean;\nprocedure mo;\nbegin\nassign(input,fi);\nreset(input);\nassign(output,fo);\nrewrite(output);\nend;\n \nprocedure nhap;\nvar i:longint;\nbegin\nread(n);\nfor i:=1 to n do\nread(a[i]);\nend;\n \nprocedure xuly;\nvar i:longint;\nbegin\nd:=0; i:=1;\nrepeat\ndau[i]:=1;\ni:=a[i];\ninc(d);\nuntil (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n \nprocedure xuat;\nbegin\nif dau[2]=1 then\nwriteln(d-1)\nelse\nwriteln('-1');\nend;\n \nbegin\n//mo;\nnhap;\nxuly;\nxuat;\nend.\n ", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 525, "cpu_time_ms": 71, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s542657277", "group_id": "codeNet:p03679", "input_text": "\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\n\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n d:=0; i:=1;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n\nprocedure xuat;\nbegin\n if dau[2]=1 then\n writeln(d-1)\n else\n writeln('-1');\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1498357838, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s542657277.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s542657277", "user_id": "u068391867"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\n\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n d:=0; i:=1;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n\nprocedure xuat;\nbegin\n if dau[2]=1 then\n writeln(d-1)\n else\n writeln('-1');\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 487, "cpu_time_ms": 137, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s980954815", "group_id": "codeNet:p03679", "input_text": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n d:=0;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n\nprocedure xuat;\nbegin\n if dau[2]=1 then\n writeln(d)\n else\n writeln('-1');\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1498357686, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s980954815.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s980954815", "user_id": "u068391867"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n d:=0;\n repeat\n dau[i]:=1;\n i:=a[i];\n inc(d);\n until (dau[2]=1)or(dau[i]=1)or(kt);\nend;\n\nprocedure xuat;\nbegin\n if dau[2]=1 then\n writeln(d)\n else\n writeln('-1');\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 634, "cpu_time_ms": 138, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s620734612", "group_id": "codeNet:p03679", "input_text": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n i:=1;\n kt:=false; \n while a[i] <> 2 do\n begin\n inc(d);\n dau[i]:=1;\n i:=a[i];\n if dau[i] = 1 then\n begin\n kt:=true;\n exit;\n end;\n end;\nend;\n\nprocedure xuat;\nbegin\n if kt=true then\n writeln('-1')\n else\n writeln(d+1);\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1498356792, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s620734612.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s620734612", "user_id": "u068391867"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n i:=1;\n kt:=false; \n while a[i] <> 2 do\n begin\n inc(d);\n dau[i]:=1;\n i:=a[i];\n if dau[i] = 1 then\n begin\n kt:=true;\n exit;\n end;\n end;\nend;\n\nprocedure xuat;\nbegin\n if kt=true then\n writeln('-1')\n else\n writeln(d+1);\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 735, "cpu_time_ms": 138, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s284803842", "group_id": "codeNet:p03679", "input_text": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n i:=1;\n while a[i] <> 2 do\n begin\n inc(d);\n dau[i]:=1;\n i:=a[i];\n if dau[i] = 1 then\n begin\n kt:=true;\n exit;\n end;\n end;\nend;\n\nprocedure xuat;\nbegin\n if kt=true then\n writeln('-1')\n else\n writeln(d+1);\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "language": "Pascal", "metadata": {"date": 1498356622, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Pascal/s284803842.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s284803842", "user_id": "u068391867"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "const fi='trained.inp';\n fo='trained.out';\nvar a,dau:array[0..100005] of longint;\n n,d:longint;\n kt:boolean;\nprocedure mo;\nbegin\n assign(input,fi);\n reset(input);\n assign(output,fo);\n rewrite(output);\nend;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n readln(a[i]);\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n i:=1;\n while a[i] <> 2 do\n begin\n inc(d);\n dau[i]:=1;\n i:=a[i];\n if dau[i] = 1 then\n begin\n kt:=true;\n exit;\n end;\n end;\nend;\n\nprocedure xuat;\nbegin\n if kt=true then\n writeln('-1')\n else\n writeln(d+1);\nend;\n\nbegin\n \n nhap;\n xuly;\n xuat;\nend.\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 718, "cpu_time_ms": 137, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s718442756", "group_id": "codeNet:p03680", "input_text": "var a:array[0..100000]of longint;\n b:array[0..100000]of boolean;\n n,i,j:longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n i:=1;\n while true do\n begin\n inc(j);\n if a[i]=2 then\n begin\n writeln(j);\n halt;\n end;\n if b[i] then\n begin\n writeln(-1);\n halt;\n end;\n b[i]:=true;\n i:=a[i];\n end;\nend.", "language": "Pascal", "metadata": {"date": 1582345076, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s718442756.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718442756", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var a:array[0..100000]of longint;\n b:array[0..100000]of boolean;\n n,i,j:longint;\nbegin\n readln(n);\n for i:=1 to n do\n read(a[i]);\n i:=1;\n while true do\n begin\n inc(j);\n if a[i]=2 then\n begin\n writeln(j);\n halt;\n end;\n if b[i] then\n begin\n writeln(-1);\n halt;\n end;\n b[i]:=true;\n i:=a[i];\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 360, "cpu_time_ms": 13, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s355859571", "group_id": "codeNet:p03680", "input_text": "program trained;\nuses math;\nvar\n n, i, k: integer;\n a: array [1..100000] of integer;\nbegin\n read(n);\n for i := 1 to n do\n read(a[i]);\n i := 1;\n for k := 1 to n do\n begin\n i := a[i];\n if i = 2 then\n begin\n writeln(k);\n halt(0);\n end;\n end;\n writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1570419991, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s355859571.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355859571", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program trained;\nuses math;\nvar\n n, i, k: integer;\n a: array [1..100000] of integer;\nbegin\n read(n);\n for i := 1 to n do\n read(a[i]);\n i := 1;\n for k := 1 to n do\n begin\n i := a[i];\n if i = 2 then\n begin\n writeln(k);\n halt(0);\n end;\n end;\n writeln(-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s017307913", "group_id": "codeNet:p03680", "input_text": "var n,i,s:Longint;a:array[1..100000]of Integer;\nbegin\n\tread(n);\n\tfor i:=1 to n do read(a[i]);\n\ts:=1;\n\tfor i:=1 to n do begin\n\t\ts:=a[s];\n\t\tif s=2 then begin\n\t\t\twriteln(i);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln(-1);\nend.\n", "language": "Pascal", "metadata": {"date": 1534920042, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s017307913.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s017307913", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,i,s:Longint;a:array[1..100000]of Integer;\nbegin\n\tread(n);\n\tfor i:=1 to n do read(a[i]);\n\ts:=1;\n\tfor i:=1 to n do begin\n\t\ts:=a[s];\n\t\tif s=2 then begin\n\t\t\twriteln(i);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln(-1);\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s835814338", "group_id": "codeNet:p03680", "input_text": "Var n,kq,t: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\nt:=1; kq:=0;\nRepeat\n Inc(kq);\n //If a[a[t]]=t Then Break;\n t:=a[t];\nUntil (t=2) or (kq>n+1);\nEnd;\n\nProcedure Xuat;\nBegin\nIf t<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.", "language": "Pascal", "metadata": {"date": 1498358227, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s835814338.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s835814338", "user_id": "u489424865"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var n,kq,t: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\nt:=1; kq:=0;\nRepeat\n Inc(kq);\n //If a[a[t]]=t Then Break;\n t:=a[t];\nUntil (t=2) or (kq>n+1);\nEnd;\n\nProcedure Xuat;\nBegin\nIf t<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 427, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s327439538", "group_id": "codeNet:p03680", "input_text": "Var n,kq,t: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\nt:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[t]]=t Then Break;\n t:=a[t];\nUntil (t=2) or (kq>n);\nEnd;\n\nProcedure Xuat;\nBegin\nIf t<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n\n", "language": "Pascal", "metadata": {"date": 1498357399, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s327439538.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s327439538", "user_id": "u489424865"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var n,kq,t: Longint;\n a: Array[0..1000005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\nt:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[t]]=t Then Break;\n t:=a[t];\nUntil (t=2) or (kq>n);\nEnd;\n\nProcedure Xuat;\nBegin\nIf t<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 425, "cpu_time_ms": 12, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s038745933", "group_id": "codeNet:p03680", "input_text": "Program ABC065_B;\nconst MaxN=100005;\nvar n,i,cnt:longint;\n a,d:array[0..MaxN] of longint;\n\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n i:=1;\n cnt:=0;\n repeat\n d[i]:=1;\n i:=a[i];\n inc(cnt);\n until (d[2]=1)or(d[i]=1);\n if d[2]=1 then write(cnt-1)\n else write(-1);\nend.", "language": "Pascal", "metadata": {"date": 1498355764, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s038745933.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s038745933", "user_id": "u463678864"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Program ABC065_B;\nconst MaxN=100005;\nvar n,i,cnt:longint;\n a,d:array[0..MaxN] of longint;\n\nbegin\n read(n);\n for i:=1 to n do read(a[i]);\n i:=1;\n cnt:=0;\n repeat\n d[i]:=1;\n i:=a[i];\n inc(cnt);\n until (d[2]=1)or(d[i]=1);\n if d[2]=1 then write(cnt-1)\n else write(-1);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 319, "cpu_time_ms": 13, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s426760930", "group_id": "codeNet:p03680", "input_text": "Var N,i,Dem:Longint;\n A:Array[1..100000] Of Longint;\n B:Array[1..100000] Of Boolean;\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n //Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(N);\n Fillchar(B,SizeOf(B),False);\n For i:=1 to N Do\n Begin\n Readln(A[i]);\n End;\n Dem:=0;\n i:=1;\n B[1]:=True;\n While i<>2 Do\n Begin\n B[i]:=False;\n B[A[i]]:=True;\n i:=A[i];\n Inc(Dem);\n If Dem>N Then Break;\n End;\n If Dem>N Then Write('-1') Else Write(Dem);\n //Close(Input);\n //Close(Output);\nEnd.\n", "language": "Pascal", "metadata": {"date": 1498355709, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s426760930.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s426760930", "user_id": "u679669944"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var N,i,Dem:Longint;\n A:Array[1..100000] Of Longint;\n B:Array[1..100000] Of Boolean;\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n //Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(N);\n Fillchar(B,SizeOf(B),False);\n For i:=1 to N Do\n Begin\n Readln(A[i]);\n End;\n Dem:=0;\n i:=1;\n B[1]:=True;\n While i<>2 Do\n Begin\n B[i]:=False;\n B[A[i]]:=True;\n i:=A[i];\n Inc(Dem);\n If Dem>N Then Break;\n End;\n If Dem>N Then Write('-1') Else Write(Dem);\n //Close(Input);\n //Close(Output);\nEnd.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 729, "cpu_time_ms": 13, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s264550944", "group_id": "codeNet:p03680", "input_text": "Var n,kq,i: Longint;\n a: Array[0..100005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\ni:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[i]]=i Then Break;\n i:=a[i];\nUntil i=2;\nEnd;\n\nProcedure Xuat;\nBegin\nIf i<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n", "language": "Pascal", "metadata": {"date": 1498355568, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Pascal/s264550944.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s264550944", "user_id": "u489424865"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "Var n,kq,i: Longint;\n a: Array[0..100005] Of Longint;\n\nProcedure Nhap;\nVar i: Longint;\nBegin\nReadln(n);\nFor i:=1 to n do\n Readln(a[i]);\nEnd;\n\nProcedure XuLy;\nBegin\ni:=1; kq:=0;\nRepeat\n Inc(kq);\n If a[a[i]]=i Then Break;\n i:=a[i];\nUntil i=2;\nEnd;\n\nProcedure Xuat;\nBegin\nIf i<>2 Then Writeln(-1)\nElse Writeln(kq);\nEnd;\n\nBegin\nNhap;\nXuLy;\nXuat;\nEnd.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 411, "cpu_time_ms": 2103, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s414159828", "group_id": "codeNet:p03681", "input_text": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f10000: int64 = 531950728;\n f20000: int64 = 368774859;\n f30000: int64 = 548996970;\n f40000: int64 = 422550956;\n f50000: int64 = 737935835;\n f60000: int64 = 309944332;\n f70000: int64 = 296716438;\n f80000: int64 = 65533322;\n f90000: int64 = 851076783;\n f100000: int64 = 457992974;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n if n < 10000 then\n begin\n f := 1;\n k := 1;\n end\n else if n < 20000 then\n begin\n f := f10000;\n k := 10001;\n end\n else if n < 30000 then\n begin\n f := f20000;\n k := 20001;\n end\n else if n < 40000 then\n begin\n f := f30000;\n k := 30001;\n end\n else if n < 50000 then\n begin\n f := f40000;\n k := 40001;\n end\n else if n < 60000 then\n begin\n f := f50000;\n k := 50001;\n end\n else if n < 70000 then\n begin\n f := f60000;\n k := 60001;\n end\n else if n < 80000 then\n begin\n f := f70000;\n k := 70001;\n end\n else if n < 90000 then\n begin\n f := f80000;\n k := 80001;\n end\n else if n < 100000 then\n begin\n f := f90000;\n k := 90001;\n end\n else\n begin\n f := f100000;\n k := 100001;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570419103, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s414159828.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s414159828", "user_id": "u506403362"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f10000: int64 = 531950728;\n f20000: int64 = 368774859;\n f30000: int64 = 548996970;\n f40000: int64 = 422550956;\n f50000: int64 = 737935835;\n f60000: int64 = 309944332;\n f70000: int64 = 296716438;\n f80000: int64 = 65533322;\n f90000: int64 = 851076783;\n f100000: int64 = 457992974;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n if n < 10000 then\n begin\n f := 1;\n k := 1;\n end\n else if n < 20000 then\n begin\n f := f10000;\n k := 10001;\n end\n else if n < 30000 then\n begin\n f := f20000;\n k := 20001;\n end\n else if n < 40000 then\n begin\n f := f30000;\n k := 30001;\n end\n else if n < 50000 then\n begin\n f := f40000;\n k := 40001;\n end\n else if n < 60000 then\n begin\n f := f50000;\n k := 50001;\n end\n else if n < 70000 then\n begin\n f := f60000;\n k := 60001;\n end\n else if n < 80000 then\n begin\n f := f70000;\n k := 70001;\n end\n else if n < 90000 then\n begin\n f := f80000;\n k := 80001;\n end\n else if n < 100000 then\n begin\n f := f90000;\n k := 90001;\n end\n else\n begin\n f := f100000;\n k := 100001;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1442, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s062931307", "group_id": "codeNet:p03681", "input_text": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f10000: int64 = 531950728;\n f20000: int64 = 368774859;\n f30000: int64 = 548996970;\n f40000: int64 = 422550956;\n f50000: int64 = 737935835;\n f60000: int64 = 309944332;\n f70000: int64 = 296716438;\n f80000: int64 = 65533322;\n f90000: int64 = 851076783;\n f100000: int64 = 457992974;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n f := f100000;\n k := 100001;\n if n < 100000 then\n begin\n f := f90000;\n k := 90001;\n end;\n if n < 90000 then\n begin\n f := f80000;\n k := 80001;\n end;\n if n < 80000 then\n begin\n f := f70000;\n k := 70001;\n end;\n if n < 60000 then\n begin\n f := f50000;\n k := 50001;\n end;\n if n < 50000 then\n begin\n f := f40000;\n k := 40001;\n end;\n if n < 40000 then\n begin\n f := f30000;\n k := 30001;\n end;\n if n < 30000 then\n begin\n f := f20000;\n k := 20001;\n end;\n if n < 20000 then\n begin\n f := f10000;\n k := 10001;\n end;\n if n < 10000 then\n begin\n f := 1;\n k := 1;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570418715, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s062931307.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s062931307", "user_id": "u506403362"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f10000: int64 = 531950728;\n f20000: int64 = 368774859;\n f30000: int64 = 548996970;\n f40000: int64 = 422550956;\n f50000: int64 = 737935835;\n f60000: int64 = 309944332;\n f70000: int64 = 296716438;\n f80000: int64 = 65533322;\n f90000: int64 = 851076783;\n f100000: int64 = 457992974;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n f := f100000;\n k := 100001;\n if n < 100000 then\n begin\n f := f90000;\n k := 90001;\n end;\n if n < 90000 then\n begin\n f := f80000;\n k := 80001;\n end;\n if n < 80000 then\n begin\n f := f70000;\n k := 70001;\n end;\n if n < 60000 then\n begin\n f := f50000;\n k := 50001;\n end;\n if n < 50000 then\n begin\n f := f40000;\n k := 40001;\n end;\n if n < 40000 then\n begin\n f := f30000;\n k := 30001;\n end;\n if n < 30000 then\n begin\n f := f20000;\n k := 20001;\n end;\n if n < 20000 then\n begin\n f := f10000;\n k := 10001;\n end;\n if n < 10000 then\n begin\n f := 1;\n k := 1;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1313, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s285604764", "group_id": "codeNet:p03681", "input_text": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f20000: int64 = 368774859;\n f40000: int64 = 422550956;\n f60000: int64 = 309944332;\n f80000: int64 = 65533322;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n f := f80000;\n k := 80001;\n if n < 80000 then\n begin\n f := f60000;\n k := 60001;\n end;\n if n < 60000 then\n begin\n f := f40000;\n k := 40001;\n end;\n if n < 40000 then\n begin\n f := f20000;\n k := 20001;\n end;\n if n < 20000 then\n begin\n f := 1;\n k := 1;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570418439, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s285604764.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s285604764", "user_id": "u506403362"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f20000: int64 = 368774859;\n f40000: int64 = 422550956;\n f60000: int64 = 309944332;\n f80000: int64 = 65533322;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n f := f80000;\n k := 80001;\n if n < 80000 then\n begin\n f := f60000;\n k := 60001;\n end;\n if n < 60000 then\n begin\n f := f40000;\n k := 40001;\n end;\n if n < 40000 then\n begin\n f := f20000;\n k := 20001;\n end;\n if n < 20000 then\n begin\n f := 1;\n k := 1;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 795, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s022172523", "group_id": "codeNet:p03681", "input_text": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f25000: int64 = 232201666;\n f50000: int64 = 737935835;\n f75000: int64 = 796945456;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n f := f75000;\n k := 75001;\n if n < 75000 then\n begin\n f := f50000;\n k := 50001;\n end;\n if n < 50000 then\n begin\n f := f25000;\n k := 25001;\n end;\n if n < 25000 then\n begin\n f := 1;\n k := 1;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "language": "Pascal", "metadata": {"date": 1570418168, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Pascal/s022172523.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s022172523", "user_id": "u506403362"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program reconciled;\nuses math;\nconst\n md: int64 = 1000000007;\n f25000: int64 = 232201666;\n f50000: int64 = 737935835;\n f75000: int64 = 796945456;\nfunction fact(n: int64): int64;\nvar\n i, k, f: int64;\nbegin\n f := f75000;\n k := 75001;\n if n < 75000 then\n begin\n f := f50000;\n k := 50001;\n end;\n if n < 50000 then\n begin\n f := f25000;\n k := 25001;\n end;\n if n < 25000 then\n begin\n f := 1;\n k := 1;\n end;\n for i := k to n do\n f := i*f mod md;\n fact := f;\nend;\nvar\n n, m, x: int64;\nbegin\n read(n, m);\n if abs(n-m) > 1 then\n begin\n writeln(0);\n halt(0);\n end;\n x := ifthen(n = m, 2, 1);\n x := x*fact(n) mod md;\n x := x*fact(m) mod md;\n writeln(x);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 699, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s191296907", "group_id": "codeNet:p03683", "input_text": "var du,n,m,res:int64;\n i:longint;\nbegin\ndu:=round(1e9)+7;\nreadln(n,m);\nif abs(n-m)>=2 then\n begin\n writeln(0);\n halt;\n end;\nres:=1; \nfor i:=1 to n do\n res:=(res*i) mod du;\nfor i:=1 to m do\n res:=(res*i) mod du;\nif n=m then res:=(res*2) mod du;\nwriteln(res);\nend.\n", "language": "Pascal", "metadata": {"date": 1498368912, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03683.html", "problem_id": "p03683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03683/input.txt", "sample_output_relpath": "derived/input_output/data/p03683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03683/Pascal/s191296907.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s191296907", "user_id": "u708671713"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var du,n,m,res:int64;\n i:longint;\nbegin\ndu:=round(1e9)+7;\nreadln(n,m);\nif abs(n-m)>=2 then\n begin\n writeln(0);\n halt;\n end;\nres:=1; \nfor i:=1 to n do\n res:=(res*i) mod du;\nfor i:=1 to m do\n res:=(res*i) mod du;\nif n=m then res:=(res*2) mod du;\nwriteln(res);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03683", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s795666936", "group_id": "codeNet:p03683", "input_text": "var du,n,m,res:int64;\n i:longint;\nbegin\ndu:=round(1e9)+7;\nreadln(n,m);\nif abs(n-m)>=2 then\n begin\n writeln(0);\n halt;\n end;\nres:=1; \nfor i:=1 to n do\n res:=(res*i) mod du;\nfor i:=1 to m do\n res:=(res*i) mod du;\nif n=m then res:=(res*2) mod du;\nwriteln(res);\nend.\n", "language": "Pascal", "metadata": {"date": 1498368911, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03683.html", "problem_id": "p03683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03683/input.txt", "sample_output_relpath": "derived/input_output/data/p03683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03683/Pascal/s795666936.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s795666936", "user_id": "u708671713"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "var du,n,m,res:int64;\n i:longint;\nbegin\ndu:=round(1e9)+7;\nreadln(n,m);\nif abs(n-m)>=2 then\n begin\n writeln(0);\n halt;\n end;\nres:=1; \nfor i:=1 to n do\n res:=(res*i) mod du;\nfor i:=1 to m do\n res:=(res*i) mod du;\nif n=m then res:=(res*2) mod du;\nwriteln(res);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03683", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 3, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s830310709", "group_id": "codeNet:p03683", "input_text": "Var A,B,N:Longint;\n D:Array[1..100000] Of Qword;\n\nProcedure Xuli;\nVar i:Longint;\nBegin\n D[1]:=1;\n For i:=2 to 100000 Do D[i]:=((D[i-1] Mod 1000000007)*(i Mod 1000000007))Mod 1000000007;\nEnd;\n\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n //Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(A,B);\n Xuli;\n If ABS(A-B)>1 Then\n Begin\n Write(0);\n Halt;\n End;\n N:=(D[B]*D[A])Mod 1000000007;\n If A=B Then\n Begin\n N:=(D[B]*D[A]*2)Mod 1000000007;\n Write(N);\n Halt;\n End;\n Write(N);\n //Close(Input);\n ///Close(Output);\nEnd.\n", "language": "Pascal", "metadata": {"date": 1498360004, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03683.html", "problem_id": "p03683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03683/input.txt", "sample_output_relpath": "derived/input_output/data/p03683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03683/Pascal/s830310709.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s830310709", "user_id": "u679669944"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "Var A,B,N:Longint;\n D:Array[1..100000] Of Qword;\n\nProcedure Xuli;\nVar i:Longint;\nBegin\n D[1]:=1;\n For i:=2 to 100000 Do D[i]:=((D[i-1] Mod 1000000007)*(i Mod 1000000007))Mod 1000000007;\nEnd;\n\nBegin\n //Assign(Input,'TRAINED.INP'); Reset(Input);\n //Assign(Output,'TRAINED.OUT'); Rewrite(Output);\n Readln(A,B);\n Xuli;\n If ABS(A-B)>1 Then\n Begin\n Write(0);\n Halt;\n End;\n N:=(D[B]*D[A])Mod 1000000007;\n If A=B Then\n Begin\n N:=(D[B]*D[A]*2)Mod 1000000007;\n Write(N);\n Halt;\n End;\n Write(N);\n //Close(Input);\n ///Close(Output);\nEnd.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03683", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 748, "cpu_time_ms": 4, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s920530069", "group_id": "codeNet:p03685", "input_text": "var\n m,i,j,a,b,c,d,x,y,n:longint;\n gtx,gty:real;\n xx1,xx2,xa,xb,xy1,xy2:array [0..1000000] of real;\nfunction max(a,b:real):real;\n begin\n if a>b then exit(a);\n exit(b);\n end;\nfunction min(a,b:real):real;\n begin\n if a>b then exit(b);\n exit(a);\n end;\nfunction kt(var a,b:real; c,d:longint):boolean;\n begin\n if (max(xx1[c],xx2[c])>=a) and (min(xx1[c],xx2[c])<=a) and (max(xy1[c],xy2[c])>=b) and (min(xy1[c],xy2[c])<=b) then\n exit(true);\n if (max(xx1[d],xx2[d])>=a) and (min(xx1[d],xx2[d])<=a) and (max(xy1[d],xy2[d])>=b) and (min(xy1[d],xy2[d])<=b) then\n exit(true);\n exit(false);\n end;\nbegin\nreadln(x,y,n);\nfor i:=1 to n do\n begin\n readln(a,b,c,d);\n if ((a=x) or (a=0) or (b=y) or (b=0)) and ((c=x) or (c=0) or (d=y) or (d=0)) then\n if a<>c then\n begin\n inc(m);\n xa[m]:=(b-d)/(a-c);\n xb[m]:=b-a*xa[m];\n xx1[m]:=a;\n xy1[m]:=b;\n xx2[m]:=c;\n xy2[m]:=d;\n end;\n end;\nfor i:=1 to m do\n for j:=i+1 to m do\n begin\n gtx:=-(xb[i]-xb[j])/(xa[i]-xa[j]);\n gty:=xa[i]*gtx+xb[i];\n if kt(gtx,gty,i,j) then\n begin\n writeln('NO');\n halt;\n end;\n end;\nwriteln('YES');\nend.", "language": "Pascal", "metadata": {"date": 1498358167, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03685.html", "problem_id": "p03685", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03685/input.txt", "sample_output_relpath": "derived/input_output/data/p03685/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03685/Pascal/s920530069.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s920530069", "user_id": "u072293533"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var\n m,i,j,a,b,c,d,x,y,n:longint;\n gtx,gty:real;\n xx1,xx2,xa,xb,xy1,xy2:array [0..1000000] of real;\nfunction max(a,b:real):real;\n begin\n if a>b then exit(a);\n exit(b);\n end;\nfunction min(a,b:real):real;\n begin\n if a>b then exit(b);\n exit(a);\n end;\nfunction kt(var a,b:real; c,d:longint):boolean;\n begin\n if (max(xx1[c],xx2[c])>=a) and (min(xx1[c],xx2[c])<=a) and (max(xy1[c],xy2[c])>=b) and (min(xy1[c],xy2[c])<=b) then\n exit(true);\n if (max(xx1[d],xx2[d])>=a) and (min(xx1[d],xx2[d])<=a) and (max(xy1[d],xy2[d])>=b) and (min(xy1[d],xy2[d])<=b) then\n exit(true);\n exit(false);\n end;\nbegin\nreadln(x,y,n);\nfor i:=1 to n do\n begin\n readln(a,b,c,d);\n if ((a=x) or (a=0) or (b=y) or (b=0)) and ((c=x) or (c=0) or (d=y) or (d=0)) then\n if a<>c then\n begin\n inc(m);\n xa[m]:=(b-d)/(a-c);\n xb[m]:=b-a*xa[m];\n xx1[m]:=a;\n xy1[m]:=b;\n xx2[m]:=c;\n xy2[m]:=d;\n end;\n end;\nfor i:=1 to m do\n for j:=i+1 to m do\n begin\n gtx:=-(xb[i]-xb[j])/(xa[i]-xa[j]);\n gty:=xa[i]*gtx+xb[i];\n if kt(gtx,gty,i,j) then\n begin\n writeln('NO');\n halt;\n end;\n end;\nwriteln('YES');\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke is playing a puzzle game.\nIn this game, you are given a rectangular board of dimensions R × C, filled with numbers. Each integer i from 1 through N is written twice, at the coordinates (x_{i,1},y_{i,1}) and (x_{i,2},y_{i,2}).\n\nThe objective is to draw a curve connecting the pair of points where the same integer is written, for every integer from 1 through N.\nHere, the curves may not go outside the board or cross each other.\n\nDetermine whether this is possible.\n\nConstraints\n\n1 ≤ R,C ≤ 10^8\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_{i,1},x_{i,2} ≤ R(1 ≤ i ≤ N)\n\n0 ≤ y_{i,1},y_{i,2} ≤ C(1 ≤ i ≤ N)\n\nAll given points are distinct.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR C N\nx_{1,1} y_{1,1} x_{1,2} y_{1,2}\n:\nx_{N,1} y_{N,1} x_{N,2} y_{N,2}\n\nOutput\n\nPrint YES if the objective is achievable; print NO otherwise.\n\nSample Input 1\n\n4 2 3\n0 1 3 1\n1 1 4 1\n2 0 2 2\n\nSample Output 1\n\nYES\n\nThe above figure shows a possible solution.\n\nSample Input 2\n\n2 2 4\n0 0 2 2\n2 0 0 1\n0 2 1 2\n1 1 2 1\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n5 5 7\n0 0 2 4\n2 3 4 5\n3 5 5 2\n5 5 5 4\n0 3 5 1\n2 2 4 4\n0 5 4 1\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n1 1 2\n0 0 1 1\n1 0 0 1\n\nSample Output 4\n\nNO", "sample_input": "4 2 3\n0 1 3 1\n1 1 4 1\n2 0 2 2\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03685", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke is playing a puzzle game.\nIn this game, you are given a rectangular board of dimensions R × C, filled with numbers. Each integer i from 1 through N is written twice, at the coordinates (x_{i,1},y_{i,1}) and (x_{i,2},y_{i,2}).\n\nThe objective is to draw a curve connecting the pair of points where the same integer is written, for every integer from 1 through N.\nHere, the curves may not go outside the board or cross each other.\n\nDetermine whether this is possible.\n\nConstraints\n\n1 ≤ R,C ≤ 10^8\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_{i,1},x_{i,2} ≤ R(1 ≤ i ≤ N)\n\n0 ≤ y_{i,1},y_{i,2} ≤ C(1 ≤ i ≤ N)\n\nAll given points are distinct.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR C N\nx_{1,1} y_{1,1} x_{1,2} y_{1,2}\n:\nx_{N,1} y_{N,1} x_{N,2} y_{N,2}\n\nOutput\n\nPrint YES if the objective is achievable; print NO otherwise.\n\nSample Input 1\n\n4 2 3\n0 1 3 1\n1 1 4 1\n2 0 2 2\n\nSample Output 1\n\nYES\n\nThe above figure shows a possible solution.\n\nSample Input 2\n\n2 2 4\n0 0 2 2\n2 0 0 1\n0 2 1 2\n1 1 2 1\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n5 5 7\n0 0 2 4\n2 3 4 5\n3 5 5 2\n5 5 5 4\n0 3 5 1\n2 2 4 4\n0 5 4 1\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n1 1 2\n0 0 1 1\n1 0 0 1\n\nSample Output 4\n\nNO", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1615, "cpu_time_ms": 56, "memory_kb": 15104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s105432058", "group_id": "codeNet:p03694", "input_text": "Uses Math,A52,Xqc;\nConst int_MAX=2147483647;\nVar maxx,minn,i,x,n:Longint;\nBegin{main}\n minn:=int_MAX;\n maxx:=-int_MAX;\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n maxx:=max(maxx,x);\n minn:=min(minn,x);\n end;\n write(maxx-minn);\nEnd.", "language": "Pascal", "metadata": {"date": 1583881331, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03694.html", "problem_id": "p03694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03694/input.txt", "sample_output_relpath": "derived/input_output/data/p03694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03694/Pascal/s105432058.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s105432058", "user_id": "u519460719"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "Uses Math,A52,Xqc;\nConst int_MAX=2147483647;\nVar maxx,minn,i,x,n:Longint;\nBegin{main}\n minn:=int_MAX;\n maxx:=-int_MAX;\n readln(n);\n for i:=1 to n do\n begin\n read(x);\n maxx:=max(maxx,x);\n minn:=min(minn,x);\n end;\n write(maxx-minn);\nEnd.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.\n\nFind the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n0 ≤ a_i ≤ 1000\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 minimum distance to be traveled.\n\nSample Input 1\n\n4\n2 3 7 9\n\nSample Output 1\n\n7\n\nThe travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.\n\nIt is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.\n\nSample Input 2\n\n8\n3 1 4 1 5 9 2 6\n\nSample Output 2\n\n8\n\nThere may be more than one house at a position.", "sample_input": "4\n2 3 7 9\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03694", "source_text": "Score : 200 points\n\nProblem Statement\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.\n\nFind the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n0 ≤ a_i ≤ 1000\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 minimum distance to be traveled.\n\nSample Input 1\n\n4\n2 3 7 9\n\nSample Output 1\n\n7\n\nThe travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.\n\nIt is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.\n\nSample Input 2\n\n8\n3 1 4 1 5 9 2 6\n\nSample Output 2\n\n8\n\nThere may be more than one house at a position.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 276, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s275849699", "group_id": "codeNet:p03695", "input_text": "//const fi='colorful.inp';\n // fo='colorful.out';\nvar a:array[0..10000] of longint;\n kt1,kt2,kt3,kt4,kt5,kt6,kt7,kt8:boolean;\n n,d,dp:longint;\n//procedure mo;\n//begin\n // assign(input,fi);\n // reset(input);\n // assign(output,fo);\n // rewrite(output);\n//end;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i] >= 3200 then\n inc(dp)\n end;\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n for i:=1 to n do\n begin\n if (a[i] > 2799)and(a[i] <= 3199) then\n begin\n if kt1=true then\n begin\n kt1:=false;\n inc(d);\n end;\n end;\n if (a[i] > 2399)and(a[i] <= 2799) then\n begin\n if kt2=true then\n begin\n kt2:=false;\n inc(d);\n end;\n end;\n if (a[i] > 1999)and(a[i] <= 2399) then\n begin\n if kt3=true then\n begin\n kt3:=false;\n inc(d);\n end;\n end;\n if (a[i] > 1599)and(a[i] <= 1999) then\n begin\n if kt4=true then\n begin\n kt4:=false;\n inc(d);\n end;\n end;\n if (a[i] > 1199)and(a[i] <= 1599) then\n begin\n if kt5=true then\n begin\n kt5:=false;\n inc(d);\n end;\n end;\n if (a[i] > 799)and(a[i] <= 1999) then\n begin\n if kt6=true then\n begin\n kt6:=false;\n inc(d);\n end;\n end;\n if (a[i] > 399)and(a[i] <= 799) then\n begin\n if kt7=true then\n begin\n kt7:=false;\n inc(d);\n end;\n end;\n if (a[i] >= 1)and(a[i] <= 399) then\n begin\n if kt8=true then\n begin\n kt8:=true;\n inc(d);\n end;\n end;\n end;\nend;\n\nprocedure xuat;\nbegin\n if dp=n then\n begin\n write(1,' ',n);\n end\n else\n write(d,' ',d+dp);\nend;\n\nbegin\n // mo;\n nhap;\n kt1:=true;\n kt2:=true;\n kt3:=true;\n kt4:=true;\n kt5:=true;\n kt6:=true;\n kt7:=true;\n kt8:=true;\n xuly;\n xuat;\nend.\n", "language": "Pascal", "metadata": {"date": 1497148574, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03695.html", "problem_id": "p03695", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03695/input.txt", "sample_output_relpath": "derived/input_output/data/p03695/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03695/Pascal/s275849699.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s275849699", "user_id": "u468561345"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "//const fi='colorful.inp';\n // fo='colorful.out';\nvar a:array[0..10000] of longint;\n kt1,kt2,kt3,kt4,kt5,kt6,kt7,kt8:boolean;\n n,d,dp:longint;\n//procedure mo;\n//begin\n // assign(input,fi);\n // reset(input);\n // assign(output,fo);\n // rewrite(output);\n//end;\n\nprocedure nhap;\nvar i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n read(a[i]);\n if a[i] >= 3200 then\n inc(dp)\n end;\nend;\n\nprocedure xuly;\nvar i:longint;\nbegin\n for i:=1 to n do\n begin\n if (a[i] > 2799)and(a[i] <= 3199) then\n begin\n if kt1=true then\n begin\n kt1:=false;\n inc(d);\n end;\n end;\n if (a[i] > 2399)and(a[i] <= 2799) then\n begin\n if kt2=true then\n begin\n kt2:=false;\n inc(d);\n end;\n end;\n if (a[i] > 1999)and(a[i] <= 2399) then\n begin\n if kt3=true then\n begin\n kt3:=false;\n inc(d);\n end;\n end;\n if (a[i] > 1599)and(a[i] <= 1999) then\n begin\n if kt4=true then\n begin\n kt4:=false;\n inc(d);\n end;\n end;\n if (a[i] > 1199)and(a[i] <= 1599) then\n begin\n if kt5=true then\n begin\n kt5:=false;\n inc(d);\n end;\n end;\n if (a[i] > 799)and(a[i] <= 1999) then\n begin\n if kt6=true then\n begin\n kt6:=false;\n inc(d);\n end;\n end;\n if (a[i] > 399)and(a[i] <= 799) then\n begin\n if kt7=true then\n begin\n kt7:=false;\n inc(d);\n end;\n end;\n if (a[i] >= 1)and(a[i] <= 399) then\n begin\n if kt8=true then\n begin\n kt8:=true;\n inc(d);\n end;\n end;\n end;\nend;\n\nprocedure xuat;\nbegin\n if dp=n then\n begin\n write(1,' ',n);\n end\n else\n write(d,' ',d+dp);\nend;\n\nbegin\n // mo;\n nhap;\n kt1:=true;\n kt2:=true;\n kt3:=true;\n kt4:=true;\n kt5:=true;\n kt6:=true;\n kt7:=true;\n kt8:=true;\n xuly;\n xuat;\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\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 minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "sample_input": "4\n2100 2500 2700 2700\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p03695", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\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 minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3210, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s941739212", "group_id": "codeNet:p03695", "input_text": "var\n x,i,n,s:longint;\n a:array [0..10] of longint;\nbegin\nreadln(n);\nfor i:=1 to n do\n begin\n read(x);\n if x<400 then a[1]:=1 else\n if x<800 then a[2]:=1 else\n if x<1200 then a[3]:=1 else\n if x<1600 then a[4]:=1 else\n if x<2000 then a[5]:=1 else\n if x<2400 then a[6]:=1 else\n if x<2800 then a[7]:=1 else\n if x<3200 then a[8]:=1 else\n inc(a[9]);\n end;\nfor i:=1 to 8 do s:=s+a[i];\nif a[9]<>0 then writeln(s,' ',s+a[9])\nelse writeln(s,' ',s);\nend.", "language": "Pascal", "metadata": {"date": 1497144369, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03695.html", "problem_id": "p03695", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03695/input.txt", "sample_output_relpath": "derived/input_output/data/p03695/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03695/Pascal/s941739212.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s941739212", "user_id": "u072293533"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "var\n x,i,n,s:longint;\n a:array [0..10] of longint;\nbegin\nreadln(n);\nfor i:=1 to n do\n begin\n read(x);\n if x<400 then a[1]:=1 else\n if x<800 then a[2]:=1 else\n if x<1200 then a[3]:=1 else\n if x<1600 then a[4]:=1 else\n if x<2000 then a[5]:=1 else\n if x<2400 then a[6]:=1 else\n if x<2800 then a[7]:=1 else\n if x<3200 then a[8]:=1 else\n inc(a[9]);\n end;\nfor i:=1 to 8 do s:=s+a[i];\nif a[9]<>0 then writeln(s,' ',s+a[9])\nelse writeln(s,' ',s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\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 minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "sample_input": "4\n2100 2500 2700 2700\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p03695", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\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 minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 9, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s709325422", "group_id": "codeNet:p03701", "input_text": "program j01;\nconst maxn=400086;\ntype opr=record w:int64;id:longint;end;\nvar sum:array[0..maxn]of int64;\n op:array[0..maxn]of opr;\n tot:longint;\n ans:int64;\n c,a:array[0..maxn]of longint;\n n,i,k:longint;\n\nprocedure sort(l,r:longint);\nvar i,j,x:longint;y:opr;\nbegin\n i:=l;j:=r;x:=op[(i+j)div 2].w;\n repeat\n while op[i].wj;\n if iop[i-1].w then inc(tot);\n a[op[i].id]:=tot;\n end;\nend;\n\nprocedure ins(i:longint);\nbegin\n while i<=tot do\n begin\n inc(c[i]);inc(i,i and(-i));\n end;\nend;\n\nfunction ask(i:longint):longint;\nvar res:longint;\nbegin\n res:=0;\n while i>0 do\n begin\n inc(res,c[i]);dec(i,i and(-i));\n end;\n exit(res);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do a[i]:=a[i]-k;\n sum[1]:=0;inc(n);for i:=2 to n do sum[i]:=sum[i-1]+a[i-1];\n for i:=1 to n do\n begin\n op[i].w:=sum[i];op[i].id:=i;\n end;\n //for i:=1 to n do write(sum[i],' ');writeln;\n disc;\n for i:=1 to n do\n begin\n inc(ans,ask(a[i]));ins(a[i]);\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1496541521, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03701.html", "problem_id": "p03701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03701/input.txt", "sample_output_relpath": "derived/input_output/data/p03701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03701/Pascal/s709325422.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s709325422", "user_id": "u550756195"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "program j01;\nconst maxn=400086;\ntype opr=record w:int64;id:longint;end;\nvar sum:array[0..maxn]of int64;\n op:array[0..maxn]of opr;\n tot:longint;\n ans:int64;\n c,a:array[0..maxn]of longint;\n n,i,k:longint;\n\nprocedure sort(l,r:longint);\nvar i,j,x:longint;y:opr;\nbegin\n i:=l;j:=r;x:=op[(i+j)div 2].w;\n repeat\n while op[i].wj;\n if iop[i-1].w then inc(tot);\n a[op[i].id]:=tot;\n end;\nend;\n\nprocedure ins(i:longint);\nbegin\n while i<=tot do\n begin\n inc(c[i]);inc(i,i and(-i));\n end;\nend;\n\nfunction ask(i:longint):longint;\nvar res:longint;\nbegin\n res:=0;\n while i>0 do\n begin\n inc(res,c[i]);dec(i,i and(-i));\n end;\n exit(res);\nend;\n\nbegin\n readln(n,k);\n for i:=1 to n do read(a[i]);\n for i:=1 to n do a[i]:=a[i]-k;\n sum[1]:=0;inc(n);for i:=2 to n do sum[i]:=sum[i-1]+a[i-1];\n for i:=1 to n do\n begin\n op[i].w:=sum[i];op[i].id:=i;\n end;\n //for i:=1 to n do write(sum[i],' ');writeln;\n disc;\n for i:=1 to n do\n begin\n inc(ans,ask(a[i]));ins(a[i]);\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.\n\nHowever, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 100\n\n1 ≤ s_i ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the maximum value that can be displayed as your grade.\n\nSample Input 1\n\n3\n5\n10\n15\n\nSample Output 1\n\n25\n\nYour grade will be 25 if the 10-point and 15-point questions are answered correctly and the 5-point question is not, and this grade will be displayed correctly. Your grade will become 30 if the 5-point question is also answered correctly, but this grade will be incorrectly displayed as 0.\n\nSample Input 2\n\n3\n10\n10\n15\n\nSample Output 2\n\n35\n\nYour grade will be 35 if all the questions are answered correctly, and this grade will be displayed correctly.\n\nSample Input 3\n\n3\n10\n20\n30\n\nSample Output 3\n\n0\n\nRegardless of whether each question is answered correctly or not, your grade will be a multiple of 10 and displayed as 0.", "sample_input": "3\n5\n10\n15\n"}, "reference_outputs": ["25\n"], "source_document_id": "p03701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that are answered correctly. When you finish answering the questions, your answers will be immediately judged and your grade will be displayed... if everything goes well.\n\nHowever, the examination system is actually flawed, and if your grade is a multiple of 10, the system displays 0 as your grade. Otherwise, your grade is displayed correctly. In this situation, what is the maximum value that can be displayed as your grade?\n\nConstraints\n\nAll input values are integers.\n\n1 ≤ N ≤ 100\n\n1 ≤ s_i ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the maximum value that can be displayed as your grade.\n\nSample Input 1\n\n3\n5\n10\n15\n\nSample Output 1\n\n25\n\nYour grade will be 25 if the 10-point and 15-point questions are answered correctly and the 5-point question is not, and this grade will be displayed correctly. Your grade will become 30 if the 5-point question is also answered correctly, but this grade will be incorrectly displayed as 0.\n\nSample Input 2\n\n3\n10\n10\n15\n\nSample Output 2\n\n35\n\nYour grade will be 35 if all the questions are answered correctly, and this grade will be displayed correctly.\n\nSample Input 3\n\n3\n10\n20\n30\n\nSample Output 3\n\n0\n\nRegardless of whether each question is answered correctly or not, your grade will be a multiple of 10 and displayed as 0.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1337, "cpu_time_ms": 1, "memory_kb": 6272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s334133263", "group_id": "codeNet:p03716", "input_text": "const fi ='';\n fo ='';\n\nvar n,top:longint;\n f,g:text;\n a,q,vt:array[0..300005] of longint;\n l,r:array[0..300005] of int64;\n\nprocedure nhap;\nvar i:longint;\nbegin\n assign(f,fi);reset(f);\n readln(f,n);\n for i:=1 to 3*n do\n read(f,a[i]);\n close(f);\nend;\n\nprocedure up(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (a[v]a[q[l1+1]]) then inc(l1);\n if a[q[l1]]>=a[v] then break;\n q[k]:=q[l1];\n vt[q[k]]:=k;\n k:=l1;\n end;\n q[k]:=v;\n vt[v]:=k;\nend;\n\nprocedure put(u :longint);\nbegin\n inc(top); q[top]:=u; vt[u]:=top;\n up(top);\nend;\n\nfunction get :longint;\nbegin\n get:=q[1];\n q[1]:=q[top]; vt[q[1]]:=1;\n dec(top);\n down(1);\nend;\n\nprocedure up1(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (a[v]>a[q[k div 2]]) do\n begin\n q[k]:=q[k div 2];\n vt[q[k]]:=k;\n k:=k div 2;\n end;\n q[k]:=v;\n vt[q[k]]:=k;\nend;\n\nprocedure down1(k :longint);\nvar l1,v :longint;\nbegin\n v:=q[k];\n while 2*k<=top do\n begin\n l1:=2*k;\n if (l1a[q[1]]) and (top>0) then\n begin\n u:=get;\n l[i]:=l[i-1]+a[i]-a[u];\n put(i);\n end else begin l[i]:=l[i-1];end;\n end;\n tong:=0;top:=0;q[0]:=0;a[0]:=round(1e9);\n for i:=3*n downto 2*n+1 do\n begin\n tong:=tong+a[i];\n put1(i);\n end;\n r[2*n+1]:=tong;\n for i:=2*n downto n+1 do\n begin\n if (a[i]0) then\n begin\n u:=get1;\n r[i]:=r[i+1]+a[i]-a[u];\n put1(i);\n end else begin r[i]:=r[i+1];end;\n end;\n res:=-round(1e18);\n for i:=n to 2*n do\n if resa[q[l1+1]]) then inc(l1);\n if a[q[l1]]>=a[v] then break;\n q[k]:=q[l1];\n vt[q[k]]:=k;\n k:=l1;\n end;\n q[k]:=v;\n vt[v]:=k;\nend;\n\nprocedure put(u :longint);\nbegin\n inc(top); q[top]:=u; vt[u]:=top;\n up(top);\nend;\n\nfunction get :longint;\nbegin\n get:=q[1];\n q[1]:=q[top]; vt[q[1]]:=1;\n dec(top);\n down(1);\nend;\n\nprocedure up1(k :longint);\nvar v :longint;\nbegin\n v:=q[k];\n while (a[v]>a[q[k div 2]]) do\n begin\n q[k]:=q[k div 2];\n vt[q[k]]:=k;\n k:=k div 2;\n end;\n q[k]:=v;\n vt[q[k]]:=k;\nend;\n\nprocedure down1(k :longint);\nvar l1,v :longint;\nbegin\n v:=q[k];\n while 2*k<=top do\n begin\n l1:=2*k;\n if (l1a[q[1]]) and (top>0) then\n begin\n u:=get;\n l[i]:=l[i-1]+a[i]-a[u];\n put(i);\n end else begin l[i]:=l[i-1];end;\n end;\n tong:=0;top:=0;q[0]:=0;a[0]:=round(1e9);\n for i:=3*n downto 2*n+1 do\n begin\n tong:=tong+a[i];\n put1(i);\n end;\n r[2*n+1]:=tong;\n for i:=2*n downto n+1 do\n begin\n if (a[i]0) then\n begin\n u:=get1;\n r[i]:=r[i+1]+a[i]-a[u];\n put1(i);\n end else begin r[i]:=r[i+1];end;\n end;\n res:=-round(1e18);\n for i:=n to 2*n do\n if res=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]>=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmax);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]>=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmax);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]j then exit(i); exit(j); end;\nprocedure swap(var a,b:Longint);\nvar temp:longint;\nbegin\n temp:=a;\n a:=b;\n b:=temp;\nend;\nprocedure upmax(i:longint);\nbegin\n if (i=1)or(heapmax[i div 2]>=heapmax[i]) then exit\n else begin\n swap(heapmax[i],heapmax[i div 2]);\n upmax(i div 2);\n end;\nend;\nprocedure upmin(i:longint);\nbegin\n if (i=1)or(heapmin[i div 2]<=heapmin[i]) then exit\n else begin\n swap(heapmin[i div 2],heapmin[i]);\n upmin(i div 2);\n end;\nend;\nprocedure downmax(i:longint);\nvar gt:longint;\nbegin\n gt:=i*2;\n if gt>nheapmax then exit;\n if (gt+1<=nheapmax)and(heapmax[gt]=heapmax[gt] then exit;\n begin\n swap(heapmax[gt],heapmax[i]);\n downmax(gt);\n end;\nend;\nprocedure downmin(i:longint);\nvar gt:longint;\nbegin\n gt:=i*2;\n if gt>nheapmin then exit;\n if (gt+1<=nheapmin)and(heapmin[gt]>heapmin[gt+1]) then inc(gt);\n if heapmin[i]<=heapmin[gt] then exit;\n begin\n swap(heapmin[gt],heapmin[i]);\n downmin(gt);\n end;\nend;\nprocedure pushmin(x:longint);\nbegin\n inc(nheapmin);\n heapmin[nheapmin]:=x;\n upmin(nheapmin);\nend;\nprocedure pushmax(x:longint);\nbegin\n inc(nheapmax);\n heapmax[nheapmax]:=x;\n upmax(nheapmax);\nend;\nprocedure popmin(x:longint);\nbegin\n heapmin[1]:=x;\n downmin(1);\nend;\nprocedure popmax(x:longint);\nbegin\n heapmax[1]:=x;\n downmax(1);\nend;\nprocedure inp;\nvar i:longint;\nbegin\n read(n);\n for i:=1 to 3*n do read(a[i]);\nend;\nprocedure main;\nvar i,j:longint;\n res:int64;\n nmax,nmin:longint;\nbegin\n res:=0;\n for i:=1 to n do\n begin\n res:=res+a[i];\n pushmin(a[i]);\n end;\n l[n]:=res;\n for i:=n+1 to 2*n do\n begin\n if a[i]>heapmin[1] then\n begin\n res:=res-heapmin[1]+a[i];\n popmin(a[i]);\n end;\n l[i]:=res;\n end;\n res:=0;\n for i:=3*n downto 2*n+1 do\n begin\n res:=res+a[i];\n pushmax(a[i]);\n end;\n r[2*n+1]:=res;\n for i:=2*n downto n+1 do\n begin\n if a[i]j then exit(i); exit(j); end;\nprocedure swap(var a,b:Longint);\nvar temp:longint;\nbegin\n temp:=a;\n a:=b;\n b:=temp;\nend;\nprocedure upmax(i:longint);\nbegin\n if (i=1)or(heapmax[i div 2]>=heapmax[i]) then exit\n else begin\n swap(heapmax[i],heapmax[i div 2]);\n upmax(i div 2);\n end;\nend;\nprocedure upmin(i:longint);\nbegin\n if (i=1)or(heapmin[i div 2]<=heapmin[i]) then exit\n else begin\n swap(heapmin[i div 2],heapmin[i]);\n upmin(i div 2);\n end;\nend;\nprocedure downmax(i:longint);\nvar gt:longint;\nbegin\n gt:=i*2;\n if gt>nheapmax then exit;\n if (gt+1<=nheapmax)and(heapmax[gt]=heapmax[gt] then exit;\n begin\n swap(heapmax[gt],heapmax[i]);\n downmax(gt);\n end;\nend;\nprocedure downmin(i:longint);\nvar gt:longint;\nbegin\n gt:=i*2;\n if gt>nheapmin then exit;\n if (gt+1<=nheapmin)and(heapmin[gt]>heapmin[gt+1]) then inc(gt);\n if heapmin[i]<=heapmin[gt] then exit;\n begin\n swap(heapmin[gt],heapmin[i]);\n downmin(gt);\n end;\nend;\nprocedure pushmin(x:longint);\nbegin\n inc(nheapmin);\n heapmin[nheapmin]:=x;\n upmin(nheapmin);\nend;\nprocedure pushmax(x:longint);\nbegin\n inc(nheapmax);\n heapmax[nheapmax]:=x;\n upmax(nheapmax);\nend;\nprocedure popmin(x:longint);\nbegin\n heapmin[1]:=x;\n downmin(1);\nend;\nprocedure popmax(x:longint);\nbegin\n heapmax[1]:=x;\n downmax(1);\nend;\nprocedure inp;\nvar i:longint;\nbegin\n read(n);\n for i:=1 to 3*n do read(a[i]);\nend;\nprocedure main;\nvar i,j:longint;\n res:int64;\n nmax,nmin:longint;\nbegin\n res:=0;\n for i:=1 to n do\n begin\n res:=res+a[i];\n pushmin(a[i]);\n end;\n l[n]:=res;\n for i:=n+1 to 2*n do\n begin\n if a[i]>heapmin[1] then\n begin\n res:=res-heapmin[1]+a[i];\n popmin(a[i]);\n end;\n l[i]:=res;\n end;\n res:=0;\n for i:=3*n downto 2*n+1 do\n begin\n res:=res+a[i];\n pushmax(a[i]);\n end;\n r[2*n+1]:=res;\n for i:=2*n downto n+1 do\n begin\n if a[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]>=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]>=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]top then exit;\nif (jheap1[i div 2]) then exit;\nswap(heap1[i],heap1[i div 2]);\nupheap1(i div 2);\nEnd;\n(*===================================*)\nprocedure downheap1(i:longint);\nvar j:longint;\nBegin\nj:=i*2;\nif j>top1 then exit;\nif (jheap1[j+1]) then inc(j);\nif heap1[i]>heap1[j] then\n begin\n swap(heap1[i],heap1[j]);\n downheap1(j);\n end;\nEnd;\n(*===================================*)\nprocedure push1(x:longint);\nBegin\ninc(top1);\nheap1[top1]:=x;\nupheap1(top1);\nEnd;\n(*===================================*)\nfunction pop1:longint;\nBegin\npop1:=heap1[1];\nheap1[1]:=heap1[top1];\ndec(top1);\ndownheap1(1);\nEnd;\n(*===============================*)\nprocedure trong;\nBegin\nfor i:=1 to n do begin l[i]:=l[i-1]+a[i]; push1(a[i]); end;\nfor i:=n+1 to 3*n do\n begin\n l[i]:=l[i-1]+a[i];\n push1(a[i]);\n l[i]:=l[i]-pop1;\n end;\n\nfor i:=3*n downto 2*n+1 do begin g[i]:=g[i+1]+a[i]; push(a[i]); end;\nfor i:=2*n downto 1 do\n begin\n g[i]:=g[i+1]+a[i];\n push(a[i]);\n g[i]:=g[i]-pop;\n end;\nEnd;\n(*===============================*)\nBEGIN\ninp;\nassign(f,fo);\nrewrite(f);\ntrong;\nkq:=-maxlongint*100000;\nfor i:=n to 2*n do\n if l[i]-g[i+1]>kq then kq:=l[i]-g[i+1];\nwriteln(f,kq);\nclose(f);\nEND.", "language": "Pascal", "metadata": {"date": 1510853017, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03716.html", "problem_id": "p03716", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03716/input.txt", "sample_output_relpath": "derived/input_output/data/p03716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03716/Pascal/s015946624.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s015946624", "user_id": "u393992397"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const fi='';//B.inp';\n fo='';//B.out';\nvar f:text;\n i,j,n,top,top1:longint;\n kq:int64;\n heap,heap1,a:array[0..5000000] of longint;\n l,g:array[0..5000000] of int64;\n(*===================================*)\nprocedure inp;\nBegin\nassign(f,fi);\nreset(f);\nreadln(f,n);\nfor i:=1 to 3*n do read(f,a[i]);\nclose(f);\nEnd;\n(*===================================*)\nprocedure swap(var a,b:longint);\nvar y:longint;\nBegin\ny:=a;\na:=b;\nb:=y;\nEnd;\n(*===================================*)\nprocedure upheap(i:longint);\nBegin\nif (i=1) or (heap[i]top then exit;\nif (jheap1[i div 2]) then exit;\nswap(heap1[i],heap1[i div 2]);\nupheap1(i div 2);\nEnd;\n(*===================================*)\nprocedure downheap1(i:longint);\nvar j:longint;\nBegin\nj:=i*2;\nif j>top1 then exit;\nif (jheap1[j+1]) then inc(j);\nif heap1[i]>heap1[j] then\n begin\n swap(heap1[i],heap1[j]);\n downheap1(j);\n end;\nEnd;\n(*===================================*)\nprocedure push1(x:longint);\nBegin\ninc(top1);\nheap1[top1]:=x;\nupheap1(top1);\nEnd;\n(*===================================*)\nfunction pop1:longint;\nBegin\npop1:=heap1[1];\nheap1[1]:=heap1[top1];\ndec(top1);\ndownheap1(1);\nEnd;\n(*===============================*)\nprocedure trong;\nBegin\nfor i:=1 to n do begin l[i]:=l[i-1]+a[i]; push1(a[i]); end;\nfor i:=n+1 to 3*n do\n begin\n l[i]:=l[i-1]+a[i];\n push1(a[i]);\n l[i]:=l[i]-pop1;\n end;\n\nfor i:=3*n downto 2*n+1 do begin g[i]:=g[i+1]+a[i]; push(a[i]); end;\nfor i:=2*n downto 1 do\n begin\n g[i]:=g[i+1]+a[i];\n push(a[i]);\n g[i]:=g[i]-pop;\n end;\nEnd;\n(*===============================*)\nBEGIN\ninp;\nassign(f,fo);\nrewrite(f);\ntrong;\nkq:=-maxlongint*100000;\nfor i:=n to 2*n do\n if l[i]-g[i+1]>kq then kq:=l[i]-g[i+1];\nwriteln(f,kq);\nclose(f);\nEND.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "sample_input": "2\n3 1 4 1 5 9\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03716", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2404, "cpu_time_ms": 129, "memory_kb": 12800}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s297634050", "group_id": "codeNet:p03716", "input_text": "Const fi='';\n fo='';\nVar f:Text;\n n:Longint;\n A:Array[0..300000] of Longint;\n L1,L2:Array[0..300000] of Int64;\n Heapmin,Heapmax:Array[0..300000] of Longint;\n nheapmin,nheapmax:Longint; sol:Int64;\nFunction max(i,j:Int64):Int64; Begin If i=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]<=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]=A[Heapmin[x div 2]]) then Exit\n Else Begin\n Swap(Heapmin[x],Heapmin[x div 2]);\n Upheapmin(x div 2);\n End;\nEnd;\nProcedure Downheapmin(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmin div 2) then Exit;\n If (A[Heapmin[x*2]]>=A[Heapmin[x*2+1]]) and (x*2+1<=nheapmin) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmin[x]]<=A[heapmin[vt]]) then Exit\n Else Begin\n Swap(heapmin[x],heapmin[vt]);\n Downheapmin(vt);\n End;\nEnd;\nProcedure Pushmin(x:Longint);\nBegin\n Inc(nheapmin);\n heapmin[nheapmin]:=x;\n upheapmin(nheapmin);\nEnd;\nProcedure popmin(x:Longint);\nBegin\n heapmin[1]:=x;\n downheapmin(1);\nEnd;\nProcedure Upheapmax(x:Longint);\nBegin\n If (x=1) or (A[Heapmax[x]]<=A[Heapmax[x div 2]]) then Exit\n Else Begin\n Swap(Heapmax[x],Heapmax[x div 2]);\n Upheapmax(x div 2);\n End;\nEnd;\nProcedure Downheapmax(x:Longint);\nVar vt:Longint;\nBegin\n If (x>nheapmax div 2) then Exit;\n If (A[Heapmax[x*2]]<=A[Heapmax[x*2+1]]) and (x*2+1<=nheapmax) then vt:=x*2+1 Else vt:=x*2;\n If (A[Heapmax[x]]<=A[heapmax[vt]]) then Exit\n Else Begin\n Swap(heapmax[x],heapmax[vt]);\n Downheapmax(vt);\n End;\nEnd;\nProcedure Pushmax(x:Longint);\nBegin\n Inc(nheapmax);\n heapmax[nheapmax]:=x;\n upheapmax(nheapmin);\nEnd;\nProcedure popmax(x:Longint);\nBegin\n heapmax[1]:=x;\n downheapmax(1);\nEnd;\nProcedure tongmax;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=1 to n do\n Begin\n k:=k+A[i];\n Pushmin(i);\n End;\n L1[n]:=k;\n For i:=n+1 to 3*n do\n Begin\n If A[i]>A[heapmin[1]] then Begin L1[i]:=L1[i-1]-A[heapmin[1]]+A[i]; Popmin(i); End\n Else L1[i]:=L1[i-1];\n End;\nEnd;\nProcedure tongmin;\nVar i,j,k:Longint;\nBegin\n k:=0;\n For i:=3*n downto 2*n+1 do\n Begin\n k:=k+A[i];\n Pushmax(i);\n End;\n L2[2*n+1]:=k;\n For i:=2*n downto 1 do\n Begin\n If A[i]b[vt-1] do\n begin\n swap(b[vt],b[vt-1]);\n dec(vt);\n end;\n res:=res-b[n+1]+a[i];\n l1[i]:=res;\n end;\n For i:=2*n+1 to 3*n do\n For j:=i+1 to 3*n do\n if a[i]>a[j] then swap(a[i],a[j]);\n res:=0;b[0]:=-1000000005;\n For i:=1 to n do\n begin\n b[i]:=a[i+2*n];\n res:=res+b[i];\n end;\n l2[2*n+1]:=res;\n For i:=2*n downto n+1 do\n begin\n b[n+1]:=a[i];\n vt:=n+1;\n while b[vt]b[vt-1] do\n begin\n swap(b[vt],b[vt-1]);\n dec(vt);\n end;\n res:=res-b[n+1]+a[i];\n l1[i]:=res;\n end;\n For i:=2*n+1 to 3*n do\n For j:=i+1 to 3*n do\n if a[i]>a[j] then swap(a[i],a[j]);\n res:=0;b[0]:=-1000000005;\n For i:=1 to n do\n begin\n b[i]:=a[i+2*n];\n res:=res+b[i];\n end;\n l2[2*n+1]:=res;\n For i:=2*n downto n+1 do\n begin\n b[n+1]:=a[i];\n vt:=n+1;\n while b[vt]top then exit;\nif (jheap1[i div 2]) then exit;\nswap(heap1[i],heap1[i div 2]);\nupheap1(i div 2);\nEnd;\n(*===================================*)\nprocedure downheap1(i:longint);\nvar j:longint;\nBegin\nj:=i*2;\nif j>top1 then exit;\nif (jheap1[j+1]) then inc(j);\nif heap1[i]>heap1[j] then\n begin\n swap(heap1[i],heap1[j]);\n downheap1(j);\n end;\nEnd;\n(*===================================*)\nprocedure push1(x:longint);\nBegin\ninc(top1);\nheap1[top1]:=x;\nupheap1(top1);\nEnd;\n(*===================================*)\nfunction pop1:longint;\nBegin\npop1:=heap1[1];\nheap1[1]:=heap1[top1];\ndec(top1);\ndownheap1(1);\nEnd;\n(*===============================*)\nprocedure trong;\nBegin\nfor i:=1 to n do begin l[i]:=l[i-1]+a[i]; push1(a[i]); end;\nfor i:=n+1 to 3*n do\n begin\n l[i]:=l[i-1]+a[i];\n push1(a[i]);\n l[i]:=l[i]-pop1;\n end;\n\nfor i:=3*n downto 2*n+1 do begin g[i]:=g[i+1]+a[i]; push(a[i]); end;\nfor i:=2*n downto 1 do\n begin\n g[i]:=g[i+1]+a[i];\n push(a[i]);\n g[i]:=g[i]-pop;\n end;\nEnd;\n(*===============================*)\nBEGIN\ninp;\nassign(f,fo);\nrewrite(f);\ntrong;\nkq:=-maxlongint*100000;\nfor i:=n to 2*n do\n if l[i]-g[i+1]>kq then kq:=l[i]-g[i+1];\nwriteln(f,kq);\nclose(f);\nEND.", "language": "Pascal", "metadata": {"date": 1510852498, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03716.html", "problem_id": "p03716", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03716/input.txt", "sample_output_relpath": "derived/input_output/data/p03716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03716/Pascal/s280200804.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s280200804", "user_id": "u393992397"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const fi='';//B.inp';\n fo='';//B.out';\nvar f:text;\n i,j,n,top,top1:longint;\n kq:int64;\n heap,heap1,a,l,g:array[0..5000000] of longint;\n(*===================================*)\nprocedure inp;\nBegin\nassign(f,fi);\nreset(f);\nreadln(f,n);\nfor i:=1 to 3*n do read(f,a[i]);\nclose(f);\nEnd;\n(*===================================*)\nprocedure swap(var a,b:longint);\nvar y:longint;\nBegin\ny:=a;\na:=b;\nb:=y;\nEnd;\n(*===================================*)\nprocedure upheap(i:longint);\nBegin\nif (i=1) or (heap[i]top then exit;\nif (jheap1[i div 2]) then exit;\nswap(heap1[i],heap1[i div 2]);\nupheap1(i div 2);\nEnd;\n(*===================================*)\nprocedure downheap1(i:longint);\nvar j:longint;\nBegin\nj:=i*2;\nif j>top1 then exit;\nif (jheap1[j+1]) then inc(j);\nif heap1[i]>heap1[j] then\n begin\n swap(heap1[i],heap1[j]);\n downheap1(j);\n end;\nEnd;\n(*===================================*)\nprocedure push1(x:longint);\nBegin\ninc(top1);\nheap1[top1]:=x;\nupheap1(top1);\nEnd;\n(*===================================*)\nfunction pop1:longint;\nBegin\npop1:=heap1[1];\nheap1[1]:=heap1[top1];\ndec(top1);\ndownheap1(1);\nEnd;\n(*===============================*)\nprocedure trong;\nBegin\nfor i:=1 to n do begin l[i]:=l[i-1]+a[i]; push1(a[i]); end;\nfor i:=n+1 to 3*n do\n begin\n l[i]:=l[i-1]+a[i];\n push1(a[i]);\n l[i]:=l[i]-pop1;\n end;\n\nfor i:=3*n downto 2*n+1 do begin g[i]:=g[i+1]+a[i]; push(a[i]); end;\nfor i:=2*n downto 1 do\n begin\n g[i]:=g[i+1]+a[i];\n push(a[i]);\n g[i]:=g[i]-pop;\n end;\nEnd;\n(*===============================*)\nBEGIN\ninp;\nassign(f,fo);\nrewrite(f);\ntrong;\nkq:=-maxlongint*100000;\nfor i:=n to 2*n do\n if l[i]-g[i+1]>kq then kq:=l[i]-g[i+1];\nwriteln(f,kq);\nclose(f);\nEND.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "sample_input": "2\n3 1 4 1 5 9\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03716", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2368, "cpu_time_ms": 126, "memory_kb": 10752}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s885551264", "group_id": "codeNet:p03716", "input_text": "uses math;\nvar a,heap,heap1:array[0..500000] of longint;\n res:int64;\n n,nheap:longint;\n f,g:array[0..500000] of int64;\nprocedure nhap;\nvar i:longint;\nbegin\n read(n);\n for i:=1 to 3*n do read(a[i]);\nend;\nprocedure doicho(var x,y:longint);\nvar tg:longint;\nbegin\n tg:=x;\n x:=y;\n y:=tg;\nend;\nprocedure upheap(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap[i]]>a[heap[j]]) then exit;\n doicho(heap[i],heap[j]);\n upheap(j);\nend;\nprocedure downheap(i:longint);\nvar j:longint;\nbegin\n j:=2*i;\n if j>nheap then exit;\n if (ja[heap[j+1]]) then inc(j);\n if a[heap[i]]>a[heap[j]] then\n begin\n doicho(heap[i],heap[j]);\n downheap(j);\n end;\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n heap[nheap]:=x;\n upheap(nheap);\nend;\nfunction pop:longint;\nbegin\n pop:=heap[1];\n heap[1]:=heap[nheap];\n dec(nheap);\n downheap(1);\nend;\nprocedure upheap1(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap1[i]]nheap then exit;\n if (ja[heap[j]]) then exit;\n doicho(heap[i],heap[j]);\n upheap(j);\nend;\nprocedure downheap(i:longint);\nvar j:longint;\nbegin\n j:=2*i;\n if j>nheap then exit;\n if (ja[heap[j+1]]) then inc(j);\n if a[heap[i]]>a[heap[j]] then\n begin\n doicho(heap[i],heap[j]);\n downheap(j);\n end;\nend;\nprocedure push(x:longint);\nbegin\n inc(nheap);\n heap[nheap]:=x;\n upheap(nheap);\nend;\nfunction pop:longint;\nbegin\n pop:=heap[1];\n heap[1]:=heap[nheap];\n dec(nheap);\n downheap(1);\nend;\nprocedure upheap1(i:longint);\nvar j:longint;\nbegin\n j:=i div 2;\n if (i=1) or (a[heap1[i]]nheap then exit;\n if (j=a) and (c<=b) then\n Writeln('Yes')\n else\n Writeln('No');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1516745749, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03719.html", "problem_id": "p03719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03719/input.txt", "sample_output_relpath": "derived/input_output/data/p03719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03719/Pascal/s177180429.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s177180429", "user_id": "u755925739"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n h,w,i,j,count,x,y,sw,m,n,a,b,c:Integer;\n s123,s1,s2,s3:string;\n tf:Boolean;\n nyu:TStringList;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Read(a);\n Read(b);\n Readln(c);\n\n if (c>=a) and (c<=b) then\n Writeln('Yes')\n else\n Writeln('No');\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "sample_input": "1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03719", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 486, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s652090560", "group_id": "codeNet:p03722", "input_text": "begin\n writeln('inf');\nend.", "language": "Pascal", "metadata": {"date": 1583947634, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03722.html", "problem_id": "p03722", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03722/input.txt", "sample_output_relpath": "derived/input_output/data/p03722/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03722/Pascal/s652090560.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s652090560", "user_id": "u743614777"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "begin\n writeln('inf');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a directed graph with N vertices and M edges.\nThe i-th edge (1≤i≤M) points from vertex a_i to vertex b_i, and has a weight c_i.\nWe will play the following single-player game using this graph and a piece.\n\nInitially, the piece is placed at vertex 1, and the score of the player is set to 0.\nThe player can move the piece as follows:\n\nWhen the piece is placed at vertex a_i, move the piece along the i-th edge to vertex b_i. After this move, the score of the player is increased by c_i.\n\nThe player can end the game only when the piece is placed at vertex N.\nThe given graph guarantees that it is possible to traverse from vertex 1 to vertex N.\n\nWhen the player acts optimally to maximize the score at the end of the game, what will the score be?\nIf it is possible to increase the score indefinitely, print inf.\n\nConstraints\n\n2≤N≤1000\n\n1≤M≤min(N(N-1),2000)\n\n1≤a_i,b_i≤N (1≤i≤M)\n\na_i≠b_i (1≤i≤M)\n\na_i≠a_j or b_i≠b_j (1≤i1 then begin writeln('First');halt;end;writeln('Second');\nend.", "language": "Pascal", "metadata": {"date": 1494124405, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03726.html", "problem_id": "p03726", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03726/input.txt", "sample_output_relpath": "derived/input_output/data/p03726/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03726/Pascal/s062646952.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s062646952", "user_id": "u550756195"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "program j01;\nvar f,g,u,v:array[0..100000]of longint;\n n,i:longint;\nbegin\n readln(n);\nfor i:=1 to n-1 do\nbegin\n readln(u[i],v[i]);inc(f[u[i]]);inc(f[v[i]]);\nend;\nfor i:=1 to n-1 do\nbegin\n if u[i]=1 then inc(g[v[i]]);\n if v[i]=1 then inc(g[u[i]]);\nend;\nfor i:=1 to n do if g[i]>1 then begin writeln('First');halt;end;writeln('Second');\nend.", "problem_context": "Score : 900 points\n\nProblem Statement\n\nThere is a tree with N vertices numbered 1 through N.\nThe i-th of the N-1 edges connects vertices a_i and b_i.\n\nInitially, each vertex is uncolored.\n\nTakahashi and Aoki is playing a game by painting the vertices. In this game, they alternately perform the following operation, starting from Takahashi:\n\nSelect a vertex that is not painted yet.\n\nIf it is Takahashi who is performing this operation, paint the vertex white; paint it black if it is Aoki.\n\nThen, after all the vertices are colored, the following procedure takes place:\n\nRepaint every white vertex that is adjacent to a black vertex, in black.\n\nNote that all such white vertices are repainted simultaneously, not one at a time.\n\nIf there are still one or more white vertices remaining, Takahashi wins; if all the vertices are now black, Aoki wins.\nDetermine the winner of the game, assuming that both persons play optimally.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i,b_i ≤ N\n\na_i ≠ b_i\n\nThe input graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\n:\na_{N-1} b_{N-1}\n\nOutput\n\nPrint First if Takahashi wins; print Second if Aoki wins.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\nFirst\n\nBelow is a possible progress of the game:\n\nFirst, Takahashi paint vertex 2 white.\n\nThen, Aoki paint vertex 1 black.\n\nLastly, Takahashi paint vertex 3 white.\n\nIn this case, the colors of vertices 1, 2 and 3 after the final procedure are black, black and white, resulting in Takahashi's victory.\n\nSample Input 2\n\n4\n1 2\n2 3\n2 4\n\nSample Output 2\n\nFirst\n\nSample Input 3\n\n6\n1 2\n2 3\n3 4\n2 5\n5 6\n\nSample Output 3\n\nSecond", "sample_input": "3\n1 2\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03726", "source_text": "Score : 900 points\n\nProblem Statement\n\nThere is a tree with N vertices numbered 1 through N.\nThe i-th of the N-1 edges connects vertices a_i and b_i.\n\nInitially, each vertex is uncolored.\n\nTakahashi and Aoki is playing a game by painting the vertices. In this game, they alternately perform the following operation, starting from Takahashi:\n\nSelect a vertex that is not painted yet.\n\nIf it is Takahashi who is performing this operation, paint the vertex white; paint it black if it is Aoki.\n\nThen, after all the vertices are colored, the following procedure takes place:\n\nRepaint every white vertex that is adjacent to a black vertex, in black.\n\nNote that all such white vertices are repainted simultaneously, not one at a time.\n\nIf there are still one or more white vertices remaining, Takahashi wins; if all the vertices are now black, Aoki wins.\nDetermine the winner of the game, assuming that both persons play optimally.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i,b_i ≤ N\n\na_i ≠ b_i\n\nThe input graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\n:\na_{N-1} b_{N-1}\n\nOutput\n\nPrint First if Takahashi wins; print Second if Aoki wins.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\nFirst\n\nBelow is a possible progress of the game:\n\nFirst, Takahashi paint vertex 2 white.\n\nThen, Aoki paint vertex 1 black.\n\nLastly, Takahashi paint vertex 3 white.\n\nIn this case, the colors of vertices 1, 2 and 3 after the final procedure are black, black and white, resulting in Takahashi's victory.\n\nSample Input 2\n\n4\n1 2\n2 3\n2 4\n\nSample Output 2\n\nFirst\n\nSample Input 3\n\n6\n1 2\n2 3\n3 4\n2 5\n5 6\n\nSample Output 3\n\nSecond", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 346, "cpu_time_ms": 23, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s803805681", "group_id": "codeNet:p03739", "input_text": "program ec12;\nvar \n ans:int64;\n\ta,s:array[0..100000] of int64;\n\tn,m,i,j:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\ts[0]:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\ts[i]:=s[i-1]+a[i];\n\t\tif i>1 then \n\t\tbegin \n\t\t\tif s[i-1]<0 then \n\t\t\tbegin\t\n\t\t\t\tif s[i]<=0 then \n\t\t\t\tbegin\n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tinc(ans,(-s[i])+1);\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif s[i]>=0 then \n\t\t\t\tbegin \n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans,s[i]+1);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "language": "Pascal", "metadata": {"date": 1509856129, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03739.html", "problem_id": "p03739", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03739/input.txt", "sample_output_relpath": "derived/input_output/data/p03739/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03739/Pascal/s803805681.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s803805681", "user_id": "u662099472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ec12;\nvar \n ans:int64;\n\ta,s:array[0..100000] of int64;\n\tn,m,i,j:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\ts[0]:=0;\n\tfor i:=1 to n do \n\tbegin \n\t\tread(a[i]);\n\t\ts[i]:=s[i-1]+a[i];\n\t\tif i>1 then \n\t\tbegin \n\t\t\tif s[i-1]<0 then \n\t\t\tbegin\t\n\t\t\t\tif s[i]<=0 then \n\t\t\t\tbegin\n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tinc(ans,(-s[i])+1);\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif s[i]>=0 then \n\t\t\t\tbegin \n\t\t\t\t\tif s[i]=0 then \n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\tbegin \n\t\t\t\t\t\tinc(ans,s[i]+1);\n\t\t\t\t\t\ts[i]:=-1;\n\t\t\t\t\tend;\n\t\t\t\tend;\n\t\t\tend;\n\t\tend;\n\tend;\n\twriteln(ans);\nend. ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "sample_input": "4\n1 -3 1 0\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03739", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 644, "cpu_time_ms": 17, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s169003330", "group_id": "codeNet:p03739", "input_text": "program ec12;\nvar \n\tans,sum1,sum2,ans1:int64;\n\ta:array[0..100000] of int64;\n\tn,m,i,j:longint;\nbegin \t\n\treadln(n);\n\tans:=0;\n\tans1:=0;\n\tfor i:=1 to n do\n\tread(a[i]);\n\tif a[1]>0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans0 then \n\tbegin \n\t\tsum1:=a[1];\n\t\tans1:=a[1]+1;\n\t\tsum2:=-1;\n\tend\n\telse\n\tbegin\n\t\tif a[1]=0 then \n\t\tbegin \n\t\t\tsum1:=1;\n\t\t\tsum2:=-1;\n\t\t\tans:=1;\n\t\t\tans1:=1;\n\t\tend\n\t\telse\n\t\tbegin\n\t\t\tans:=abs(a[1])+1;\n\t\t\tsum1:=1;\n\t\t\tsum2:=a[1];\n\t\tend;\n\tend;\n\tfor i:=2 to n do \n\tbegin \n\t\tif sum1>0 then \n\t\tbegin \n\t\t\tif sum1+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans,sum1+a[i]+1);\n\t\t\t\tsum1:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum1+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans,abs(sum1+a[i])+1);\n\t\t\t\tsum1:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum1:=sum1+a[i];\n\t\tend;\n\t\tif sum2>0 then \n\t\tbegin \n\t\t\tif sum2+a[i]>=0 then \n\t\t\tbegin \t\n\t\t\t\tinc(ans1,sum2+a[i]+1);\n\t\t\t\tsum2:=-1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend\n\t\telse\n\t\tbegin \t\n\t\t\tif sum2+a[i]<=0 then \n\t\t\tbegin \n\t\t\t\tinc(ans1,abs(sum2+a[i])+1);\n\t\t\t\tsum2:=1;\n\t\t\tend\n\t\t\telse\n\t\t\tsum2:=sum2+a[i];\n\t\tend;\n\tend;\n\tif sum1=0 then \n\tinc(ans);\n\tif sum2=0 then \n\tinc(ans1);\n\tif ans=0)then begin\n\t\t\tinc(now,sum+1);\n\t\t\tsum:=-1;\n\t\tend;\n\tend;\n\tans:=now;\n\tnow:=0;\n\tsum:=0;\n\tfor i:=1 to N do begin\n\t\tinc(sum,A[i]);\n\t\tif(i mod 2=0)and(sum<=0)then begin\n\t\t\tinc(now,1-sum);\n\t\t\tsum:=1;\n\t\tend else if(i mod 2=1)and(sum>=0)then begin\n\t\t\tinc(now,sum+1);\n\t\t\tsum:=-1;\n\t\tend;\n\tend;\n\tif ans>now then ans:=now;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1582183223, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03741.html", "problem_id": "p03741", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03741/input.txt", "sample_output_relpath": "derived/input_output/data/p03741/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03741/Pascal/s767575663.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s767575663", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n\tN,i:Longint;\n\tA:Array[1..100000]of Longint;\n\tans,now,sum:int64;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tnow:=0;\n\tsum:=0;\n\tfor i:=1 to N do begin\n\t\tinc(sum,A[i]);\n\t\tif(i mod 2=1)and(sum<=0)then begin\n\t\t\tinc(now,1-sum);\n\t\t\tsum:=1;\n\t\tend else if(i mod 2=0)and(sum>=0)then begin\n\t\t\tinc(now,sum+1);\n\t\t\tsum:=-1;\n\t\tend;\n\tend;\n\tans:=now;\n\tnow:=0;\n\tsum:=0;\n\tfor i:=1 to N do begin\n\t\tinc(sum,A[i]);\n\t\tif(i mod 2=0)and(sum<=0)then begin\n\t\t\tinc(now,1-sum);\n\t\t\tsum:=1;\n\t\tend else if(i mod 2=1)and(sum>=0)then begin\n\t\t\tinc(now,sum+1);\n\t\t\tsum:=-1;\n\t\tend;\n\tend;\n\tif ans>now then ans:=now;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "sample_input": "4\n1 -3 1 0\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03741", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 605, "cpu_time_ms": 21, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s599153315", "group_id": "codeNet:p03741", "input_text": "uses math ;\nvar a:array[1..100000] of int64 ;\n i,n:longint ;\n\t\t\tans1,ans2,sum1,sum2:int64 ;\nbegin \n readln(n) ;\n\t for i:=1 to n do read(a[i]) ;\n\t if a[1]>0 then \n\t begin \n\t sum1:=a[1];\n\t\t ans2:=a[1]+1 ;\n\t\t sum2:=-1 ;\n\t end\n\t else if (a[1]=0) then \n\t begin \n\t sum1:=1;\n\t\t ans1:=1;ans2:=1 ;\n\t\t sum2:=-1 ;\n\t end\n\t else \n\t begin \n\t sum1:=1;\n\t\t ans1:=abs(a[1])+1 ;\n\t\t sum2:=a[1] ;\n\t end;\n\t for i:=2 to n do \n\t begin \n\t if sum1>0 then\n\t\t begin \n\t\t if a[i]+sum1>=0 then \n\t\t\t begin \n\t\t\t ans1:=ans1+a[i]+sum1+1 ;\n\t\t\t\t sum1:=-1 ;\n\t\t\t end\n\t\t\t else sum1:=sum1+a[i] ;\n\t\t end\n\t\t else \n\t\t begin \n\t\t if a[i]+sum1<=0 then \n\t\t\t begin \n\t\t\t ans1:=ans1+abs(sum1+a[i])+1 ;\n\t\t\t\t sum1:=1 ;\n\t\t\t end\n\t\t\t else sum1:=sum1+a[i] ;\n\t\t end;\n\t end;\n\t if sum1=0 then inc(ans1) ;\n\t for i:=2 to n do //这段跟上段一模一样\n\t begin \n\t if sum2>0 then\n\t\t begin \n\t\t if a[i]+sum2>=0 then \n\t\t\t begin \n\t\t\t ans2:=ans2+a[i]+sum2+1 ;\n\t\t\t\t sum2:=-1 ;\n\t\t\t end\n\t\t\t else sum2:=sum2+a[i] ;\n\t\t end\n\t\t else \n\t\t begin \n\t\t if a[i]+sum2<=0 then \n\t\t\t begin \n\t\t\t ans2:=ans2+abs(sum2+a[i])+1 ;\n\t\t\t\t sum2:=1 ;\n\t\t\t end\n\t\t\t else sum2:=sum2+a[i] ;\n\t\t end;\n\t end;\n\t if sum2=0 then inc(ans2) ;\n\t writeln(min(ans1,ans2)) ;\nend.", "language": "Pascal", "metadata": {"date": 1504407726, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03741.html", "problem_id": "p03741", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03741/input.txt", "sample_output_relpath": "derived/input_output/data/p03741/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03741/Pascal/s599153315.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s599153315", "user_id": "u049262741"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "uses math ;\nvar a:array[1..100000] of int64 ;\n i,n:longint ;\n\t\t\tans1,ans2,sum1,sum2:int64 ;\nbegin \n readln(n) ;\n\t for i:=1 to n do read(a[i]) ;\n\t if a[1]>0 then \n\t begin \n\t sum1:=a[1];\n\t\t ans2:=a[1]+1 ;\n\t\t sum2:=-1 ;\n\t end\n\t else if (a[1]=0) then \n\t begin \n\t sum1:=1;\n\t\t ans1:=1;ans2:=1 ;\n\t\t sum2:=-1 ;\n\t end\n\t else \n\t begin \n\t sum1:=1;\n\t\t ans1:=abs(a[1])+1 ;\n\t\t sum2:=a[1] ;\n\t end;\n\t for i:=2 to n do \n\t begin \n\t if sum1>0 then\n\t\t begin \n\t\t if a[i]+sum1>=0 then \n\t\t\t begin \n\t\t\t ans1:=ans1+a[i]+sum1+1 ;\n\t\t\t\t sum1:=-1 ;\n\t\t\t end\n\t\t\t else sum1:=sum1+a[i] ;\n\t\t end\n\t\t else \n\t\t begin \n\t\t if a[i]+sum1<=0 then \n\t\t\t begin \n\t\t\t ans1:=ans1+abs(sum1+a[i])+1 ;\n\t\t\t\t sum1:=1 ;\n\t\t\t end\n\t\t\t else sum1:=sum1+a[i] ;\n\t\t end;\n\t end;\n\t if sum1=0 then inc(ans1) ;\n\t for i:=2 to n do //这段跟上段一模一样\n\t begin \n\t if sum2>0 then\n\t\t begin \n\t\t if a[i]+sum2>=0 then \n\t\t\t begin \n\t\t\t ans2:=ans2+a[i]+sum2+1 ;\n\t\t\t\t sum2:=-1 ;\n\t\t\t end\n\t\t\t else sum2:=sum2+a[i] ;\n\t\t end\n\t\t else \n\t\t begin \n\t\t if a[i]+sum2<=0 then \n\t\t\t begin \n\t\t\t ans2:=ans2+abs(sum2+a[i])+1 ;\n\t\t\t\t sum2:=1 ;\n\t\t\t end\n\t\t\t else sum2:=sum2+a[i] ;\n\t\t end;\n\t end;\n\t if sum2=0 then inc(ans2) ;\n\t writeln(min(ans1,ans2)) ;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "sample_input": "4\n1 -3 1 0\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03741", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint the minimum necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1201, "cpu_time_ms": 19, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s043870574", "group_id": "codeNet:p03745", "input_text": "var n,i,t,x,y,ans:longint;\nbegin\n read(n,x);\n for i:=2 to n do\n begin\n read(y);\n case t of\n 0:if x>y then t:=1 else\n if xy then\n begin\n t:=0;\n inc(ans);\n end;\n end;\n x:=y;\n end;\n writeln(ans+1);\nend.", "language": "Pascal", "metadata": {"date": 1580606270, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03745.html", "problem_id": "p03745", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03745/input.txt", "sample_output_relpath": "derived/input_output/data/p03745/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03745/Pascal/s043870574.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s043870574", "user_id": "u743614777"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,i,t,x,y,ans:longint;\nbegin\n read(n,x);\n for i:=2 to n do\n begin\n read(y);\n case t of\n 0:if x>y then t:=1 else\n if xy then\n begin\n t:=0;\n inc(ans);\n end;\n end;\n x:=y;\n end;\n writeln(ans+1);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "sample_input": "6\n1 2 3 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03745", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 370, "cpu_time_ms": 19, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s901377905", "group_id": "codeNet:p03745", "input_text": "var\n\tN,i,ans,now:Longint;\n\tA:Array[1..100001]of Longint;\nfunction f(i,j:Longint):Longint;\nbegin\n\tif A[i]A[j] then f:=-1 else f:=0;\nend;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tans:=1;\n\ti:=3;\n\tnow:=f(1,2);\n\twhile i<=N do begin\n\t\tif(f(i-1,i)<>0)and(now<>f(i-1,i))then begin\n\t\t\tif now<>0 then begin\n\t\t\t\tinc(ans);\n\t\t\t\tinc(i);\n\t\t\tend;\n\t\t\tnow:=f(i-1,i);\n\t\tend;\n\t\tinc(i);\n\tend;\n\twriteln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1579653659, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03745.html", "problem_id": "p03745", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03745/input.txt", "sample_output_relpath": "derived/input_output/data/p03745/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03745/Pascal/s901377905.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s901377905", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tN,i,ans,now:Longint;\n\tA:Array[1..100001]of Longint;\nfunction f(i,j:Longint):Longint;\nbegin\n\tif A[i]A[j] then f:=-1 else f:=0;\nend;\nbegin\n\tread(N);\n\tfor i:=1 to N do read(A[i]);\n\tans:=1;\n\ti:=3;\n\tnow:=f(1,2);\n\twhile i<=N do begin\n\t\tif(f(i-1,i)<>0)and(now<>f(i-1,i))then begin\n\t\t\tif now<>0 then begin\n\t\t\t\tinc(ans);\n\t\t\t\tinc(i);\n\t\t\tend;\n\t\t\tnow:=f(i-1,i);\n\t\tend;\n\t\tinc(i);\n\tend;\n\twriteln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "sample_input": "6\n1 2 3 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03745", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible number of subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 16, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s789747819", "group_id": "codeNet:p03760", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n h,w,i,j,count,x,y,sw,m,n,a,b,c:Integer;\n //a,b:array of string;\n o,e,pa:string;\n tf:Boolean;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(o);\n Readln(e);\n\n pa:='';\n for i := 1 to (length(o)+length(e)-abs(length(o)-length(e))) div 2 do begin\n pa:=pa+o[i];\n pa:=pa+e[i];\n end;\n\n if length(o)>length(e) then\n pa:=pa+o[length(o)]\n else if length(o)length(e) then\n pa:=pa+o[length(o)]\n else if length(o)2 then begin\n\t\tmid:=(L+R)div 2;\n\t\tif SortCmp(A[mid],A[L])then begin\n\t\t\ttmp:=A[mid];\n\t\t\tA[mid]:=A[L];\n\t\t\tA[L]:=tmp;\n\t\tend;\n\t\tif SortCmp(A[R-1],A[mid])then begin\n\t\t\ttmp:=A[R-1];\n\t\t\tA[R-1]:=A[mid];\n\t\t\tA[mid]:=tmp;\n\t\t\tif SortCmp(A[mid],A[L])then begin\n\t\t\t\ttmp:=A[mid];\n\t\t\t\tA[mid]:=A[L];\n\t\t\t\tA[L]:=tmp;\n\t\t\tend;\n\t\tend;\n\t\til:=L;\n\t\tir:=R-1;\n\t\twhile il<=ir do begin\n\t\t\twhile SortCmp(A[il],A[mid])do inc(il);\n\t\t\twhile SortCmp(A[mid],A[ir])do dec(ir);\n\t\t\tif il2 then begin\n\t\tmid:=(L+R)div 2;\n\t\tif SortCmp(A[mid],A[L])then begin\n\t\t\ttmp:=A[mid];\n\t\t\tA[mid]:=A[L];\n\t\t\tA[L]:=tmp;\n\t\tend;\n\t\tif SortCmp(A[R-1],A[mid])then begin\n\t\t\ttmp:=A[R-1];\n\t\t\tA[R-1]:=A[mid];\n\t\t\tA[mid]:=tmp;\n\t\t\tif SortCmp(A[mid],A[L])then begin\n\t\t\t\ttmp:=A[mid];\n\t\t\t\tA[mid]:=A[L];\n\t\t\t\tA[L]:=tmp;\n\t\t\tend;\n\t\tend;\n\t\til:=L;\n\t\tir:=R-1;\n\t\twhile il<=ir do begin\n\t\t\twhile SortCmp(A[il],A[mid])do inc(il);\n\t\t\twhile SortCmp(A[mid],A[ir])do dec(ir);\n\t\t\tif ilo then exit;\n i:=first[p]; fw[p]:=o; b[p]:=true;\n if color[p]=0 then color[p]:=cl;\n while (i>=1) do begin\n if b[ed[i]]=false then\n dfs(ed[i],o-1,cl);\n i:=next[i];\n end;\n b[p]:=false;\nend;\nbegin\n readln(n,m);\n for i:=1 to m do first[i]:=-1;\n for i:=1 to m do begin readln(x,y); ad(x,y);ad(y,x); end;\n readln(q);\n for i:=1 to q do readln(v[i],d[i],c[i]);\n for i:=q downto 1 do begin dfs(v[i],d[i],c[i]); end;\n for i:=1 to n do writeln(color[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499714759, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s815089899.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s815089899", "user_id": "u069768083"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "var i,j,k,l,m,n,q,w,x,y,t:longint;\n st,ed,first,next,d,v,color,fw,c:array[1..200000] of longint;\n b:array[1..200000]of boolean;\nprocedure ad(p,o:longint);\nbegin\n t:=t+1; ed[t]:=o; next[t]:=first[p];first[p]:=t;\nend;\nprocedure dfs(p,o,cl:longint);\nvar i,j:longint;\nbegin\n if fw[p]>o then exit;\n i:=first[p]; fw[p]:=o; b[p]:=true;\n if color[p]=0 then color[p]:=cl;\n while (i>=1) do begin\n if b[ed[i]]=false then\n dfs(ed[i],o-1,cl);\n i:=next[i];\n end;\n b[p]:=false;\nend;\nbegin\n readln(n,m);\n for i:=1 to m do first[i]:=-1;\n for i:=1 to m do begin readln(x,y); ad(x,y);ad(y,x); end;\n readln(q);\n for i:=1 to q do readln(v[i],d[i],c[i]);\n for i:=q downto 1 do begin dfs(v[i],d[i],c[i]); end;\n for i:=1 to n do writeln(color[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 805, "cpu_time_ms": 2103, "memory_kb": 6144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s540200018", "group_id": "codeNet:p03768", "input_text": "var\n n,m,x,y,i,q,total:longint;\n b,p,d,v,tot,que,first,next,ans,c:array[0..200010]of longint;\n\nprocedure add(x,y:longint);\nbegin\n inc(total);\n next[total]:=first[x];\n first[x]:=total;\n b[total]:=y;\nend;\n\nprocedure bfs(k:longint);\nvar\n head,tail:longint;\n s:longint;\nbegin\n head:=1;\n tail:=1;\n que[1]:=k;\n while head<=tail do begin\n s:=first[que[head]];\n if ans[que[head]]=0 then ans[que[head]]:=c[i];\n if tot[head]>p[que[head]] then p[que[head]]:=tot[head];\n if tot[head]>0 then begin\n while s<>-1 do begin\n inc(tail);\n tot[tail]:=tot[head]-1;\n que[tail]:=b[s];\n s:=next[s];\n end;\n end;\n inc(head);\n end;\nend;\n\nbegin\n read(n,m);\n for i:=1 to n do first[i]:=-1;\n for i:=1 to m do begin\n read(x,y);\n add(x,y);\n add(y,x);\n end;\n read(q);\n for i:=1 to q do read(v[i],d[i],c[i]);\n for i:=q downto 1 do begin\n if p[v[i]]>d[i] then continue;\n if (ans[v[i]]<>0)and(d[i]=0) then continue;\n tot[1]:=d[i];\n bfs(v[i]);\n end;\n for i:=1 to n do writeln(ans[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499705158, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s540200018.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s540200018", "user_id": "u468632936"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "var\n n,m,x,y,i,q,total:longint;\n b,p,d,v,tot,que,first,next,ans,c:array[0..200010]of longint;\n\nprocedure add(x,y:longint);\nbegin\n inc(total);\n next[total]:=first[x];\n first[x]:=total;\n b[total]:=y;\nend;\n\nprocedure bfs(k:longint);\nvar\n head,tail:longint;\n s:longint;\nbegin\n head:=1;\n tail:=1;\n que[1]:=k;\n while head<=tail do begin\n s:=first[que[head]];\n if ans[que[head]]=0 then ans[que[head]]:=c[i];\n if tot[head]>p[que[head]] then p[que[head]]:=tot[head];\n if tot[head]>0 then begin\n while s<>-1 do begin\n inc(tail);\n tot[tail]:=tot[head]-1;\n que[tail]:=b[s];\n s:=next[s];\n end;\n end;\n inc(head);\n end;\nend;\n\nbegin\n read(n,m);\n for i:=1 to n do first[i]:=-1;\n for i:=1 to m do begin\n read(x,y);\n add(x,y);\n add(y,x);\n end;\n read(q);\n for i:=1 to q do read(v[i],d[i],c[i]);\n for i:=q downto 1 do begin\n if p[v[i]]>d[i] then continue;\n if (ans[v[i]]<>0)and(d[i]=0) then continue;\n tot[1]:=d[i];\n bfs(v[i]);\n end;\n for i:=1 to n do writeln(ans[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1183, "cpu_time_ms": 312, "memory_kb": 7552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s605686373", "group_id": "codeNet:p03768", "input_text": "type arr=array[0..200001]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,max,cl,head,next,start,endd:arr;\n bb,bc:array[0..200001]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then begin\n bb[k]:=false;\n exit;\n end;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499704202, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s605686373.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s605686373", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arr=array[0..200001]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,max,cl,head,next,start,endd:arr;\n bb,bc:array[0..200001]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then begin\n bb[k]:=false;\n exit;\n end;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1548, "cpu_time_ms": 101, "memory_kb": 6528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s546200427", "group_id": "codeNet:p03768", "input_text": "type arr=array[1..200000]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,max,cl,head,next,start,endd:arr;\n bb,bc:array[1..100000]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then begin\n bb[k]:=false;\n exit;\n end;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499704086, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s546200427.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s546200427", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arr=array[1..200000]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,max,cl,head,next,start,endd:arr;\n bb,bc:array[1..100000]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then begin\n bb[k]:=false;\n exit;\n end;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1548, "cpu_time_ms": 101, "memory_kb": 6272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s844729219", "group_id": "codeNet:p03768", "input_text": "type arr=array[1..200000]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl,head,next,start,endd:arr;\n bb,bc:array[1..100000]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499703099, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s844729219.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s844729219", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arr=array[1..200000]of longint;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl,head,next,start,endd:arr;\n bb,bc:array[1..100000]of boolean;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=start[k] to endd[k] do\n if not bb[next[i]]then dfs(next[i],dis-1,col);\n bb[k]:=false;\nend;\nprocedure sort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=head[(l+r) div 2];\n repeat\n while head[i]j) then begin\n y:=head[i];head[i]:=head[j];head[j]:=y;\n y:=next[i];next[i]:=next[j];next[j]:=y;\n inc(i);j:=j-1;\n end;\n until i>j;\n if lhead[i-1]then begin\n endd[head[i-1]]:=i-1;\n start[head[i]]:=i;\n end;\n endd[head[m]]:=m;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1528, "cpu_time_ms": 87, "memory_kb": 6912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s615634355", "group_id": "codeNet:p03768", "input_text": "type arrb=array[1..100000]of boolean;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl:array[1..100000]of longint;\n lian:array[1..100000,1..5000]of longint;\n bb,bc:arrb;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=1 to l[k] do\n if not bb[lian[k,i]]then dfs(lian[k,i],dis-1,col);\n bb[k]:=false;\nend;\nbegin\n readln(n,m);\n fillchar(l,sizeof(l),0);\n fillchar(cl,sizeof(cl),0);\n fillchar(max,sizeof(max),0);\n fillchar(bb,sizeof(bb),false);\n fillchar(bc,sizeof(bc),false);\n for i:=1 to m do begin\n readln(a,b);\n inc(l[a]);lian[a,l[a]]:=b;\n inc(l[b]);lian[b,l[b]]:=a;\n end;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "language": "Pascal", "metadata": {"date": 1499701687, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03768.html", "problem_id": "p03768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03768/input.txt", "sample_output_relpath": "derived/input_output/data/p03768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03768/Pascal/s615634355.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s615634355", "user_id": "u541853053"}, "prompt_components": {"gold_output": "2\n2\n2\n2\n2\n1\n0\n", "input_to_evaluate": "type arrb=array[1..100000]of boolean;\nvar n,q,m,i,j,a,b:longint;\n v,d,c,l,max,cl:array[1..100000]of longint;\n lian:array[1..100000,1..5000]of longint;\n bb,bc:arrb;\nprocedure dfs(k,dis,col:longint);\nvar i:longint;\nbegin\n bb[k]:=true;\n if(max[k]>=dis)and(bc[k])then exit;\n max[k]:=dis;\n if not bc[k]then begin\n cl[k]:=col;\n bc[k]:=true;\n end;\n if dis>0 then for i:=1 to l[k] do\n if not bb[lian[k,i]]then dfs(lian[k,i],dis-1,col);\n bb[k]:=false;\nend;\nbegin\n readln(n,m);\n fillchar(l,sizeof(l),0);\n fillchar(cl,sizeof(cl),0);\n fillchar(max,sizeof(max),0);\n fillchar(bb,sizeof(bb),false);\n fillchar(bc,sizeof(bc),false);\n for i:=1 to m do begin\n readln(a,b);\n inc(l[a]);lian[a,l[a]]:=b;\n inc(l[b]);lian[b,l[b]]:=a;\n end;\n readln(q);\n for i:=q downto 1 do readln(v[i],d[i],c[i]);\n for i:=1 to q do dfs(v[i],d[i],c[i]);\n for i:=1 to n do writeln(cl[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "sample_input": "7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n"}, "reference_outputs": ["2\n2\n2\n2\n2\n1\n0\n"], "source_document_id": "p03768", "source_text": "Score : 700 points\n\nProblem Statement\n\nSquid loves painting vertices in graphs.\n\nThere is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges.\nInitially, all the vertices are painted in color 0. The i-th edge bidirectionally connects two vertices a_i and b_i. The length of every edge is 1.\n\nSquid performed Q operations on this graph. In the i-th operation, he repaints all the vertices within a distance of d_i from vertex v_i, in color c_i.\n\nFind the color of each vertex after the Q operations.\n\nConstraints\n\n1 ≤ N,M,Q ≤ 10^5\n\n1 ≤ a_i,b_i,v_i ≤ N\n\na_i ≠ b_i\n\n0 ≤ d_i ≤ 10\n\n1 ≤ c_i ≤10^5\n\nd_i and c_i are all integers.\n\nThere are no self-loops or multiple edges in the given graph.\n\nPartial Score\n\n200 points will be awarded for passing the testset satisfying 1 ≤ N,M,Q ≤ 2{,}000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\n:\na_{M} b_{M}\nQ\nv_1 d_1 c_1\n:\nv_{Q} d_{Q} c_{Q}\n\nOutput\n\nPrint the answer in N lines.\nIn the i-th line, print the color of vertex i after the Q operations.\n\nSample Input 1\n\n7 7\n1 2\n1 3\n1 4\n4 5\n5 6\n5 7\n2 3\n2\n6 1 1\n1 2 2\n\nSample Output 1\n\n2\n2\n2\n2\n2\n1\n0\n\nInitially, each vertex is painted in color 0.\nIn the first operation, vertices 5 and 6 are repainted in color 1.\nIn the second operation, vertices 1, 2, 3, 4 and 5 are repainted in color 2.\n\nSample Input 2\n\n14 10\n1 4\n5 7\n7 11\n4 10\n14 7\n14 3\n6 14\n8 11\n5 13\n8 3\n8\n8 6 2\n9 7 85\n6 9 3\n6 7 5\n10 3 1\n12 9 4\n9 6 6\n8 2 3\n\nSample Output 2\n\n1\n0\n3\n1\n5\n5\n3\n3\n6\n1\n3\n4\n5\n3\n\nThe given graph may not be connected.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 955, "cpu_time_ms": 531, "memory_kb": 1954688}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s932904784", "group_id": "codeNet:p03774", "input_text": "var\ni,j,k,m,n,x:longint;\na,b,c,d:array[1..1000]of longint;\nbegin\n readln(m,n);\n for i:=1 to m do\n readln(a[i],b[i]);\n for j:=1 to n do\n readln(c[j],d[j]);\n for i:=1 to m do\n begin\n k:=maxlongint;\n for j:=1 to n do\n if abs(a[i]-c[j])+abs(b[i]-d[j])0 do\n begin\n s:=s+1;\n i:=i div 10;\n end;\n write(s);\nend.", "language": "Pascal", "metadata": {"date": 1553212727, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s357232182.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s357232182", "user_id": "u263933075"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,i,s:longint;\n st:string;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then break;\n s:=0;\n while i>0 do\n begin\n s:=s+1;\n i:=i div 10;\n end;\n write(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 204, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s513017362", "group_id": "codeNet:p03775", "input_text": "var\n n,i,s:int64;\n st:string;\nbegin\n readln(n);\n i:=trunc(sqrt(n));\n while (i>0) and (s=0) do\n begin\n if n mod i=0 then break;\n i:=i-1;\n end;\n if i=0 then i:=1;\n s:=0;\n while i>0 do\n begin\n s:=s+1;\n i:=i div 10;\n end;\n write(s);\nend.", "language": "Pascal", "metadata": {"date": 1553212595, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s513017362.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s513017362", "user_id": "u476418095"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,i,s:int64;\n st:string;\nbegin\n readln(n);\n i:=trunc(sqrt(n));\n while (i>0) and (s=0) do\n begin\n if n mod i=0 then break;\n i:=i-1;\n end;\n if i=0 then i:=1;\n s:=0;\n while i>0 do\n begin\n s:=s+1;\n i:=i div 10;\n end;\n write(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s772135119", "group_id": "codeNet:p03775", "input_text": "var\n n,i:longint;\n st:string;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then begin str(i,st);writeln(length(st));halt; end;\nend.", "language": "Pascal", "metadata": {"date": 1553212379, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s772135119.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s772135119", "user_id": "u476418095"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,i:longint;\n st:string;\nbegin\n readln(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then begin str(i,st);writeln(length(st));halt; end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s982602446", "group_id": "codeNet:p03775", "input_text": "var\n n,i,x:int64;\n y:string;\nbegin\n readln(n);\n i:=1;\n while i<=trunc(sqrt(n)) do\n begin\n if n mod i=0 then x:=n div i;\n inc(i);\n end;\n str(x,y);\n writeln(length(y));\nend.", "language": "Pascal", "metadata": {"date": 1538573283, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s982602446.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s982602446", "user_id": "u476418095"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n n,i,x:int64;\n y:string;\nbegin\n readln(n);\n i:=1;\n while i<=trunc(sqrt(n)) do\n begin\n if n mod i=0 then x:=n div i;\n inc(i);\n end;\n str(x,y);\n writeln(length(y));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 177, "cpu_time_ms": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s130275095", "group_id": "codeNet:p03775", "input_text": "var\ni,j,c,d,e:longint;\ns,s1,s2:string;\nn,b:qword;\nbegin\nreadln(n);\nfor i:=trunc(sqrt(n)) downto 1 do\nif n mod i=0 then begin b:=n div i;str(b,s);write(length(s));break;end;\nwriteln;\nend.", "language": "Pascal", "metadata": {"date": 1534258411, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s130275095.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s130275095", "user_id": "u723721005"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\ni,j,c,d,e:longint;\ns,s1,s2:string;\nn,b:qword;\nbegin\nreadln(n);\nfor i:=trunc(sqrt(n)) downto 1 do\nif n mod i=0 then begin b:=n div i;str(b,s);write(length(s));break;end;\nwriteln;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s692490199", "group_id": "codeNet:p03775", "input_text": "var\n s:string;\n n:int64;\n i,j:longint;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n j:=n div i;\n str(j,s);\n writeln(length(s));\n halt;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1532990602, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s692490199.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s692490199", "user_id": "u723721005"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n s:string;\n n:int64;\n i,j:longint;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 1 do\n if n mod i=0 then\n begin\n j:=n div i;\n str(j,s);\n writeln(length(s));\n halt;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s099058398", "group_id": "codeNet:p03775", "input_text": "var\n s1,s2:string;\n n:int64;\n i,j,l1,l2:longint;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 2 do\n if n mod i=0 then\n begin\n j:=n div i;\n str(i,s1);\n l1:=length(s1);\n str(j,s2);\n l2:=length(s2);\n writeln(s1+s2);\n halt;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1532990495, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Pascal/s099058398.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s099058398", "user_id": "u247366051"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n s1,s2:string;\n n:int64;\n i,j,l1,l2:longint;\nbegin\n read(n);\n for i:=trunc(sqrt(n)) downto 2 do\n if n mod i=0 then\n begin\n j:=n div i;\n str(i,s1);\n l1:=length(s1);\n str(j,s2);\n l2:=length(s2);\n writeln(s1+s2);\n halt;\n end;\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s283866445", "group_id": "codeNet:p03775", "input_text": "program dolphin; \n\nvar n,i,d,s: word;\n min,c : byte;\n\n\nbegin \n\nread(n);\ns:=n;\nc:=0;\nwhile s<>0 do begin\n c:=c+1;\n s:=s div 10;\n\n end;\nmin:=c;\nfor i:=2 to n div 2 do begin\n c:=0;\n if n mod i=0 then begin s:=n div i;\n while s<>0 do begin\n c:=c+1;\n s:=s div 10;\n\n end;\n\n if min0 do begin\n c:=c+1;\n s:=s div 10;\n\n end;\nmin:=c;\nfor i:=2 to n div 2 do begin\n c:=0;\n if n mod i=0 then begin s:=n div i;\n while s<>0 do begin\n c:=c+1;\n s:=s div 10;\n\n end;\n\n if min=x) do begin\n inc(count);\n a:=a+count;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1516315095, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03779.html", "problem_id": "p03779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03779/input.txt", "sample_output_relpath": "derived/input_output/data/p03779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03779/Pascal/s183681972.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s183681972", "user_id": "u755925739"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n h,w,i,j,count,x,y,a,b,sw:Integer;\n s:array of string;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(x);\n\n count:=0;\n a:=0;\n while not(a>=x) do begin\n inc(count);\n a:=a+count;\n end;\n\n Writeln(count);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "sample_input": "6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03779", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 448, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s158286916", "group_id": "codeNet:p03781", "input_text": "var\n mt, t, x: int64;\nbegin\n read(x);\n for t := x downto 1 do\n if 2 * x > t * (t - 1) then\n begin\n mt := t;\n break;\n end;\n writeln(mt);\nend.", "language": "Pascal", "metadata": {"date": 1516179330, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03781.html", "problem_id": "p03781", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03781/input.txt", "sample_output_relpath": "derived/input_output/data/p03781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03781/Pascal/s158286916.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s158286916", "user_id": "u598016178"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\n mt, t, x: int64;\nbegin\n read(x);\n for t := x downto 1 do\n if 2 * x > t * (t - 1) then\n begin\n mt := t;\n break;\n end;\n writeln(mt);\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "sample_input": "6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03781", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 153, "cpu_time_ms": 970, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s498167029", "group_id": "codeNet:p03782", "input_text": "var\n\tdp1:array[0..5000]of Boolean;\n\tdp2:array[0..5000,0..5000]of Longint;\n\tsum:array[0..5001]of Longint;\n\tn,k,i,j,id,cnt:Longint;\n\tflag:Boolean;\n\ta:array[1..5000]of Longint;\nbegin\n\tread(n,k);\n\tfor i:=1 to n do read(a[i]);\n\tdp2[n][0]:=1;\n\tfor i:=n downto 1 do begin\n\t\tfor j:=0 to k do dp2[i-1][j]:=dp2[i][j];\n\t\tfor j:=0 to k-a[i] do inc(dp2[i-1][j+a[i]],dp2[i][j]);\n\tend;\n\tdp1[0]:=true;\n\tfor i:=1 to n do begin\n\t\tsum[0]:=0;\n\t\tfor j:=0 to k do sum[j+1]:=sum[j]+dp2[i][j];\n\t\tflag:=false;\n\t\tfor j:=0 to k do if dp1[j]then begin\n\t\t\tid:=k-a[i]-j;\n\t\t\tif id<0 then id:=0;\n\t\t\tif sum[k-j]-sum[id]>0 then begin\n\t\t\t\tflag:=true;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then inc(cnt);\n\t\tfor j:=k downto a[i] do dp1[j]:=dp1[j]or dp1[j-a[i]];\n\tend;\n\twriteln(cnt);\nend.\n", "language": "Pascal", "metadata": {"date": 1539173066, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03782.html", "problem_id": "p03782", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03782/input.txt", "sample_output_relpath": "derived/input_output/data/p03782/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03782/Pascal/s498167029.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s498167029", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n\tdp1:array[0..5000]of Boolean;\n\tdp2:array[0..5000,0..5000]of Longint;\n\tsum:array[0..5001]of Longint;\n\tn,k,i,j,id,cnt:Longint;\n\tflag:Boolean;\n\ta:array[1..5000]of Longint;\nbegin\n\tread(n,k);\n\tfor i:=1 to n do read(a[i]);\n\tdp2[n][0]:=1;\n\tfor i:=n downto 1 do begin\n\t\tfor j:=0 to k do dp2[i-1][j]:=dp2[i][j];\n\t\tfor j:=0 to k-a[i] do inc(dp2[i-1][j+a[i]],dp2[i][j]);\n\tend;\n\tdp1[0]:=true;\n\tfor i:=1 to n do begin\n\t\tsum[0]:=0;\n\t\tfor j:=0 to k do sum[j+1]:=sum[j]+dp2[i][j];\n\t\tflag:=false;\n\t\tfor j:=0 to k do if dp1[j]then begin\n\t\t\tid:=k-a[i]-j;\n\t\t\tif id<0 then id:=0;\n\t\t\tif sum[k-j]-sum[id]>0 then begin\n\t\t\t\tflag:=true;\n\t\t\t\tbreak;\n\t\t\tend;\n\t\tend;\n\t\tif not flag then inc(cnt);\n\t\tfor j:=k downto a[i] do dp1[j]:=dp1[j]or dp1[j-a[i]];\n\tend;\n\twriteln(cnt);\nend.\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "sample_input": "3 6\n1 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03782", "source_text": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 753, "cpu_time_ms": 349, "memory_kb": 97792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s900925083", "group_id": "codeNet:p03785", "input_text": "program j01;\nvar t:array[0..100086]of longint;\n n,x,k,r,l,i,ans,tmp,c:longint;\n\nprocedure qsort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=t[(i+j)div 2];\n repeat\n while t[i]j;\n if ik do\n begin\n inc(ans);tmp:=c;\n while (l<=i-1)and(tmp>0) do\n begin\n inc(l);dec(tmp);\n end;\n end;\n end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1489367627, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03785.html", "problem_id": "p03785", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03785/input.txt", "sample_output_relpath": "derived/input_output/data/p03785/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03785/Pascal/s900925083.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900925083", "user_id": "u550756195"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program j01;\nvar t:array[0..100086]of longint;\n n,x,k,r,l,i,ans,tmp,c:longint;\n\nprocedure qsort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=t[(i+j)div 2];\n repeat\n while t[i]j;\n if ik do\n begin\n inc(ans);tmp:=c;\n while (l<=i-1)and(tmp>0) do\n begin\n inc(l);dec(tmp);\n end;\n end;\n end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nEvery day, N passengers arrive at Takahashi Airport.\nThe i-th passenger arrives at time T_i.\n\nEvery passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers.\nNaturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport.\nAlso, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane.\nFor that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive).\n\nWhen setting the departure times for buses under this condition, find the minimum required number of buses.\nHere, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time.\n\nConstraints\n\n2 \\leq N \\leq 100000\n\n1 \\leq C \\leq 10^9\n\n1 \\leq K \\leq 10^9\n\n1 \\leq T_i \\leq 10^9\n\nC, K and T_i are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN C K\nT_1\nT_2\n:\nT_N\n\nOutput\n\nPrint the minimum required number of buses.\n\nSample Input 1\n\n5 3 5\n1\n2\n3\n6\n12\n\nSample Output 1\n\n3\n\nFor example, the following three buses are enough:\n\nA bus departing at time 4.5, that carries the passengers arriving at time 2 and 3.\n\nA bus departing at time 6, that carries the passengers arriving at time 1 and 6.\n\nA bus departing at time 12, that carries the passenger arriving at time 12.\n\nSample Input 2\n\n6 3 3\n7\n6\n2\n8\n10\n6\n\nSample Output 2\n\n3", "sample_input": "5 3 5\n1\n2\n3\n6\n12\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03785", "source_text": "Score : 300 points\n\nProblem Statement\n\nEvery day, N passengers arrive at Takahashi Airport.\nThe i-th passenger arrives at time T_i.\n\nEvery passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers.\nNaturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport.\nAlso, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane.\nFor that reason, it is necessary to arrange buses so that the i-th passenger can take a bus departing at time between T_i and T_i + K (inclusive).\n\nWhen setting the departure times for buses under this condition, find the minimum required number of buses.\nHere, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time.\n\nConstraints\n\n2 \\leq N \\leq 100000\n\n1 \\leq C \\leq 10^9\n\n1 \\leq K \\leq 10^9\n\n1 \\leq T_i \\leq 10^9\n\nC, K and T_i are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN C K\nT_1\nT_2\n:\nT_N\n\nOutput\n\nPrint the minimum required number of buses.\n\nSample Input 1\n\n5 3 5\n1\n2\n3\n6\n12\n\nSample Output 1\n\n3\n\nFor example, the following three buses are enough:\n\nA bus departing at time 4.5, that carries the passengers arriving at time 2 and 3.\n\nA bus departing at time 6, that carries the passengers arriving at time 1 and 6.\n\nA bus departing at time 12, that carries the passenger arriving at time 12.\n\nSample Input 2\n\n6 3 3\n7\n6\n2\n8\n10\n6\n\nSample Output 2\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 702, "cpu_time_ms": 25, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s241405815", "group_id": "codeNet:p03786", "input_text": "program j01;\nvar a,sum:array[0..100086]of int64;\n n,i:longint;\n\nprocedure qsort(l,r:longint);\nvar i,j,x,y:longint;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while a[i]j;\n if ij;\n if i0) or (m>1) do\n begin\n inc(i);\n if n=0 then m:=m-2\n else dec(n);\n if m>=2 then m:=m-2\n else n:=n-1;\n end;\n if (n<0) or (m<0) then dec(i);\n writeln(i);\nend.", "language": "Pascal", "metadata": {"date": 1538936113, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03797.html", "problem_id": "p03797", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03797/input.txt", "sample_output_relpath": "derived/input_output/data/p03797/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03797/Pascal/s098687481.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s098687481", "user_id": "u247366051"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n n,m,i:longint;\nbegin\n readln(n,m);\n while (n>0) or (m>1) do\n begin\n inc(i);\n if n=0 then m:=m-2\n else dec(n);\n if m>=2 then m:=m-2\n else n:=n-1;\n end;\n if (n<0) or (m<0) then dec(i);\n writeln(i);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke loves puzzles.\n\nToday, he is working on a puzzle using S- and c-shaped pieces.\nIn this puzzle, you can combine two c-shaped pieces into one S-shaped piece, as shown in the figure below:\n\nSnuke decided to create as many Scc groups as possible by putting together one S-shaped piece and two c-shaped pieces.\n\nFind the maximum number of Scc groups that can be created when Snuke has N S-shaped pieces and M c-shaped pieces.\n\nConstraints\n\n1 ≤ N,M ≤ 10^{12}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 6\n\nSample Output 1\n\n2\n\nTwo Scc groups can be created as follows:\n\nCombine two c-shaped pieces into one S-shaped piece\n\nCreate two Scc groups, each from one S-shaped piece and two c-shaped pieces\n\nSample Input 2\n\n12345 678901\n\nSample Output 2\n\n175897", "sample_input": "1 6\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03797", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke loves puzzles.\n\nToday, he is working on a puzzle using S- and c-shaped pieces.\nIn this puzzle, you can combine two c-shaped pieces into one S-shaped piece, as shown in the figure below:\n\nSnuke decided to create as many Scc groups as possible by putting together one S-shaped piece and two c-shaped pieces.\n\nFind the maximum number of Scc groups that can be created when Snuke has N S-shaped pieces and M c-shaped pieces.\n\nConstraints\n\n1 ≤ N,M ≤ 10^{12}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 6\n\nSample Output 1\n\n2\n\nTwo Scc groups can be created as follows:\n\nCombine two c-shaped pieces into one S-shaped piece\n\nCreate two Scc groups, each from one S-shaped piece and two c-shaped pieces\n\nSample Input 2\n\n12345 678901\n\nSample Output 2\n\n175897", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 130, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s329200820", "group_id": "codeNet:p03801", "input_text": "program j01;\ntype xx=record id:longint;w:int64; end;\nvar a:array[0..100086]of xx;\n n,i,last,pre:longint;\n sum:int64;\n ans:array[0..100086]of int64;\n\nfunction cmp(a,b:xx):boolean;\nbegin\n if a.w<>b.w then exit(a.w>b.w) else exit(a.id>b.id);\nend;\n\nprocedure sort(l,r:longint);\nvar i,j:longint;x,y:xx;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while cmp(a[i],x) do inc(i);\n while cmp(x,a[j]) do dec(j);\n if i<=j then\n begin\n y:=a[i];a[i]:=a[j];a[j]:=y;\n inc(i);dec(j);\n end;\n until i>j;\n if ib.w then exit(a.w>b.w) else exit(a.id>b.id);\nend;\n\nprocedure sort(l,r:longint);\nvar i,j:longint;x,y:xx;\nbegin\n i:=l;j:=r;x:=a[(i+j)div 2];\n repeat\n while cmp(a[i],x) do inc(i);\n while cmp(x,a[j]) do dec(j);\n if i<=j then\n begin\n y:=a[i];a[i]:=a[j];a[j]:=y;\n inc(i);dec(j);\n end;\n until i>j;\n if ib[k][l] then f:=0;\n\t\tinc(s,f);\n\tend;\n\tif s>0 then writeln('Yes')else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1535421043, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03804.html", "problem_id": "p03804", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03804/input.txt", "sample_output_relpath": "derived/input_output/data/p03804/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03804/Pascal/s639238533.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s639238533", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tn,m,i,j,k,l,f,s:Longint;\n\ta,b:array[1..50]of String[50];\nbegin\n\treadln(n,m);\n\tfor i:=1 to n do readln(a[i]);\n\tfor j:=1 to m do readln(b[j]);\n\tfor i:=0 to n-m do for j:=0 to n-m do begin\n\t\tf:=1;\n\t\tfor k:=1 to m do for l:=1 to m do\n\t\t\tif a[i+k][j+l]<>b[k][l] then f:=0;\n\t\tinc(s,f);\n\tend;\n\tif s>0 then writeln('Yes')else writeln('No');\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "sample_input": "3 2\n#.#\n.#.\n#.#\n#.\n.#\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03804", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 343, "cpu_time_ms": 4, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s561097627", "group_id": "codeNet:p03805", "input_text": "var\n\tn,m,i,a,b:Longint;\n\tused:array[1..8]of Boolean;\n\tc:array[1..8]of Longint;\n\tG:array[1..8,1..8]of Longint;\nfunction f(u,cnt:Longint):Longint;\nvar i,ret:Longint;\nbegin\n\tif cnt=n then begin\n\t\tf:=1;\n\t\texit;\n\tend;\n\tret:=0;\n\tfor i:=1 to c[u] do begin\n\t\tif not used[G[u,i]]then begin\n\t\t\tused[G[u,i]]:=True;\n\t\t\tinc(ret,f(G[u,i],cnt+1));\n\t\t\tused[G[u,i]]:=False;\n\t\tend;\n\tend;\n\tf:=ret;\nend;\nbegin\n\tread(n,m);\n\tfor i:=1 to m do begin\n\t\tread(a,b);\n\t\tinc(c[a]);\n\t\tinc(c[b]);\n\t\tG[a,c[a]]:=b;\n\t\tG[b,c[b]]:=a;\n\tend;\n\tused[1]:=True;\n\twriteln(f(1,1));\nend.", "language": "Pascal", "metadata": {"date": 1541922075, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03805.html", "problem_id": "p03805", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03805/input.txt", "sample_output_relpath": "derived/input_output/data/p03805/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03805/Pascal/s561097627.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561097627", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var\n\tn,m,i,a,b:Longint;\n\tused:array[1..8]of Boolean;\n\tc:array[1..8]of Longint;\n\tG:array[1..8,1..8]of Longint;\nfunction f(u,cnt:Longint):Longint;\nvar i,ret:Longint;\nbegin\n\tif cnt=n then begin\n\t\tf:=1;\n\t\texit;\n\tend;\n\tret:=0;\n\tfor i:=1 to c[u] do begin\n\t\tif not used[G[u,i]]then begin\n\t\t\tused[G[u,i]]:=True;\n\t\t\tinc(ret,f(G[u,i],cnt+1));\n\t\t\tused[G[u,i]]:=False;\n\t\tend;\n\tend;\n\tf:=ret;\nend;\nbegin\n\tread(n,m);\n\tfor i:=1 to m do begin\n\t\tread(a,b);\n\t\tinc(c[a]);\n\t\tinc(c[b]);\n\t\tG[a,c[a]]:=b;\n\t\tG[b,c[b]]:=a;\n\tend;\n\tused[1]:=True;\n\twriteln(f(1,1));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i0 then begin\n\t\t\tmp:=min(mp+x,100);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,100);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 100 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924315, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s755068667.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s755068667", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..100]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 100 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tmp:=min(mp+x,100);\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tmm:=min(mm-x,100);\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 100 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 568, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s319881509", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924147, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s319881509.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s319881509", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..200]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 568, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s378536550", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..220]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,220);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,220);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924080, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s378536550.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s378536550", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..220]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,220);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,220);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s645866444", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..210]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541924019, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s645866444.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s645866444", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..210]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s775744863", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..201]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541923985, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s775744863.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s775744863", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..201]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 200 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,200);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,200);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 200 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s959680034", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..300]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 300 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,300);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,300);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 300 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "language": "Pascal", "metadata": {"date": 1541923821, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s959680034.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s959680034", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x,mp,mm:Longint;\n\tp,m:array[0..300]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 300 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=mp downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\t\tmp:=min(mp+x,300);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=mm downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\t\tmm:=min(mm-x,300);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 300 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 564, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s123165225", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x:Longint;\n\tp,m:array[0..400]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 400 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=400-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=400+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 400 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.\n", "language": "Pascal", "metadata": {"date": 1541923592, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s123165225.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s123165225", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "uses math;\nvar\n\tans,n,Ma,Mb,i,j,a,b,c,x:Longint;\n\tp,m:array[0..400]of Longint;\nbegin\n\tread(n,Ma,Mb);\n\tans:=10000;\n\tfor i:=1 to 400 do begin\n\t\tp[i]:=ans;\n\t\tm[i]:=ans;\n\tend;\n\tfor i:=1 to n do begin\n\t\tread(a,b,c);\n\t\tx:=Ma*b-Mb*a;\n\t\tif x>0 then begin\n\t\t\tfor j:=400-x downto 0 do p[j+x]:=min(p[j+x],p[j]+c);\n\t\tend else if x<0 then begin\n\t\t\tfor j:=400+x downto 0 do m[j-x]:=min(m[j-x],m[j]+c);\n\t\tend else ans:=min(ans,c);\n\tend;\n\tfor i:=1 to 400 do ans:=min(ans,p[i]+m[i]);\n\tif ans<10000 then writeln(ans)else writeln(-1);\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 521, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s947919713", "group_id": "codeNet:p03806", "input_text": "Var a,b,c:array[0..50] of integer;\n dp:array[0..50, 0..500, 0..500] of integer;\n n,ma,mb,i,ca,cb,ans:integer;\n\nFunction min(a,b:integer):integer;\n Begin\n if a < b then exit(a)\n else exit(b);\n End;\n\nBEGIN\n readln(n,ma,mb);\n for i:=0 to n-1 do\n readln(a[i],b[i],c[i]);\n\n for i:=0 to n do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n dp[i,ca,cb] := maxint; // maxint = 2^15 - 1 = 32767\n\n dp[0,0,0] := 0;\n for i:=0 to n-1 do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n if dp[i,ca,cb] <> maxint then\n Begin\n // khong lay\n dp[i+1, ca, cb] := min(dp[i,ca,cb], dp[i+1, ca, cb]);\n // lay\n dp[i+1, ca+a[i], cb+b[i]] := min(dp[i,ca,cb] + c[i] , dp[i+1, ca+a[i], cb+b[i]]);\n End;\n\n ans := maxint;\n for ca:=1 to 400 do\n for cb:=1 to 400 do\n if ma * cb = mb * ca then ans := min(ans, dp[n,ca,cb]);\n\n if ans = maxint then writeln(-1)\n else writeln(ans);\nEND.\n", "language": "Pascal", "metadata": {"date": 1489017687, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03806.html", "problem_id": "p03806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03806/input.txt", "sample_output_relpath": "derived/input_output/data/p03806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03806/Pascal/s947919713.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s947919713", "user_id": "u889725830"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "Var a,b,c:array[0..50] of integer;\n dp:array[0..50, 0..500, 0..500] of integer;\n n,ma,mb,i,ca,cb,ans:integer;\n\nFunction min(a,b:integer):integer;\n Begin\n if a < b then exit(a)\n else exit(b);\n End;\n\nBEGIN\n readln(n,ma,mb);\n for i:=0 to n-1 do\n readln(a[i],b[i],c[i]);\n\n for i:=0 to n do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n dp[i,ca,cb] := maxint; // maxint = 2^15 - 1 = 32767\n\n dp[0,0,0] := 0;\n for i:=0 to n-1 do\n for ca:=0 to 400 do\n for cb:=0 to 400 do\n if dp[i,ca,cb] <> maxint then\n Begin\n // khong lay\n dp[i+1, ca, cb] := min(dp[i,ca,cb], dp[i+1, ca, cb]);\n // lay\n dp[i+1, ca+a[i], cb+b[i]] := min(dp[i,ca,cb] + c[i] , dp[i+1, ca+a[i], cb+b[i]]);\n End;\n\n ans := maxint;\n for ca:=1 to 400 do\n for cb:=1 to 400 do\n if ma * cb = mb * ca then ans := min(ans, dp[n,ca,cb]);\n\n if ans = maxint then writeln(-1)\n else writeln(ans);\nEND.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "sample_input": "3 1 1\n1 2 1\n2 1 2\n3 3 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03806", "source_text": "Score : 400 points\n\nProblem Statement\n\nDolphin is planning to generate a small amount of a certain chemical substance C.\n\nIn order to generate the substance C, he must prepare a solution which is a mixture of two substances A and B in the ratio of M_a:M_b.\n\nHe does not have any stock of chemicals, however, so he will purchase some chemicals at a local pharmacy.\n\nThe pharmacy sells N kinds of chemicals. For each kind of chemical, there is exactly one package of that chemical in stock.\n\nThe package of chemical i contains a_i grams of the substance A and b_i grams of the substance B, and is sold for c_i yen (the currency of Japan).\n\nDolphin will purchase some of these packages. For some reason, he must use all contents of the purchased packages to generate the substance C.\n\nFind the minimum amount of money required to generate the substance C.\n\nIf it is not possible to generate the substance C by purchasing any combination of packages at the pharmacy, report that fact.\n\nConstraints\n\n1≦N≦40\n\n1≦a_i,b_i≦10\n\n1≦c_i≦100\n\n1≦M_a,M_b≦10\n\ngcd(M_a,M_b)=1\n\na_i, b_i, c_i, M_a and M_b are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M_a M_b\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the minimum amount of money required to generate the substance C. If it is not possible to generate the substance C, print -1 instead.\n\nSample Input 1\n\n3 1 1\n1 2 1\n2 1 2\n3 3 10\n\nSample Output 1\n\n3\n\nThe amount of money spent will be minimized by purchasing the packages of chemicals 1 and 2.\n\nIn this case, the mixture of the purchased chemicals will contain 3 grams of the substance A and 3 grams of the substance B, which are in the desired ratio: 3:3=1:1.\n\nThe total price of these packages is 3 yen.\n\nSample Input 2\n\n1 1 10\n10 10 10\n\nSample Output 2\n\n-1\n\nThe ratio 1:10 of the two substances A and B cannot be satisfied by purchasing any combination of the packages. Thus, the output should be -1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1116, "cpu_time_ms": 45, "memory_kb": 40576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s387758227", "group_id": "codeNet:p03806", "input_text": "uses math;\nvar n,x,y,i,j:longint;\n a,b,c:array[0..107] of longint;\n\tf:array[0..57,-10007..10007] of longint;\nbegin\n readln(n,x,y);\n fillchar(a,sizeof(a),0);\n fillchar(b,sizeof(b),0);\n fillchar(c,sizeof(c),0);\n for i:=1 to n do\n begin\n readln(a[i],b[i],c[i]);\n a[i]:=a[i]*y;\n b[i]:=b[i]*x;\n end;\n for i:=0 to n do\n\tfor j:=-10000 to 10000 do\n\t f[i,j]:=maxlongint div 2;\n f[1,a[1]-b[1]]:=c[1];\n for i:=2 to n do\n\tfor j:=-10000 to 10000 do\n\t f[i,j]:=min(f[i,j],min(f[i-1,j],f[i-1,j-a[i]+b[i]]+c[i]));\n if (f[n,0]1 then B[i-1]:=A[i]-A[i-1];\n\tend;\n\tB[N]:=A[1]-A[N];\n\tall:=(N+1)*N div 2;\n\tif sum mod all<>0 then begin\n\t\twriteln('NO');\n\t\texit;\n\tend;\n\tK:=sum div all;\n\tfor i:=1 to N do begin\n\t\tdec(B[i],K);\n\t\tif(B[i]>0)or(B[i]mod N<>0)then begin\n\t\t\twriteln('NO');\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('YES');\nend.\n", "language": "Pascal", "metadata": {"date": 1579581326, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03808.html", "problem_id": "p03808", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03808/input.txt", "sample_output_relpath": "derived/input_output/data/p03808/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03808/Pascal/s439754764.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s439754764", "user_id": "u657913472"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "var\n\tN,i:Longint;\n\tA,B:Array[1..100000]of int64;\n\tsum,all,k:int64;\nbegin\n\tread(N);\n\tfor i:=1 to N do begin\n\t\tread(A[i]);\n\t\tinc(sum,A[i]);\n\t\tif i>1 then B[i-1]:=A[i]-A[i-1];\n\tend;\n\tB[N]:=A[1]-A[N];\n\tall:=(N+1)*N div 2;\n\tif sum mod all<>0 then begin\n\t\twriteln('NO');\n\t\texit;\n\tend;\n\tK:=sum div all;\n\tfor i:=1 to N do begin\n\t\tdec(B[i],K);\n\t\tif(B[i]>0)or(B[i]mod N<>0)then begin\n\t\t\twriteln('NO');\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('YES');\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N boxes arranged in a circle. The i-th box contains A_i stones.\n\nDetermine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:\n\nSelect one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.\n\nNote that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n1 ≦ A_i ≦ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nIf it is possible to remove all the stones from the boxes, print YES. Otherwise, print NO.\n\nSample Input 1\n\n5\n4 5 1 2 3\n\nSample Output 1\n\nYES\n\nAll the stones can be removed in one operation by selecting the second box.\n\nSample Input 2\n\n5\n6 9 12 10 8\n\nSample Output 2\n\nYES\n\nSample Input 3\n\n4\n1 2 3 1\n\nSample Output 3\n\nNO", "sample_input": "5\n4 5 1 2 3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03808", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N boxes arranged in a circle. The i-th box contains A_i stones.\n\nDetermine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:\n\nSelect one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactly j stones from the (i+j)-th box. Here, the (N+k)-th box is identified with the k-th box.\n\nNote that the operation cannot be performed if there is a box that does not contain enough number of stones to be removed.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n1 ≦ A_i ≦ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nIf it is possible to remove all the stones from the boxes, print YES. Otherwise, print NO.\n\nSample Input 1\n\n5\n4 5 1 2 3\n\nSample Output 1\n\nYES\n\nAll the stones can be removed in one operation by selecting the second box.\n\nSample Input 2\n\n5\n6 9 12 10 8\n\nSample Output 2\n\nYES\n\nSample Input 3\n\n4\n1 2 3 1\n\nSample Output 3\n\nNO", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 436, "cpu_time_ms": 17, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s791643532", "group_id": "codeNet:p03815", "input_text": "var x, a: int64;\n\nbegin\n\treadln(x);\n a := x mod 11;\n if a > 6 then\n \ta := 2\n else if a > 0 then\n \ta := 1;\n writeln(x div 11 * 2 + a);\nend.", "language": "Pascal", "metadata": {"date": 1587395514, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03815.html", "problem_id": "p03815", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03815/input.txt", "sample_output_relpath": "derived/input_output/data/p03815/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03815/Pascal/s791643532.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s791643532", "user_id": "u959888075"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var x, a: int64;\n\nbegin\n\treadln(x);\n a := x mod 11;\n if a > 6 then\n \ta := 2\n else if a > 0 then\n \ta := 1;\n writeln(x div 11 * 2 + a);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03815", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s892560545", "group_id": "codeNet:p03815", "input_text": "var x,y:int64;\nbegin\n readln(x);\n y:=(x div 11)+(x div 11);\n x:=x mod 11;\n if (x>=1) and (x<=6) then inc(y);\n if (x>6) then y:=y+2;\n writeln(y);\nend.", "language": "Pascal", "metadata": {"date": 1485655933, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03815.html", "problem_id": "p03815", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03815/input.txt", "sample_output_relpath": "derived/input_output/data/p03815/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03815/Pascal/s892560545.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s892560545", "user_id": "u331121156"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var x,y:int64;\nbegin\n readln(x);\n y:=(x div 11)+(x div 11);\n x:=x mod 11;\n if (x>=1) and (x<=6) then inc(y);\n if (x>6) then y:=y+2;\n writeln(y);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03815", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 155, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s001866626", "group_id": "codeNet:p03819", "input_text": "program vjudge149349E;\nconst maxn=300000+10;\n maxm=100000+10;\nvar l,r,next:array[0..maxn] of longint;\n last,ans,bits:array[0..maxm] of longint;\n n,m,i,j:longint;\nfunction ask(x:longint):longint;\nvar ans:longint;\nbegin\n ans:=0;\n while x>0 do\n begin\n ans:=ans+bits[x];\n x:=x-x and (-x);\n end;\n exit(ans);\nend;\nprocedure add(x,d:longint);\nbegin\n while(x<=m+1) do\n begin\n bits[x]:=bits[x]+d;\n x:=x+x and (-x);\n end;\nend;\nbegin\n readln(n,m);\n fillchar(last,sizeof(last),0);\n for i:=1 to n do\n begin\n readln(l[i],r[i]);\n next[i]:=last[r[i]-l[i]+1];\n last[r[i]-l[i]+1]:=i;\n inc(ans[1]);\n dec(ans[r[i]-l[i]+2]);\n end;\n for i:=1 to m do ans[i]:=ans[i]+ans[i-1];\n fillchar(bits,sizeof(bits),0);\n for i:=1 to m do\n begin\n ans[i]:=ans[i]+bits[1];\n for j:=1 to m div i do\n ans[i]:=ans[i]+ask(j*i+1);\n j:=last[i];\n while j>0 do\n begin\n add(l[j]+1,1);\n add(r[j]+2,-1);\n j:=next[j];\n end;\n end;\n for i:=1 to m do writeln(ans[i]);\nend.", "language": "Pascal", "metadata": {"date": 1510365021, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03819.html", "problem_id": "p03819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03819/input.txt", "sample_output_relpath": "derived/input_output/data/p03819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03819/Pascal/s001866626.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s001866626", "user_id": "u097736549"}, "prompt_components": {"gold_output": "3\n2\n2\n", "input_to_evaluate": "program vjudge149349E;\nconst maxn=300000+10;\n maxm=100000+10;\nvar l,r,next:array[0..maxn] of longint;\n last,ans,bits:array[0..maxm] of longint;\n n,m,i,j:longint;\nfunction ask(x:longint):longint;\nvar ans:longint;\nbegin\n ans:=0;\n while x>0 do\n begin\n ans:=ans+bits[x];\n x:=x-x and (-x);\n end;\n exit(ans);\nend;\nprocedure add(x,d:longint);\nbegin\n while(x<=m+1) do\n begin\n bits[x]:=bits[x]+d;\n x:=x+x and (-x);\n end;\nend;\nbegin\n readln(n,m);\n fillchar(last,sizeof(last),0);\n for i:=1 to n do\n begin\n readln(l[i],r[i]);\n next[i]:=last[r[i]-l[i]+1];\n last[r[i]-l[i]+1]:=i;\n inc(ans[1]);\n dec(ans[r[i]-l[i]+2]);\n end;\n for i:=1 to m do ans[i]:=ans[i]+ans[i-1];\n fillchar(bits,sizeof(bits),0);\n for i:=1 to m do\n begin\n ans[i]:=ans[i]+bits[1];\n for j:=1 to m div i do\n ans[i]:=ans[i]+ask(j*i+1);\n j:=last[i];\n while j>0 do\n begin\n add(l[j]+1,1);\n add(r[j]+2,-1);\n j:=next[j];\n end;\n end;\n for i:=1 to m do writeln(ans[i]);\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke has decided to play a game, where the player runs a railway company.\nThere are M+1 stations on Snuke Line, numbered 0 through M.\nA train on Snuke Line stops at station 0 and every d-th station thereafter, where d is a predetermined constant for each train.\nFor example, if d = 3, the train stops at station 0, 3, 6, 9, and so forth.\n\nThere are N kinds of souvenirs sold in areas around Snuke Line. The i-th kind of souvenirs can be purchased when the train stops at one of the following stations: stations l_i, l_i+1, l_i+2, ..., r_i.\n\nThere are M values of d, the interval between two stops, for trains on Snuke Line: 1, 2, 3, ..., M.\nFor each of these M values, find the number of the kinds of souvenirs that can be purchased if one takes a train with that value of d at station 0.\nHere, assume that it is not allowed to change trains.\n\nConstraints\n\n1 ≦ N ≦ 3 × 10^{5}\n\n1 ≦ M ≦ 10^{5}\n\n1 ≦ l_i ≦ r_i ≦ M\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nl_1 r_1\n:\nl_{N} r_{N}\n\nOutput\n\nPrint the answer in M lines. The i-th line should contain the maximum number of the kinds of souvenirs that can be purchased if one takes a train stopping every i-th station.\n\nSample Input 1\n\n3 3\n1 2\n2 3\n3 3\n\nSample Output 1\n\n3\n2\n2\n\nIf one takes a train stopping every station, three kinds of souvenirs can be purchased: kind 1, 2 and 3.\n\nIf one takes a train stopping every second station, two kinds of souvenirs can be purchased: kind 1 and 2.\n\nIf one takes a train stopping every third station, two kinds of souvenirs can be purchased: kind 2 and 3.\n\nSample Input 2\n\n7 9\n1 7\n5 9\n5 7\n5 9\n1 1\n6 8\n3 4\n\nSample Output 2\n\n7\n6\n6\n5\n4\n5\n5\n3\n2", "sample_input": "3 3\n1 2\n2 3\n3 3\n"}, "reference_outputs": ["3\n2\n2\n"], "source_document_id": "p03819", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke has decided to play a game, where the player runs a railway company.\nThere are M+1 stations on Snuke Line, numbered 0 through M.\nA train on Snuke Line stops at station 0 and every d-th station thereafter, where d is a predetermined constant for each train.\nFor example, if d = 3, the train stops at station 0, 3, 6, 9, and so forth.\n\nThere are N kinds of souvenirs sold in areas around Snuke Line. The i-th kind of souvenirs can be purchased when the train stops at one of the following stations: stations l_i, l_i+1, l_i+2, ..., r_i.\n\nThere are M values of d, the interval between two stops, for trains on Snuke Line: 1, 2, 3, ..., M.\nFor each of these M values, find the number of the kinds of souvenirs that can be purchased if one takes a train with that value of d at station 0.\nHere, assume that it is not allowed to change trains.\n\nConstraints\n\n1 ≦ N ≦ 3 × 10^{5}\n\n1 ≦ M ≦ 10^{5}\n\n1 ≦ l_i ≦ r_i ≦ M\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nl_1 r_1\n:\nl_{N} r_{N}\n\nOutput\n\nPrint the answer in M lines. The i-th line should contain the maximum number of the kinds of souvenirs that can be purchased if one takes a train stopping every i-th station.\n\nSample Input 1\n\n3 3\n1 2\n2 3\n3 3\n\nSample Output 1\n\n3\n2\n2\n\nIf one takes a train stopping every station, three kinds of souvenirs can be purchased: kind 1, 2 and 3.\n\nIf one takes a train stopping every second station, two kinds of souvenirs can be purchased: kind 1 and 2.\n\nIf one takes a train stopping every third station, two kinds of souvenirs can be purchased: kind 2 and 3.\n\nSample Input 2\n\n7 9\n1 7\n5 9\n5 7\n5 9\n1 1\n6 8\n3 4\n\nSample Output 2\n\n7\n6\n6\n5\n4\n5\n5\n3\n2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1013, "cpu_time_ms": 175, "memory_kb": 5504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s895741026", "group_id": "codeNet:p03822", "input_text": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,now:array[0..500007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[(lx+rx) div 2];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\nbegin\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then dfs(v,u);\n\tq:=pre[q];\n end;\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then\n\tbegin\n\t inc(tott);\n\t now[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485143714, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s895741026.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s895741026", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,now:array[0..500007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[(lx+rx) div 2];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\nbegin\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then dfs(v,u);\n\tq:=pre[q];\n end;\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then\n\tbegin\n\t inc(tott);\n\t now[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(jm) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..300007] of longint;\nbegin\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485142969, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s298698850.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s298698850", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,t,now:array[0..500007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[lx+random(rx-lx+1)];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..300007] of longint;\nbegin\n tott:=0;\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(jm) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..300007] of longint;\nbegin\n tott:=0;\n fillchar(noww,sizeof(noww),0);\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485142744, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s669518061.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s669518061", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot:longint;\n\tlast,pre,other,anss,a,t,now:array[0..300007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[lx+random(rx-lx+1)];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v,i,tott:longint;\n noww:array[0..300007] of longint;\nbegin\n tott:=0;\n fillchar(noww,sizeof(noww),0);\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t noww[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\nif (tott<>0) then\nbegin\n for i:=1 to tott do\n\tnow[i]:=noww[i];\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+tott+1-i>anss[u]) then anss[u]:=now[i]+tott+1-i;\nend else anss[u]:=0;\nend;\nbegin\n randomize;\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(jm) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v:longint;\nbegin\n tott:=0;\n fillchar(now,sizeof(now),0);\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t now[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+i>anss[u]) then anss[u]:=now[i]+i;\nend;\nbegin\n readln(n);\n randomize;\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n ans:=0;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485141662, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s444891392.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s444891392", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tott,tot:longint;\n\tlast,pre,other,anss,a,t,now:array[0..300007] of int64;\n\tans:int64;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure qsort(lx,rx:longint);\nvar i,j,m,t:longint;\nbegin\n i:=lx;j:=rx;m:=now[random(rx-lx+1)+lx];\n repeat\n\twhile (now[i]m) do dec(j);\n\tif (i<=j) then\n\tbegin\n\t t:=now[i];now[i]:=now[j];now[j]:=t;\n\t inc(i);dec(j);\n\tend;\n until (i>j);\n if (ilx) then qsort(lx,j);\nend;\nprocedure dfs(u,father:longint);\nvar q,v:longint;\nbegin\n tott:=0;\n fillchar(now,sizeof(now),0);\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then \n\tbegin\n\t dfs(v,u);\n\t inc(tott);\n\t now[tott]:=anss[v];\n\tend;\n\tq:=pre[q];\n end;\n qsort(1,tott);\n anss[u]:=0;\n for i:=1 to tott do\n\tif (now[i]+i>anss[u]) then anss[u]:=now[i]+i;\nend;\nbegin\n readln(n);\n randomize;\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n ans:=0;\n fillchar(anss,sizeof(anss),0);\n dfs(1,0);\n writeln(anss[1]);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(jans) then ans:=depth[u]+t[u];\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then dfs(v,u);\n\tq:=pre[q];\n end;\nend;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n ans:=0;\n dfs(1,0);\n if (ans>n) then ans:=n;\n writeln(ans-1);\nend.\n ", "language": "Pascal", "metadata": {"date": 1485139628, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03822.html", "problem_id": "p03822", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03822/input.txt", "sample_output_relpath": "derived/input_output/data/p03822/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03822/Pascal/s629685362.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s629685362", "user_id": "u331121156"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var n,i,tot,ans:longint;\n a,t:array[0..100007] of longint;\n\tlast,pre,other,depth:array[0..300007] of longint;\nprocedure insert(u,v:longint);\nbegin\n inc(tot);\n other[tot]:=v;\n pre[tot]:=last[u];\n last[u]:=tot;\nend;\nprocedure dfs(u,father:longint);\nvar q,v:longint;\nbegin\n depth[u]:=depth[father]+1;\n if (depth[u]+t[u]>ans) then ans:=depth[u]+t[u];\n q:=last[u];\n while (q>0) do\n begin\n v:=other[q];\n if (v<>father) then dfs(v,u);\n\tq:=pre[q];\n end;\nend;\nbegin\n readln(n);\n fillchar(a,sizeof(a),0);\n fillchar(t,sizeof(t),0);\n tot:=0;\n for i:=2 to n do\n begin\n\treadln(a[i]);\n t[a[i]]:=t[a[i]]+1;\n insert(i,a[i]);insert(a[i],i);\n end;\n ans:=0;\n dfs(1,0);\n if (ans>n) then ans:=n;\n writeln(ans-1);\nend.\n ", "problem_context": "Score : 800 points\n\nProblem Statement\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament.\nFor some reasons, the tournament may not be \"fair\" for all the contestants.\nThat is, the number of the matches that must be played in order to win the championship may be different for each contestant. The structure of the tournament is formally described at the end of this statement.\n\nAfter each match, there were always one winner and one loser. The last contestant standing was declared the champion.\n\nFigure: an example of a tournament\n\nFor convenience, the contestants were numbered 1 through N. The contestant numbered 1 was the champion, and the contestant numbered i(2 ≦ i ≦ N) was defeated in a match against the contestant numbered a_i.\n\nWe will define the depth of the tournament as the maximum number of the matches that must be played in order to win the championship over all the contestants.\n\nFind the minimum possible depth of the tournament.\n\nThe formal description of the structure of the tournament is as follows. In the i-th match, one of the following played against each other:\n\nTwo predetermined contestants\n\nOne predetermined contestant and the winner of the j-th match, where j(ja[i,k]+a[k,j]) then a[i,j]:=a[i,k]+a[k,j];\n for i:=1 to n do\n for j:=i+1 to n do\n if (a[i,j]a[i,k]+a[k,j]) then a[i,j]:=a[i,k]+a[k,j];\n for i:=1 to n do\n for j:=i+1 to n do\n if (a[i,j]j)and(i<>k)and(j<>k)and(a[i,j]>a[i,k]+a[k,j]) then\n begin\n a[i,j]:=a[i,k]+a[k,j];\n b[i,k]:=0;\n b[k,j]:=0;\n t:=1;\n end;\n for i:=1 to 100 do\n for j:=1 to 100 do\n if (b[i,j]=1) then s:=s+1;\n if (t=0) then s:=0;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1526265665, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03837.html", "problem_id": "p03837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03837/input.txt", "sample_output_relpath": "derived/input_output/data/p03837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03837/Pascal/s480789245.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s480789245", "user_id": "u263933075"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a,b:array[1..100,1..100] of longint;\n i,j,x,y,n,m,k,t,s,z:longint;\nbegin\n read(n,m);\n fillchar(a,sizeof(a),$7f);\n for i:=1 to m do\n begin\n read(x,y,z);\n a[x,y]:=z;\n a[y,x]:=z;\n b[x,y]:=1;\n end;\n for k:=1 to n do\n for i:=1 to n do\n for j:=1 to n do\n if (i<>j)and(i<>k)and(j<>k)and(a[i,j]>a[i,k]+a[k,j]) then\n begin\n a[i,j]:=a[i,k]+a[k,j];\n b[i,k]:=0;\n b[k,j]:=0;\n t:=1;\n end;\n for i:=1 to 100 do\n for j:=1 to 100 do\n if (b[i,j]=1) then s:=s+1;\n if (t=0) then s:=0;\n writeln(s);\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nThe i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤iy then begin n:=0-x;s:=1;end;\nwhile ny then begin n:=0-x;s:=1;end;\nwhile n0 then \n begin\n p := pos('+',s);\n\t sign:='+';\n end;\n if pos('-',s)<>0 then \n begin\n p := pos('-',s);\n\t sign:='-';\n end;\n astr:=copy(s,1,p-2);\n bstr:=copy(s,p+2,lens-p-1);\n val(astr,a);\n val(bstr,b);\n if sign='+' then writeln(a+b);\n if sign='-' then writeln(a-b);\nend.", "language": "Pascal", "metadata": {"date": 1596654763, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03844.html", "problem_id": "p03844", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03844/input.txt", "sample_output_relpath": "derived/input_output/data/p03844/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03844/Pascal/s433361169.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s433361169", "user_id": "u353919145"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "var\ns,astr,bstr:ansistring;\nsign:char;\na,b,lens,p:longint;\nbegin\n readln(s);\n lens:=length(s);\n if pos('+',s)<>0 then \n begin\n p := pos('+',s);\n\t sign:='+';\n end;\n if pos('-',s)<>0 then \n begin\n p := pos('-',s);\n\t sign:='-';\n end;\n astr:=copy(s,1,p-2);\n bstr:=copy(s,p+2,lens-p-1);\n val(astr,a);\n val(bstr,b);\n if sign='+' then writeln(a+b);\n if sign='-' then writeln(a-b);\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "sample_input": "1 + 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03844", "source_text": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 419, "cpu_time_ms": 5, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s818362226", "group_id": "codeNet:p03845", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,m,i,sum:Integer;\n t,p,x:array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n SetLength(t,n);\n sum:=0;\n for i := 0 to n - 1 do begin\n Read(t[i]);\n sum:=sum+t[i];\n end;\n\n Readln(m);\n SetLength(p,m);\n SetLength(x,m);\n for i := 0 to m - 1 do begin\n Read(p[i]);\n Readln(x[i]);\n end;\n\n for i := 0 to m - 1 do\n Writeln(sum-t[p[i]-1]+x[i]);\n\n \n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1514327766, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03845.html", "problem_id": "p03845", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03845/input.txt", "sample_output_relpath": "derived/input_output/data/p03845/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03845/Pascal/s818362226.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s818362226", "user_id": "u755925739"}, "prompt_components": {"gold_output": "6\n9\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,m,i,sum:Integer;\n t,p,x:array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n\n SetLength(t,n);\n sum:=0;\n for i := 0 to n - 1 do begin\n Read(t[i]);\n sum:=sum+t[i];\n end;\n\n Readln(m);\n SetLength(p,m);\n SetLength(x,m);\n for i := 0 to m - 1 do begin\n Read(p[i]);\n Readln(x[i]);\n end;\n\n for i := 0 to m - 1 do\n Writeln(sum-t[p[i]-1]+x[i]);\n\n \n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nJoisino is about to compete in the final round of a certain programming competition.\nIn this contest, there are N problems, numbered 1 through N.\nJoisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).\n\nAlso, there are M kinds of drinks offered to the contestants, numbered 1 through M.\nIf Joisino takes drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds.\nIt does not affect the time to solve the other problems.\n\nA contestant is allowed to take exactly one of the drinks before the start of the contest.\nFor each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink.\nHere, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems.\nYour task is to write a program to calculate it instead of her.\n\nConstraints\n\nAll input values are integers.\n\n1≦N≦100\n\n1≦T_i≦10^5\n\n1≦M≦100\n\n1≦P_i≦N\n\n1≦X_i≦10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 T_2 ... T_N\nM\nP_1 X_1\nP_2 X_2\n:\nP_M X_M\n\nOutput\n\nFor each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.\n\nSample Input 1\n\n3\n2 1 4\n2\n1 1\n2 3\n\nSample Output 1\n\n6\n9\n\nIf Joisino takes drink 1, the time it takes her to solve each problem will be 1, 1 and 4 seconds, respectively, totaling 6 seconds.\n\nIf Joisino takes drink 2, the time it takes her to solve each problem will be 2, 3 and 4 seconds, respectively, totaling 9 seconds.\n\nSample Input 2\n\n5\n7 2 3 8 5\n3\n4 2\n1 7\n4 13\n\nSample Output 2\n\n19\n25\n30", "sample_input": "3\n2 1 4\n2\n1 1\n2 3\n"}, "reference_outputs": ["6\n9\n"], "source_document_id": "p03845", "source_text": "Score : 200 points\n\nProblem Statement\n\nJoisino is about to compete in the final round of a certain programming competition.\nIn this contest, there are N problems, numbered 1 through N.\nJoisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).\n\nAlso, there are M kinds of drinks offered to the contestants, numbered 1 through M.\nIf Joisino takes drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds.\nIt does not affect the time to solve the other problems.\n\nA contestant is allowed to take exactly one of the drinks before the start of the contest.\nFor each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink.\nHere, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems.\nYour task is to write a program to calculate it instead of her.\n\nConstraints\n\nAll input values are integers.\n\n1≦N≦100\n\n1≦T_i≦10^5\n\n1≦M≦100\n\n1≦P_i≦N\n\n1≦X_i≦10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 T_2 ... T_N\nM\nP_1 X_1\nP_2 X_2\n:\nP_M X_M\n\nOutput\n\nFor each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.\n\nSample Input 1\n\n3\n2 1 4\n2\n1 1\n2 3\n\nSample Output 1\n\n6\n9\n\nIf Joisino takes drink 1, the time it takes her to solve each problem will be 1, 1 and 4 seconds, respectively, totaling 6 seconds.\n\nIf Joisino takes drink 2, the time it takes her to solve each problem will be 2, 3 and 4 seconds, respectively, totaling 9 seconds.\n\nSample Input 2\n\n5\n7 2 3 8 5\n3\n4 2\n1 7\n4 13\n\nSample Output 2\n\n19\n25\n30", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 639, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s645775886", "group_id": "codeNet:p03853", "input_text": "var\n n,m,i:longint;\n st:string;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n readln(st);\n writeln(st);\n writeln(st);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1583375234, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Pascal/s645775886.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s645775886", "user_id": "u476418095"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "var\n n,m,i:longint;\n st:string;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n readln(st);\n writeln(st);\n writeln(st);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s055869452", "group_id": "codeNet:p03853", "input_text": "var\n x:string;\n n,m,i:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n readln(x);\n writeln(x);\n writeln(x);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1582425301, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Pascal/s055869452.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055869452", "user_id": "u476418095"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "var\n x:string;\n n,m,i:longint;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n readln(x);\n writeln(x);\n writeln(x);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s264386622", "group_id": "codeNet:p03853", "input_text": "var\nn,m,i:longint;\ns:string;\nbegin\n readln(n,m); \n for i:=1 to n do\n begin\n readln(s);\n writeln(s);\n writeln(s);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1577566159, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Pascal/s264386622.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s264386622", "user_id": "u476418095"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "var\nn,m,i:longint;\ns:string;\nbegin\n readln(n,m); \n for i:=1 to n do\n begin\n readln(s);\n writeln(s);\n writeln(s);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s406252941", "group_id": "codeNet:p03853", "input_text": "var\n n,m,i,j:longint;\n a:array[0..101,0..101] of char;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n read(a[i,j]);\n readln;\n end;\n for i:=1 to 2*n do\n begin\n for j:=1 to m do\n write(a[(i+1) div 2,j]);\n writeln;\n end;\nend.", "language": "Pascal", "metadata": {"date": 1571675823, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Pascal/s406252941.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s406252941", "user_id": "u723721005"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "var\n n,m,i,j:longint;\n a:array[0..101,0..101] of char;\nbegin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n read(a[i,j]);\n readln;\n end;\n for i:=1 to 2*n do\n begin\n for j:=1 to m do\n write(a[(i+1) div 2,j]);\n writeln;\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 257, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s151203521", "group_id": "codeNet:p03853", "input_text": "var i:Integer;s:String[100];begin readln();for i:=1 to 100 do begin readln(s);writeln(s);writeln(s)end;end.", "language": "Pascal", "metadata": {"date": 1537948046, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Pascal/s151203521.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s151203521", "user_id": "u657913472"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "var i:Integer;s:String[100];begin readln();for i:=1 to 100 do begin readln(s);writeln(s);writeln(s)end;end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s776272019", "group_id": "codeNet:p03857", "input_text": "program D;\n var N,K,L:longint;\n var i,j,p,q:longint;\n var a:array[1..250000]of longint;\n var b:array[1..250000]of longint;\n var map1:array of array of boolean;\n var map2:array of array of boolean;\n var used:array[1..250000]of boolean;\n var ansr:array[1..250000]of longint;\n procedure DFS1(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n a[_]:=__;\n for ii:=1 to N do\n if (map1[_,ii]=true)AND(used[ii]=false) then DFS1(ii,__);\n end; \n procedure DFS2(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n b[_]:=__;\n for ii:=1 to N do\n if (a[_]=a[ii])AND(map2[_,ii]=true)AND(used[ii]=false) then DFS2(ii,__);\n end; \nbegin\n readln(N,K,L);\n setlength(map1,N+1,N+1);\n setlength(map2,N+1,N+1);\n for i:=1 to N do \n begin\n map1[i,i]:=true;\n map2[i,i]:=true;\n used[i]:=false;\n ansr[i]:=0;\n end;\n for i:=1 to K do\n begin\n readln(p,q);\n map1[p,q]:=true;\n map1[q,p]:=true;\n end;\n for i:=1 to N do if used[i]=false then DFS1(i,i);\n for i:=1 to L do\n begin\n readln(p,q);\n map2[p,q]:=true;\n map2[q,p]:=true;\n end;\n for i:=1 to N do used[i]:=false;\n for i:=1 to N do if used[i]=false then DFS2(i,i);\n for i:=1 to N do ansr[b[i]]:=ansr[b[i]]+1;\n for i:=1 to N do write(ansr[b[i]],' ');\nend.", "language": "Pascal", "metadata": {"date": 1481679802, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03857.html", "problem_id": "p03857", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03857/input.txt", "sample_output_relpath": "derived/input_output/data/p03857/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03857/Pascal/s776272019.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s776272019", "user_id": "u566971318"}, "prompt_components": {"gold_output": "1 2 2 1\n", "input_to_evaluate": "program D;\n var N,K,L:longint;\n var i,j,p,q:longint;\n var a:array[1..250000]of longint;\n var b:array[1..250000]of longint;\n var map1:array of array of boolean;\n var map2:array of array of boolean;\n var used:array[1..250000]of boolean;\n var ansr:array[1..250000]of longint;\n procedure DFS1(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n a[_]:=__;\n for ii:=1 to N do\n if (map1[_,ii]=true)AND(used[ii]=false) then DFS1(ii,__);\n end; \n procedure DFS2(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n b[_]:=__;\n for ii:=1 to N do\n if (a[_]=a[ii])AND(map2[_,ii]=true)AND(used[ii]=false) then DFS2(ii,__);\n end; \nbegin\n readln(N,K,L);\n setlength(map1,N+1,N+1);\n setlength(map2,N+1,N+1);\n for i:=1 to N do \n begin\n map1[i,i]:=true;\n map2[i,i]:=true;\n used[i]:=false;\n ansr[i]:=0;\n end;\n for i:=1 to K do\n begin\n readln(p,q);\n map1[p,q]:=true;\n map1[q,p]:=true;\n end;\n for i:=1 to N do if used[i]=false then DFS1(i,i);\n for i:=1 to L do\n begin\n readln(p,q);\n map2[p,q]:=true;\n map2[q,p]:=true;\n end;\n for i:=1 to N do used[i]:=false;\n for i:=1 to N do if used[i]=false then DFS2(i,i);\n for i:=1 to N do ansr[b[i]]:=ansr[b[i]]+1;\n for i:=1 to N do write(ansr[b[i]],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "sample_input": "4 3 1\n1 2\n2 3\n3 4\n2 3\n"}, "reference_outputs": ["1 2 2 1\n"], "source_document_id": "p03857", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1424, "cpu_time_ms": 2168, "memory_kb": 1272448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s309543706", "group_id": "codeNet:p03857", "input_text": "program D;\n var N,K,L:longint;\n var i,j,p,q:longint;\n var a:array[1..250000]of longint;\n var b:array[1..250000]of longint;\n var map1:array of array of boolean;\n var map2:array of array of boolean;\n var used:array[1..250000]of boolean;\n var ansr:array[1..250000]of longint;\n procedure DFS1(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n a[_]:=__;\n for ii:=1 to N do\n if (map1[_,ii]=true)AND(used[ii]=false) then DFS1(ii,__);\n end; \n procedure DFS2(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n b[_]:=__;\n for ii:=1 to N do\n if (a[_]=a[ii])AND(map2[_,ii]=true)AND(used[ii]=false) then DFS2(ii,__);\n end; \nbegin\n readln(N,K,L);\n setlength(map1,N,N);\n setlength(map2,N,N);\n for i:=1 to N do \n begin\n map1[i,i]:=true;\n map2[i,i]:=true;\n used[i]:=false;\n ansr[i]:=0;\n end;\n for i:=1 to K do\n begin\n readln(p,q);\n map1[p,q]:=true;\n map1[q,p]:=true;\n end;\n for i:=1 to N do if used[i]=false then DFS1(i,i);\n for i:=1 to L do\n begin\n readln(p,q);\n map2[p,q]:=true;\n map2[q,p]:=true;\n end;\n for i:=1 to N do used[i]:=false;\n for i:=1 to N do if used[i]=false then DFS2(i,i);\n for i:=1 to N do ansr[b[i]]:=ansr[b[i]]+1;\n for i:=1 to N do write(ansr[b[i]],' ');\nend.", "language": "Pascal", "metadata": {"date": 1481679718, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03857.html", "problem_id": "p03857", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03857/input.txt", "sample_output_relpath": "derived/input_output/data/p03857/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03857/Pascal/s309543706.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s309543706", "user_id": "u566971318"}, "prompt_components": {"gold_output": "1 2 2 1\n", "input_to_evaluate": "program D;\n var N,K,L:longint;\n var i,j,p,q:longint;\n var a:array[1..250000]of longint;\n var b:array[1..250000]of longint;\n var map1:array of array of boolean;\n var map2:array of array of boolean;\n var used:array[1..250000]of boolean;\n var ansr:array[1..250000]of longint;\n procedure DFS1(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n a[_]:=__;\n for ii:=1 to N do\n if (map1[_,ii]=true)AND(used[ii]=false) then DFS1(ii,__);\n end; \n procedure DFS2(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n b[_]:=__;\n for ii:=1 to N do\n if (a[_]=a[ii])AND(map2[_,ii]=true)AND(used[ii]=false) then DFS2(ii,__);\n end; \nbegin\n readln(N,K,L);\n setlength(map1,N,N);\n setlength(map2,N,N);\n for i:=1 to N do \n begin\n map1[i,i]:=true;\n map2[i,i]:=true;\n used[i]:=false;\n ansr[i]:=0;\n end;\n for i:=1 to K do\n begin\n readln(p,q);\n map1[p,q]:=true;\n map1[q,p]:=true;\n end;\n for i:=1 to N do if used[i]=false then DFS1(i,i);\n for i:=1 to L do\n begin\n readln(p,q);\n map2[p,q]:=true;\n map2[q,p]:=true;\n end;\n for i:=1 to N do used[i]:=false;\n for i:=1 to N do if used[i]=false then DFS2(i,i);\n for i:=1 to N do ansr[b[i]]:=ansr[b[i]]+1;\n for i:=1 to N do write(ansr[b[i]],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "sample_input": "4 3 1\n1 2\n2 3\n3 4\n2 3\n"}, "reference_outputs": ["1 2 2 1\n"], "source_document_id": "p03857", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1416, "cpu_time_ms": 2168, "memory_kb": 1245056}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s634361396", "group_id": "codeNet:p03857", "input_text": "program D;\n var N,K,L:longint;\n var i,j,p,q:longint;\n var a:array[1..250000]of longint;\n var b:array[1..250000]of longint;\n var map1:array[1..250000,1..250000]of boolean;\n var map2:array[1..250000,1..250000]of boolean;\n var used:array[1..250000]of boolean;\n var ansr:array[1..250000]of longint;\n procedure DFS1(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n a[_]:=__;\n for ii:=1 to N do\n if (map1[_,ii]=true)AND(used[ii]=false) then DFS1(ii,__);\n end; \n procedure DFS2(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n b[_]:=__;\n for ii:=1 to N do\n if (a[_]=a[ii])AND(map2[_,ii]=true)AND(used[ii]=false) then DFS2(ii,__);\n end; \nbegin\n readln(N,K,L);\n for i:=1 to N do \n begin\n map1[i,i]:=true;\n map2[i,i]:=true;\n used[i]:=false;\n ansr[i]:=0;\n end;\n for i:=1 to K do\n begin\n readln(p,q);\n map1[p,q]:=true;\n map1[q,p]:=true;\n end;\n for i:=1 to N do if used[i]=false then DFS1(i,i);\n for i:=1 to L do\n begin\n readln(p,q);\n map2[p,q]:=true;\n map2[q,p]:=true;\n end;\n for i:=1 to N do used[i]:=false;\n for i:=1 to N do if used[i]=false then DFS2(i,i);\n for i:=1 to N do ansr[b[i]]:=ansr[b[i]]+1;\n for i:=1 to N do write(ansr[b[i]],' ');\nend.", "language": "Pascal", "metadata": {"date": 1481679373, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03857.html", "problem_id": "p03857", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03857/input.txt", "sample_output_relpath": "derived/input_output/data/p03857/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03857/Pascal/s634361396.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s634361396", "user_id": "u566971318"}, "prompt_components": {"gold_output": "1 2 2 1\n", "input_to_evaluate": "program D;\n var N,K,L:longint;\n var i,j,p,q:longint;\n var a:array[1..250000]of longint;\n var b:array[1..250000]of longint;\n var map1:array[1..250000,1..250000]of boolean;\n var map2:array[1..250000,1..250000]of boolean;\n var used:array[1..250000]of boolean;\n var ansr:array[1..250000]of longint;\n procedure DFS1(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n a[_]:=__;\n for ii:=1 to N do\n if (map1[_,ii]=true)AND(used[ii]=false) then DFS1(ii,__);\n end; \n procedure DFS2(_,__:longint);\n var ii:longint;\n begin\n used[_]:=true;\n b[_]:=__;\n for ii:=1 to N do\n if (a[_]=a[ii])AND(map2[_,ii]=true)AND(used[ii]=false) then DFS2(ii,__);\n end; \nbegin\n readln(N,K,L);\n for i:=1 to N do \n begin\n map1[i,i]:=true;\n map2[i,i]:=true;\n used[i]:=false;\n ansr[i]:=0;\n end;\n for i:=1 to K do\n begin\n readln(p,q);\n map1[p,q]:=true;\n map1[q,p]:=true;\n end;\n for i:=1 to N do if used[i]=false then DFS1(i,i);\n for i:=1 to L do\n begin\n readln(p,q);\n map2[p,q]:=true;\n map2[q,p]:=true;\n end;\n for i:=1 to N do used[i]:=false;\n for i:=1 to N do if used[i]=false then DFS2(i,i);\n for i:=1 to N do ansr[b[i]]:=ansr[b[i]]+1;\n for i:=1 to N do write(ansr[b[i]],' ');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "sample_input": "4 3 1\n1 2\n2 3\n3 4\n2 3\n"}, "reference_outputs": ["1 2 2 1\n"], "source_document_id": "p03857", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1388, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s626993577", "group_id": "codeNet:p03857", "input_text": "program D;\n var N,K,L:longint;\n var root:array[1..250005]of longint;\n var size:array[1..250005]of longint;\n var colr:array[1..250005]of longint;\n var i,j,p,q:longint;\n function FindRoot(_:longint):longint;\n begin\n if root[_]=_ then exit(_) else exit(FindRoot(root[_]));\n end;\n procedure Merge(_x,_y:longint);\n var x,y:longint;\n begin\n x:=FindRoot(_x);\n y:=FindRoot(_y);\n if x<>y then\n if size[x]y then\n if size[x]y then\n if size[x]y then\n if size[x]x then begin a[i]:=s-x;sum:=sum+s-x;end;end;\n writeln(sum);\nend.", "language": "Pascal", "metadata": {"date": 1582583409, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s608514532.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s608514532", "user_id": "u723721005"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n a:array[1..100002] of int64;\n sum,s,x,n:int64;\n i:longint;\nbegin\n readln(n,x);\n for i:=1 to n do begin read(a[i]);s:=a[i]+a[i-1];if s>x then begin a[i]:=s-x;sum:=sum+s-x;end;end;\n writeln(sum);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s761868243", "group_id": "codeNet:p03862", "input_text": "{$goto+}\n{$asmmode intel}\nlabel 1,2;\nvar a:array[0..100000]of longint;\n n,x,i:longint;\n ans:int64;\nbegin\n readln(n,x);\n i:=-1;\n 1:i:=-not i;\n read(a[i]);\n if ix then\n begin\n inc(ans,a[i]+a[i+1]-x);\n if a[i]<=x then\n a[i+1]:=x-a[i]\n else\n begin\n a[i+1]:=0;\n a[i]:=x;\n end;\n end;\n if ix then\n begin\n inc(ans,a[i]+a[i+1]-x);\n if a[i]<=x then\n a[i+1]:=x-a[i]\n else\n begin\n a[i+1]:=0;\n a[i]:=x;\n end;\n end;\n if ix then\n begin\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(z-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=a[i+1]+a[i]-x;\n if a[i+1]-y<=0 then\n begin\n a[i]:=a[i]-(y-a[i+1]);\n a[i+1]:=0;\n end\n else\n a[i+1]:=a[i+1]-y;\n ans:=ans+y;\n end;\n end;\n end; \n writeln(ans);\nend.\n\n", "language": "Pascal", "metadata": {"date": 1502316911, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s844412823.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s844412823", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,x,y,z,i,j,k,ans:longint;\na:array[1..1000000]of longint;\nbegin\n readln(n,x);\n for i:=1 to n do\n begin\n read(a[i]);\n end;\n for i:=1 to n-1 do\n begin\n // writeln(i);\n if a[i]+a[i+1]>x then\n begin\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(z-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=a[i+1]+a[i]-x;\n if a[i+1]-y<=0 then\n begin\n a[i]:=a[i]-(y-a[i+1]);\n a[i+1]:=0;\n end\n else\n a[i+1]:=a[i+1]-y;\n ans:=ans+y;\n end;\n end;\n end; \n writeln(ans);\nend.\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1585, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s756102570", "group_id": "codeNet:p03862", "input_text": "program taskJ;\nUses math;\nvar n,x,i,j,sum,sum2,bye,sum3:longint;\n o:array[1..100000]of longint;\n o2:array[1..100000]of longint;\nbegin\nreadln(n,x);\nread(o[1]);\no2[1]:=o[1];\nfor i:=2 to n do\nbegin\n read(o[i]);\n o2[i]:=o[i];\n if o[i]+o[i-1]>x then\n begin\n sum:=sum+o[i]+o[i-1]-x;\n o[i]:=o[i]-(o[i]+o[i-1]-x);\n if o[i]<0 then\n begin\n o[i-1]:=o[i-1]+o[i];\n o[i]:=0;\n end;\n end;\nend;\nfor i:=2 to n do\nbegin\n if o2[i]+o2[i-1]>x then\n begin\n bye:=i-1;\n break;\n end;\nend;\nif bye<>0 then\nbegin\nfor i:=bye to n do\nsum3:=sum3+o2[i];\nsum3:=sum3-((n-bye) div 2)*x;\nend\nelse\nsum3:=0;\nwriteln(min(sum,sum3));\nend.", "language": "Pascal", "metadata": {"date": 1502316750, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s756102570.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s756102570", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program taskJ;\nUses math;\nvar n,x,i,j,sum,sum2,bye,sum3:longint;\n o:array[1..100000]of longint;\n o2:array[1..100000]of longint;\nbegin\nreadln(n,x);\nread(o[1]);\no2[1]:=o[1];\nfor i:=2 to n do\nbegin\n read(o[i]);\n o2[i]:=o[i];\n if o[i]+o[i-1]>x then\n begin\n sum:=sum+o[i]+o[i-1]-x;\n o[i]:=o[i]-(o[i]+o[i-1]-x);\n if o[i]<0 then\n begin\n o[i-1]:=o[i-1]+o[i];\n o[i]:=0;\n end;\n end;\nend;\nfor i:=2 to n do\nbegin\n if o2[i]+o2[i-1]>x then\n begin\n bye:=i-1;\n break;\n end;\nend;\nif bye<>0 then\nbegin\nfor i:=bye to n do\nsum3:=sum3+o2[i];\nsum3:=sum3-((n-bye) div 2)*x;\nend\nelse\nsum3:=0;\nwriteln(min(sum,sum3));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 642, "cpu_time_ms": 18, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s235883488", "group_id": "codeNet:p03862", "input_text": "var a:array [1..100000] of longint;\n b,l,i,j,k,s:longint;\nbegin\n s:=0;\n read(b,l);\n for i:=1 to b do\n read(a[i]);\n for i:=1 to b-1 do\n while (a[i]+a[i+1]>l) do\n begin\n a[i+1]:=a[i+1]-1;\n s:=s+1;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1502313487, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s235883488.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s235883488", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a:array [1..100000] of longint;\n b,l,i,j,k,s:longint;\nbegin\n s:=0;\n read(b,l);\n for i:=1 to b do\n read(a[i]);\n for i:=1 to b-1 do\n while (a[i]+a[i+1]>l) do\n begin\n a[i+1]:=a[i+1]-1;\n s:=s+1;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 2103, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s416917866", "group_id": "codeNet:p03862", "input_text": "var a:array [1..100000] of longint;\n b,l,i,j,k,s:longint;\nbegin\n s:=0;\n read(b,l);\n for i:=1 to b do\n read(a[i]);\n for i:=1 to b-1 do\n while (a[i]+a[i+1]>l) do\n begin\n a[i+1]:=a[i+1]-1;\n s:=s+1;\n end;\n writeln(s);\nend.", "language": "Pascal", "metadata": {"date": 1502313028, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s416917866.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s416917866", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var a:array [1..100000] of longint;\n b,l,i,j,k,s:longint;\nbegin\n s:=0;\n read(b,l);\n for i:=1 to b do\n read(a[i]);\n for i:=1 to b-1 do\n while (a[i]+a[i+1]>l) do\n begin\n a[i+1]:=a[i+1]-1;\n s:=s+1;\n end;\n writeln(s);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 2103, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s263534966", "group_id": "codeNet:p03862", "input_text": "var n,x,y,z,i,j,k,ans:longint;\na:array[1..1000000]of longint;\nbegin\n readln(n,x);\n for i:=1 to n do\n begin\n read(a[i]);\n end;\n for i:=1 to n-1 do\n begin\n if a[i]+a[i+1]>x then\n begin\n // writeln(i,' ',ans);\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n // writeln('1');\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(z-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=x-a[i];\n a[i]:=a[i]-y;\n ans:=ans+y;\n end;\n end;\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1502312613, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s263534966.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s263534966", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var n,x,y,z,i,j,k,ans:longint;\na:array[1..1000000]of longint;\nbegin\n readln(n,x);\n for i:=1 to n do\n begin\n read(a[i]);\n end;\n for i:=1 to n-1 do\n begin\n if a[i]+a[i+1]>x then\n begin\n // writeln(i,' ',ans);\n if (i+2<=n)then\n begin\n if a[i+2]+a[i+1]>x then\n begin\n y:=a[i+1]-(x-a[i]);\n z:=a[i+1]-(x-a[i+2]);\n if y>z then\n begin\n ans:=ans+y;\n // writeln('1');\n if y>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(y-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-y;\n end\n else\n begin\n ans:=ans+z;\n // writeln('2');\n if z>a[i+1] then\n begin\n a[i+2]:=a[i+1]-(z-ans);\n a[i+1]:=0;\n end\n else a[i+1]:=a[i+1]-z;\n end;\n end;\n end\n else\n begin\n y:=x-a[i];\n a[i]:=a[i]-y;\n ans:=ans+y;\n end;\n end;\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1455, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s145025296", "group_id": "codeNet:p03862", "input_text": "var\nn,x,o,i:longint;\na:array [0..100001] of longint;\nbegin\nreadln(n,x);\nfor i := 1 to n do\nbegin\nread(a[i]);\nif a[i]>x then\nbegin\no:=o+(a[i]-x);\na[i]:=x;\nend;\nend;\nfor i := 1 to n-1 do\nbegin\nif a[i]+a[i+1]>x then\nbegin\no:=o+(a[i]+a[i+1]-x);\na[i+1]:=x-a[i];\nend;\nend;\nwriteln(o);\nend.\n", "language": "Pascal", "metadata": {"date": 1502310663, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Pascal/s145025296.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s145025296", "user_id": "u089230684"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\nn,x,o,i:longint;\na:array [0..100001] of longint;\nbegin\nreadln(n,x);\nfor i := 1 to n do\nbegin\nread(a[i]);\nif a[i]>x then\nbegin\no:=o+(a[i]-x);\na[i]:=x;\nend;\nend;\nfor i := 1 to n-1 do\nbegin\nif a[i]+a[i+1]>x then\nbegin\no:=o+(a[i]+a[i+1]-x);\na[i+1]:=x-a[i];\nend;\nend;\nwriteln(o);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 17, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s105572290", "group_id": "codeNet:p03863", "input_text": "var\n s:string;\nbegin\n readln(s); \n if s[1]=s[length(s)] then\n begin\n if length(s) mod 2=1 then writeln('Second')\n else writeln('First');\n end\n else\n begin\n if length(s) mod 2=0 then writeln('Second')\n else writeln('First');\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1552353088, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s105572290.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s105572290", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n s:string;\nbegin\n readln(s); \n if s[1]=s[length(s)] then\n begin\n if length(s) mod 2=1 then writeln('Second')\n else writeln('First');\n end\n else\n begin\n if length(s) mod 2=0 then writeln('Second')\n else writeln('First');\n end;\nend.\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 351, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s588612285", "group_id": "codeNet:p03863", "input_text": "var\n s:ansistring;\nbegin\n read(s);\n if s[1]='a' then writeln('First')\n else writeln('Second');\n end.", "language": "Pascal", "metadata": {"date": 1539214355, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03863.html", "problem_id": "p03863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03863/input.txt", "sample_output_relpath": "derived/input_output/data/p03863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03863/Pascal/s588612285.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s588612285", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n s:ansistring;\nbegin\n read(s);\n if s[1]='a' then writeln('First')\n else writeln('Second');\n end.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03863", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s584162408", "group_id": "codeNet:p03865", "input_text": "var\n\ts:String;\nbegin\n\treadln(s);\n\tif(length(s)mod 2=0)xor(s[1]=s[length(s)])then writeln('Second')else writeln('First');\nend.", "language": "Pascal", "metadata": {"date": 1539080412, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03865.html", "problem_id": "p03865", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03865/input.txt", "sample_output_relpath": "derived/input_output/data/p03865/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03865/Pascal/s584162408.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584162408", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "var\n\ts:String;\nbegin\n\treadln(s);\n\tif(length(s)mod 2=0)xor(s[1]=s[length(s)])then writeln('Second')else writeln('First');\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03865", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 125, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s105819597", "group_id": "codeNet:p03865", "input_text": "program B;\n var Q:string;\n var ans:integer;\nbegin\n readln(Q);\n ans:=0;\n if Q[1]=Q[length(Q)] then ans:=ans+1;\n if length(Q) mod 2=0 then ans:=ans+1;\n if ans mod 2=1 then writeln('Second') else writeln('First');\nend.", "language": "Pascal", "metadata": {"date": 1480908328, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03865.html", "problem_id": "p03865", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03865/input.txt", "sample_output_relpath": "derived/input_output/data/p03865/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03865/Pascal/s105819597.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s105819597", "user_id": "u566971318"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "program B;\n var Q:string;\n var ans:integer;\nbegin\n readln(Q);\n ans:=0;\n if Q[1]=Q[length(Q)] then ans:=ans+1;\n if length(Q) mod 2=0 then ans:=ans+1;\n if ans mod 2=1 then writeln('Second') else writeln('First');\nend.", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03865", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s169372539", "group_id": "codeNet:p03878", "input_text": "program canh_toan;\nuses math;\nconst minn=0;\n maxn=trunc(1e5)+5;\n module=trunc(1e9)+7;\nvar n:longint;\n a,b:array[minn..maxn] of longint;\nprocedure sorta(l,r:longint);\nvar i,j,k,tg:longint;\nbegin\ni:=l;j:=r;tg:=a[random(r-l+1)+l];\nrepeat\nwhile (a[i]j) then\n begin\n k:=a[i];\n a[i]:=a[j];\n a[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (lj) then\n begin\n k:=b[i];\n b[i]:=b[j];\n b[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (labs(y)) then kq:=nhannp(kq,abs(x)) mod module;\n x:=y;\n end;\nwhile (i<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n inc(x);\n inc(i);\n end;\nwhile (j<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n dec(x);\n inc(j);\n end;\nwrite(kq);\nend;\nBEGIN\n main();\nEND.", "language": "Pascal", "metadata": {"date": 1578204549, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03878.html", "problem_id": "p03878", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03878/input.txt", "sample_output_relpath": "derived/input_output/data/p03878/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03878/Pascal/s169372539.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s169372539", "user_id": "u786768382"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program canh_toan;\nuses math;\nconst minn=0;\n maxn=trunc(1e5)+5;\n module=trunc(1e9)+7;\nvar n:longint;\n a,b:array[minn..maxn] of longint;\nprocedure sorta(l,r:longint);\nvar i,j,k,tg:longint;\nbegin\ni:=l;j:=r;tg:=a[random(r-l+1)+l];\nrepeat\nwhile (a[i]j) then\n begin\n k:=a[i];\n a[i]:=a[j];\n a[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (lj) then\n begin\n k:=b[i];\n b[i]:=b[j];\n b[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (labs(y)) then kq:=nhannp(kq,abs(x)) mod module;\n x:=y;\n end;\nwhile (i<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n inc(x);\n inc(i);\n end;\nwhile (j<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n dec(x);\n inc(j);\n end;\nwrite(kq);\nend;\nBEGIN\n main();\nEND.", "problem_context": "Score : 500 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nThere are N computers and N sockets in a one-dimensional world.\nThe coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i.\nIt is guaranteed that these 2N coordinates are pairwise distinct.\n\nSnuke wants to connect each computer to a socket using a cable.\nEach socket can be connected to only one computer.\n\nIn how many ways can he minimize the total length of the cables?\nCompute the answer modulo 10^9+7.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ a_i, b_i ≤ 10^9\n\nThe coordinates are integers.\n\nThe coordinates are pairwise distinct.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1\n:\na_N\nb_1\n:\nb_N\n\nOutput\n\nPrint the number of ways to minimize the total length of the cables, modulo 10^9+7.\n\nSample Input 1\n\n2\n0\n10\n20\n30\n\nSample Output 1\n\n2\n\nThere are two optimal connections: 0-20, 10-30 and 0-30, 10-20.\nIn both connections the total length of the cables is 40.\n\nSample Input 2\n\n3\n3\n10\n8\n7\n12\n5\n\nSample Output 2\n\n1", "sample_input": "2\n0\n10\n20\n30\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03878", "source_text": "Score : 500 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nThere are N computers and N sockets in a one-dimensional world.\nThe coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i.\nIt is guaranteed that these 2N coordinates are pairwise distinct.\n\nSnuke wants to connect each computer to a socket using a cable.\nEach socket can be connected to only one computer.\n\nIn how many ways can he minimize the total length of the cables?\nCompute the answer modulo 10^9+7.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ a_i, b_i ≤ 10^9\n\nThe coordinates are integers.\n\nThe coordinates are pairwise distinct.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1\n:\na_N\nb_1\n:\nb_N\n\nOutput\n\nPrint the number of ways to minimize the total length of the cables, modulo 10^9+7.\n\nSample Input 1\n\n2\n0\n10\n20\n30\n\nSample Output 1\n\n2\n\nThere are two optimal connections: 0-20, 10-30 and 0-30, 10-20.\nIn both connections the total length of the cables is 40.\n\nSample Input 2\n\n3\n3\n10\n8\n7\n12\n5\n\nSample Output 2\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1743, "cpu_time_ms": 139, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s169679999", "group_id": "codeNet:p03878", "input_text": "program canh_toan;\nuses math;\nconst minn=0;\n maxn=trunc(1e5)+5;\n vao='CONNECT.INP';\n ra='CONNECT.OUT';\n module=trunc(1e9)+7;\nvar n:longint;\n a,b:array[minn..maxn] of longint;\nprocedure sorta(l,r:longint);\nvar i,j,k,tg:longint;\nbegin\ni:=l;j:=r;tg:=a[random(r-l+1)+l];\nrepeat\nwhile (a[i]j) then\n begin\n k:=a[i];\n a[i]:=a[j];\n a[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (lj) then\n begin\n k:=b[i];\n b[i]:=b[j];\n b[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (labs(y)) then kq:=nhannp(kq,abs(x)) mod module;\n x:=y;\n end;\nwhile (i<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n inc(x);\n inc(i);\n end;\nwhile (j<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n dec(x);\n inc(j);\n end;\nwrite(kq);\nend;\nBEGIN\n main();\nEND.", "language": "Pascal", "metadata": {"date": 1578201586, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03878.html", "problem_id": "p03878", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03878/input.txt", "sample_output_relpath": "derived/input_output/data/p03878/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03878/Pascal/s169679999.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s169679999", "user_id": "u786768382"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program canh_toan;\nuses math;\nconst minn=0;\n maxn=trunc(1e5)+5;\n vao='CONNECT.INP';\n ra='CONNECT.OUT';\n module=trunc(1e9)+7;\nvar n:longint;\n a,b:array[minn..maxn] of longint;\nprocedure sorta(l,r:longint);\nvar i,j,k,tg:longint;\nbegin\ni:=l;j:=r;tg:=a[random(r-l+1)+l];\nrepeat\nwhile (a[i]j) then\n begin\n k:=a[i];\n a[i]:=a[j];\n a[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (lj) then\n begin\n k:=b[i];\n b[i]:=b[j];\n b[j]:=k;\n inc(i);\n dec(j);\n end;\nuntil i>j;\nif (labs(y)) then kq:=nhannp(kq,abs(x)) mod module;\n x:=y;\n end;\nwhile (i<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n inc(x);\n inc(i);\n end;\nwhile (j<=n) do\n begin\n kq:=nhannp(kq,abs(x)) mod module;\n dec(x);\n inc(j);\n end;\nwrite(kq);\nend;\nBEGIN\n main();\nEND.", "problem_context": "Score : 500 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nThere are N computers and N sockets in a one-dimensional world.\nThe coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i.\nIt is guaranteed that these 2N coordinates are pairwise distinct.\n\nSnuke wants to connect each computer to a socket using a cable.\nEach socket can be connected to only one computer.\n\nIn how many ways can he minimize the total length of the cables?\nCompute the answer modulo 10^9+7.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ a_i, b_i ≤ 10^9\n\nThe coordinates are integers.\n\nThe coordinates are pairwise distinct.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1\n:\na_N\nb_1\n:\nb_N\n\nOutput\n\nPrint the number of ways to minimize the total length of the cables, modulo 10^9+7.\n\nSample Input 1\n\n2\n0\n10\n20\n30\n\nSample Output 1\n\n2\n\nThere are two optimal connections: 0-20, 10-30 and 0-30, 10-20.\nIn both connections the total length of the cables is 40.\n\nSample Input 2\n\n3\n3\n10\n8\n7\n12\n5\n\nSample Output 2\n\n1", "sample_input": "2\n0\n10\n20\n30\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03878", "source_text": "Score : 500 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nThere are N computers and N sockets in a one-dimensional world.\nThe coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i.\nIt is guaranteed that these 2N coordinates are pairwise distinct.\n\nSnuke wants to connect each computer to a socket using a cable.\nEach socket can be connected to only one computer.\n\nIn how many ways can he minimize the total length of the cables?\nCompute the answer modulo 10^9+7.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ a_i, b_i ≤ 10^9\n\nThe coordinates are integers.\n\nThe coordinates are pairwise distinct.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1\n:\na_N\nb_1\n:\nb_N\n\nOutput\n\nPrint the number of ways to minimize the total length of the cables, modulo 10^9+7.\n\nSample Input 1\n\n2\n0\n10\n20\n30\n\nSample Output 1\n\n2\n\nThere are two optimal connections: 0-20, 10-30 and 0-30, 10-20.\nIn both connections the total length of the cables is 40.\n\nSample Input 2\n\n3\n3\n10\n8\n7\n12\n5\n\nSample Output 2\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1792, "cpu_time_ms": 139, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s504456345", "group_id": "codeNet:p03889", "input_text": "var\n a,b:ansistring;\n i:longint;\nbegin\n read(a);\n for i:=1 to length(a) do b:=a[i]+b;\n for i:=1 to length(a) do \n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1567199671, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s504456345.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504456345", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n a,b:ansistring;\n i:longint;\nbegin\n read(a);\n for i:=1 to length(a) do b:=a[i]+b;\n for i:=1 to length(a) do \n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 275, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s730595884", "group_id": "codeNet:p03889", "input_text": "var\n s,t:string;\n i:longint;\nbegin\n readln(s);\n for i:=length(s) downto 1 do t:=t+s[i];\n for i:=1 to length(t) do\n case t[i] of\n 'b': t[i]:='d'; \n 'd': t[i]:='b';\n 'p': t[i]:='q';\n 'q': t[i]:='p';\n end;\n if t=s then writeln('Yes')\n else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1563980848, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s730595884.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s730595884", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,t:string;\n i:longint;\nbegin\n readln(s);\n for i:=length(s) downto 1 do t:=t+s[i];\n for i:=1 to length(t) do\n case t[i] of\n 'b': t[i]:='d'; \n 'd': t[i]:='b';\n 'p': t[i]:='q';\n 'q': t[i]:='p';\n end;\n if t=s then writeln('Yes')\n else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 8, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s352962597", "group_id": "codeNet:p03889", "input_text": "var s,s1:ansistring;i:longint;ch:char;\nbegin\n readln(s);s1:=s;\n for i:=1 to length(s) div 2 do\n begin\n ch:=s[i];\n s[i]:=s[length(s)-i+1];\n s[length(s)-i+1]:=ch;\n end;\n for i:=1 to length(s) do\n if s[i]='b' then s[i]:='d'\n else if s[i]='d' then s[i]:='b'\n else if s[i]='p' then s[i]:='q'\n else s[i]:='p';\n if s=s1 then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1553477915, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s352962597.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s352962597", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s,s1:ansistring;i:longint;ch:char;\nbegin\n readln(s);s1:=s;\n for i:=1 to length(s) div 2 do\n begin\n ch:=s[i];\n s[i]:=s[length(s)-i+1];\n s[length(s)-i+1]:=ch;\n end;\n for i:=1 to length(s) do\n if s[i]='b' then s[i]:='d'\n else if s[i]='d' then s[i]:='b'\n else if s[i]='p' then s[i]:='q'\n else s[i]:='p';\n if s=s1 then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 396, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s879240276", "group_id": "codeNet:p03889", "input_text": "var i,n:longint;\n a,b:ansistring;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do b[n-i+1]:=a[i];\n for i:=1 to n do\n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.\n", "language": "Pascal", "metadata": {"date": 1553455079, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s879240276.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s879240276", "user_id": "u426964396"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var i,n:longint;\n a,b:ansistring;\nbegin\n readln(a);\n n:=length(a);\n for i:=1 to n do b[n-i+1]:=a[i];\n for i:=1 to n do\n if b[i]='b' then b[i]:='d'\n else if b[i]='d' then b[i]:='b'\n else if b[i]='p' then b[i]:='q'\n else b[i]:='p';\n if a=b then writeln('Yes')\n else writeln('No');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 297, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s178396308", "group_id": "codeNet:p03889", "input_text": "var s,s1:string;\n i,len:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n case s[i] of\n 'b':s1:='d'+s1;\n 'd':s1:='b'+s1;\n 'p':s1:='q'+s1;\n 'q':s1:='p'+s1;\n end;\n if (s=s1) then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1553449887, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s178396308.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s178396308", "user_id": "u558785941"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var s,s1:string;\n i,len:longint;\nbegin\n readln(s);\n len:=length(s);\n for i:=1 to len do\n case s[i] of\n 'b':s1:='d'+s1;\n 'd':s1:='b'+s1;\n 'p':s1:='q'+s1;\n 'q':s1:='p'+s1;\n end;\n if (s=s1) then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 270, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s830388397", "group_id": "codeNet:p03889", "input_text": "var\n\tch:ansistring;\n\ti,l,t:longint;\nfunction _to(x:char):char;\nbegin\n\tcase x of\n\t\t'b':exit('d');\n\t\t'd':exit('b');\n\t\t'p':exit('q');\n\t\t'q':exit('p');\n\tend;\nend;\nprocedure error;\nbegin\n\twriteln('No');\n\thalt;\nend;\nbegin\n\treadln(ch);\n\tl:=length(ch);\n\tif l mod 2=1 then error;\n\tt:=l div 2;\n\tfor i:=1 to t do \n\t\tif _to(ch[i])<>ch[l-i+1] then error;\n\twriteln('Yes');\nend.", "language": "Pascal", "metadata": {"date": 1550191055, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s830388397.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s830388397", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\tch:ansistring;\n\ti,l,t:longint;\nfunction _to(x:char):char;\nbegin\n\tcase x of\n\t\t'b':exit('d');\n\t\t'd':exit('b');\n\t\t'p':exit('q');\n\t\t'q':exit('p');\n\tend;\nend;\nprocedure error;\nbegin\n\twriteln('No');\n\thalt;\nend;\nbegin\n\treadln(ch);\n\tl:=length(ch);\n\tif l mod 2=1 then error;\n\tt:=l div 2;\n\tfor i:=1 to t do \n\t\tif _to(ch[i])<>ch[l-i+1] then error;\n\twriteln('Yes');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s980622435", "group_id": "codeNet:p03889", "input_text": "var\n s,s1,s2:ansistring;\n i,l:longint;\nbegin\n readln(s);\n s2:=s;\n l:=length(s);\n for i:=1 to l do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='p';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s2 then writeln('Yes') else writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1544071353, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s980622435.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s980622435", "user_id": "u476418095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s,s1,s2:ansistring;\n i,l:longint;\nbegin\n readln(s);\n s2:=s;\n l:=length(s);\n for i:=1 to l do begin\n if s[i]='b' then begin\n s[i]:='d';\n continue;\n end;\n if s[i]='d' then begin\n s[i]:='b';\n continue;\n end;\n if s[i]='p' then begin\n s[i]:='q';\n continue;\n end;\n if s[i]='q' then begin\n s[i]:='p';\n continue;\n end;\n end;\n for i:=l downto 1 do s1:=s1+s[i];\n if s1=s2 then writeln('Yes') else writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 778, "cpu_time_ms": 8, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s273711890", "group_id": "codeNet:p03889", "input_text": "var\n s:ansistring;\n i,j,n,k,m,t:longint;\nbegin\n readln(s);\n k:=length(s);\n if k mod 2<>0 then\n begin\n writeln('NO');\n halt;\n end;\n for i:=1 to k div 2 do\n begin\n t:=abs(ord(s[i])-ord(s[k-i+1]));\n if (t<>1)and(t<>2)and(t<>0) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1540263225, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s273711890.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s273711890", "user_id": "u247366051"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s:ansistring;\n i,j,n,k,m,t:longint;\nbegin\n readln(s);\n k:=length(s);\n if k mod 2<>0 then\n begin\n writeln('NO');\n halt;\n end;\n for i:=1 to k div 2 do\n begin\n t:=abs(ord(s[i])-ord(s[k-i+1]));\n if (t<>1)and(t<>2)and(t<>0) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 332, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s601068286", "group_id": "codeNet:p03889", "input_text": "var\n s:ansistring;\n i,j,n,k,m,t:longint;\nbegin\n readln(s);\n k:=length(s);\n if k mod 2<>0 then\n begin\n writeln('NO');\n halt;\n end;\n for i:=1 to k div 2 do\n begin\n t:=abs(ord(s[i])-ord(s[k-i+1]));\n if (t<>1)and(t<>2) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.\n", "language": "Pascal", "metadata": {"date": 1540263168, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03889.html", "problem_id": "p03889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03889/input.txt", "sample_output_relpath": "derived/input_output/data/p03889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03889/Pascal/s601068286.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s601068286", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n s:ansistring;\n i,j,n,k,m,t:longint;\nbegin\n readln(s);\n k:=length(s);\n if k mod 2<>0 then\n begin\n writeln('NO');\n halt;\n end;\n for i:=1 to k div 2 do\n begin\n t:=abs(ord(s[i])-ord(s[k-i+1]));\n if (t<>1)and(t<>2) then\n begin\n writeln('No');\n halt;\n end;\n end;\n writeln('Yes');\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "sample_input": "pdbq\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03889", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S consisting of letters b, d, p and q.\nDetermine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same string S:\n\nReverse the order of the characters in S.\n\nReplace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of letters b, d, p, and q.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a mirror string, print Yes. Otherwise, print No.\n\nSample Input 1\n\npdbq\n\nSample Output 1\n\nYes\n\nSample Input 2\n\nppqb\n\nSample Output 2\n\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 323, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s337693141", "group_id": "codeNet:p03896", "input_text": "var\n\tN,i,j,sz:Longint;\n\tA:Array[1..100,1..99]of Longint;\n\tans:String;\nbegin\n\tread(N);\n\tif N=2 then begin\n\t\twriteln(-1);\n\t\texit;\n\tend;\n\tif N mod 2=1 then begin\n\t\tfor i:=1 to N-1 do A[N,i]:=i;\n\t\ti:=1;\n\t\twhile i<=N-1 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\tend else begin\n\t\ti:=1;\n\t\twhile i<=N-2 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\t\tfor j:=1 to N-3 do begin\n\t\t\tA[N-1,j]:=j;\n\t\t\tA[N,j]:=j;\n\t\tend;\n\t\tA[N-1,N-2]:=N;\n\t\tA[N,N-1]:=N-1;\n\t\tA[N-1,N-1]:=N-2;\n\t\tA[N,N-2]:=N-2;\n\tend;\n\tsetlength(ans,3*N*N);\n\tsz:=0;\n\tfor i:=1 to N do begin\n\t\tfor j:=1 to N-1 do begin\n\t\t\tif A[i,j]<10 then begin\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:=Chr(A[i,j]+48);\n\t\t\tend else if A[i,j]<100 then begin\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:=Chr(A[i,j]div 10+48);\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:=Chr(A[i,j]mod 10+48);\n\t\t\tend else begin\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:='1';\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:='0';\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:='0';\n\t\t\tend;\n\t\t\tinc(sz);\n\t\t\tans[sz]:=#10;\n\t\tend;\n\tend;\n\tsetlength(ans,sz);\n\twrite(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1587436943, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03896.html", "problem_id": "p03896", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03896/input.txt", "sample_output_relpath": "derived/input_output/data/p03896/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03896/Pascal/s337693141.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s337693141", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n", "input_to_evaluate": "var\n\tN,i,j,sz:Longint;\n\tA:Array[1..100,1..99]of Longint;\n\tans:String;\nbegin\n\tread(N);\n\tif N=2 then begin\n\t\twriteln(-1);\n\t\texit;\n\tend;\n\tif N mod 2=1 then begin\n\t\tfor i:=1 to N-1 do A[N,i]:=i;\n\t\ti:=1;\n\t\twhile i<=N-1 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\tend else begin\n\t\ti:=1;\n\t\twhile i<=N-2 do begin\n\t\t\tfor j:=1 to i-1 do begin\n\t\t\t\tA[i,j]:=j;\n\t\t\t\tA[i+1,j]:=j;\n\t\t\tend;\n\t\t\tA[i,i]:=i+1;\n\t\t\tA[i+1,i+1]:=i;\n\t\t\tA[i,i+1]:=i+2;\n\t\t\tA[i+1,i]:=i+2;\n\t\t\tfor j:=i+2 to N-1 do begin\n\t\t\t\tA[i,j]:=j+1;\n\t\t\t\tA[i+1,j]:=j+1;\n\t\t\tend;\n\t\t\tinc(i,2);\n\t\tend;\n\t\tfor j:=1 to N-3 do begin\n\t\t\tA[N-1,j]:=j;\n\t\t\tA[N,j]:=j;\n\t\tend;\n\t\tA[N-1,N-2]:=N;\n\t\tA[N,N-1]:=N-1;\n\t\tA[N-1,N-1]:=N-2;\n\t\tA[N,N-2]:=N-2;\n\tend;\n\tsetlength(ans,3*N*N);\n\tsz:=0;\n\tfor i:=1 to N do begin\n\t\tfor j:=1 to N-1 do begin\n\t\t\tif A[i,j]<10 then begin\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:=Chr(A[i,j]+48);\n\t\t\tend else if A[i,j]<100 then begin\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:=Chr(A[i,j]div 10+48);\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:=Chr(A[i,j]mod 10+48);\n\t\t\tend else begin\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:='1';\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:='0';\n\t\t\t\tinc(sz);\n\t\t\t\tans[sz]:='0';\n\t\t\tend;\n\t\t\tinc(sz);\n\t\t\tans[sz]:=#10;\n\t\tend;\n\tend;\n\tsetlength(ans,sz);\n\twrite(ans);\nend.\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.\n\nDuring the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.\n\nIf any two persons look at each other during the challenge, the challenge ends in failure.\n\nFind the order in which each person looks at each of the N-1 other persons, to be successful in the challenge.\n\nConstraints\n\n2 \\leq N \\leq 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there exists no way to be successful in the challenge, print -1.\n\nIf there exists a way to be successful in the challenge, print any such way in the following format:\n\nA_{1,1} A_{1,2} ... A_{1, N-1}\nA_{2,1} A_{2,2} ... A_{2, N-1}\n:\nA_{N,1} A_{N,2} ... A_{N, N-1}\n\nwhere A_{i, j} is the index of the person that the person numbered i looks at during the j-th second.\n\nJudging\n\nThe output is considered correct only if all of the following conditions are satisfied:\n\n1 \\leq A_{i,j} \\leq N\n\nFor each i, A_{i,1}, A_{i,2}, ... , A_{i, N-1} are pairwise distinct.\n\nLet X = A_{i, j}, then A_{X, j} \\neq i always holds.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1", "sample_input": "7\n"}, "reference_outputs": ["2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n"], "source_document_id": "p03896", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.\n\nDuring the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.\n\nIf any two persons look at each other during the challenge, the challenge ends in failure.\n\nFind the order in which each person looks at each of the N-1 other persons, to be successful in the challenge.\n\nConstraints\n\n2 \\leq N \\leq 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there exists no way to be successful in the challenge, print -1.\n\nIf there exists a way to be successful in the challenge, print any such way in the following format:\n\nA_{1,1} A_{1,2} ... A_{1, N-1}\nA_{2,1} A_{2,2} ... A_{2, N-1}\n:\nA_{N,1} A_{N,2} ... A_{N, N-1}\n\nwhere A_{i, j} is the index of the person that the person numbered i looks at during the j-th second.\n\nJudging\n\nThe output is considered correct only if all of the following conditions are satisfied:\n\n1 \\leq A_{i,j} \\leq N\n\nFor each i, A_{i,1}, A_{i,2}, ... , A_{i, N-1} are pairwise distinct.\n\nLet X = A_{i, j}, then A_{X, j} \\neq i always holds.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2 3 4 5 6 7\n5 3 1 6 4 7\n2 7 4 1 5 6\n2 1 7 5 3 6\n1 4 3 7 6 2\n2 5 7 3 4 1\n2 6 1 4 5 3\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1358, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s976474433", "group_id": "codeNet:p03910", "input_text": "var\n a:array[1..1000000] of int64;\n n,s:int64;\n i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n inc(s,i);\n a[i]:=i;\n if s>n then break;\n end;\n s:=s-n;\n for i:=1 to n do if (a[i]<>s) and (a[i]<>0) then writeln(a[i]);\nend.", "language": "Pascal", "metadata": {"date": 1582237670, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03910.html", "problem_id": "p03910", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03910/input.txt", "sample_output_relpath": "derived/input_output/data/p03910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03910/Pascal/s976474433.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s976474433", "user_id": "u263933075"}, "prompt_components": {"gold_output": "1\n3\n", "input_to_evaluate": "var\n a:array[1..1000000] of int64;\n n,s:int64;\n i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n inc(s,i);\n a[i]:=i;\n if s>n then break;\n end;\n s:=s-n;\n for i:=1 to n do if (a[i]<>s) and (a[i]<>0) then writeln(a[i]);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "sample_input": "4\n"}, "reference_outputs": ["1\n3\n"], "source_document_id": "p03910", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s964580869", "group_id": "codeNet:p03920", "input_text": "var i,k,n:longint;\nbegin\nread(n);\nwhile n>0 do begin\ninc(k);\ndec(n,k);\nend;\nfor i:=1 to k do if i<>-n then writeln(i);\nend.", "language": "Pascal", "metadata": {"date": 1567182417, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03920.html", "problem_id": "p03920", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03920/input.txt", "sample_output_relpath": "derived/input_output/data/p03920/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03920/Pascal/s964580869.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s964580869", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n3\n", "input_to_evaluate": "var i,k,n:longint;\nbegin\nread(n);\nwhile n>0 do begin\ninc(k);\ndec(n,k);\nend;\nfor i:=1 to k do if i<>-n then writeln(i);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "sample_input": "4\n"}, "reference_outputs": ["1\n3\n"], "source_document_id": "p03920", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s712543764", "group_id": "codeNet:p03923", "input_text": "uses math;\nvar\n\tN,A,ans,p,now,tmp:int64;\n\tj,k:Longint;\nbegin\n\tread(N,A);\n\tans:=N;\n\tfor k:=1 to 39 do begin\n\t\tp:=floor(power(N/1,1/(k+1)));\n\t\tnow:=1;\n\t\tfor j:=1 to k do now:=now*p;\n\t\tfor j:=0 to k do begin\n\t\t\ttmp:=A*k+p*k+j+(N+now-1)div now;\n\t\t\tif ans>tmp then ans:=tmp;\n\t\t\tnow:=now div p*(p+1);\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1558418007, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03923.html", "problem_id": "p03923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03923/input.txt", "sample_output_relpath": "derived/input_output/data/p03923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03923/Pascal/s712543764.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s712543764", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "uses math;\nvar\n\tN,A,ans,p,now,tmp:int64;\n\tj,k:Longint;\nbegin\n\tread(N,A);\n\tans:=N;\n\tfor k:=1 to 39 do begin\n\t\tp:=floor(power(N/1,1/(k+1)));\n\t\tnow:=1;\n\t\tfor j:=1 to k do now:=now*p;\n\t\tfor j:=0 to k do begin\n\t\t\ttmp:=A*k+p*k+j+(N+now-1)div now;\n\t\t\tif ans>tmp then ans:=tmp;\n\t\t\tnow:=now div p*(p+1);\n\t\tend;\n\tend;\n\twriteln(ans);\nend.", "problem_context": "Score : 1000 points\n\nProblem Statement\n\nRng is baking cookies.\n\nInitially, he can bake one cookie per second.\n\nHe can also eat the cookies baked by himself.\nWhen there are x cookies not yet eaten, he can choose to eat all those cookies. After he finishes eating those cookies, the number of cookies he can bake per second becomes x. Note that a cookie always needs to be baked for 1 second, that is, he cannot bake a cookie in 1/x seconds when x > 1.\nWhen he choose to eat the cookies, he must eat all of them; he cannot choose to eat only part of them.\nIt takes him A seconds to eat the cookies regardless of how many, during which no cookies can be baked.\n\nHe wants to give N cookies to Grandma.\nFind the shortest time needed to produce at least N cookies not yet eaten.\n\nConstraints\n\n1≦N≦10^{12}\n\n0≦A≦10^{12}\n\nA is an integer.\n\nPartial Score\n\n500 points will be awarded for passing the test set satisfying N≦10^6 and A≦10^6.\n\nAdditional 500 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A\n\nOutput\n\nPrint the shortest time needed to produce at least N cookies not yet eaten.\n\nSample Input 1\n\n8 1\n\nSample Output 1\n\n7\n\nIt is possible to produce 8 cookies in 7 seconds, as follows:\n\nAfter 1 second: 1 cookie is done.\n\nAfter 2 seconds: 1 more cookie is done, totaling 2. Now, Rng starts eating those 2 cookies.\n\nAfter 3 seconds: He finishes eating the cookies, and he can now bake 2 cookies per second.\n\nAfter 4 seconds: 2 cookies are done.\n\nAfter 5 seconds: 2 more cookies are done, totaling 4.\n\nAfter 6 seconds: 2 more cookies are done, totaling 6.\n\nAfter 7 seconds: 2 more cookies are done, totaling 8.\n\nSample Input 2\n\n1000000000000 1000000000000\n\nSample Output 2\n\n1000000000000", "sample_input": "8 1\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03923", "source_text": "Score : 1000 points\n\nProblem Statement\n\nRng is baking cookies.\n\nInitially, he can bake one cookie per second.\n\nHe can also eat the cookies baked by himself.\nWhen there are x cookies not yet eaten, he can choose to eat all those cookies. After he finishes eating those cookies, the number of cookies he can bake per second becomes x. Note that a cookie always needs to be baked for 1 second, that is, he cannot bake a cookie in 1/x seconds when x > 1.\nWhen he choose to eat the cookies, he must eat all of them; he cannot choose to eat only part of them.\nIt takes him A seconds to eat the cookies regardless of how many, during which no cookies can be baked.\n\nHe wants to give N cookies to Grandma.\nFind the shortest time needed to produce at least N cookies not yet eaten.\n\nConstraints\n\n1≦N≦10^{12}\n\n0≦A≦10^{12}\n\nA is an integer.\n\nPartial Score\n\n500 points will be awarded for passing the test set satisfying N≦10^6 and A≦10^6.\n\nAdditional 500 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A\n\nOutput\n\nPrint the shortest time needed to produce at least N cookies not yet eaten.\n\nSample Input 1\n\n8 1\n\nSample Output 1\n\n7\n\nIt is possible to produce 8 cookies in 7 seconds, as follows:\n\nAfter 1 second: 1 cookie is done.\n\nAfter 2 seconds: 1 more cookie is done, totaling 2. Now, Rng starts eating those 2 cookies.\n\nAfter 3 seconds: He finishes eating the cookies, and he can now bake 2 cookies per second.\n\nAfter 4 seconds: 2 cookies are done.\n\nAfter 5 seconds: 2 more cookies are done, totaling 4.\n\nAfter 6 seconds: 2 more cookies are done, totaling 6.\n\nAfter 7 seconds: 2 more cookies are done, totaling 8.\n\nSample Input 2\n\n1000000000000 1000000000000\n\nSample Output 2\n\n1000000000000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 327, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s705176543", "group_id": "codeNet:p03939", "input_text": "var dd,xx,nn,n,d,x,ans:extended;\n i:longint;\nbegin\n readln(n,d,x);\n nn:=n*2;\n for i:=trunc(n) downto 1 do\n begin\n ans:=ans+d+(nn-1)/2*x;\n dd:=d+(2*d+5*x)/nn;\n xx:=x+4*x/nn;\n x:=xx;d:=dd;\n nn:=nn-2;\n end;\n writeln(ans:0:10);\nend.", "language": "Pascal", "metadata": {"date": 1580853036, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03939.html", "problem_id": "p03939", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03939/input.txt", "sample_output_relpath": "derived/input_output/data/p03939/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03939/Pascal/s705176543.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705176543", "user_id": "u743614777"}, "prompt_components": {"gold_output": "4.500000000000000\n", "input_to_evaluate": "var dd,xx,nn,n,d,x,ans:extended;\n i:longint;\nbegin\n readln(n,d,x);\n nn:=n*2;\n for i:=trunc(n) downto 1 do\n begin\n ans:=ans+d+(nn-1)/2*x;\n dd:=d+(2*d+5*x)/nn;\n xx:=x+4*x/nn;\n x:=xx;d:=dd;\n nn:=nn-2;\n end;\n writeln(ans:0:10);\nend.", "problem_context": "Score : 1000 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nThere are N balls and N+1 holes in a line. Balls are numbered 1 through N from left to right. Holes are numbered 1 through N+1 from left to right. The i-th ball is located between the i-th hole and (i+1)-th hole. We denote the distance between neighboring items (one ball and one hole) from left to right as d_i (1 \\leq i \\leq 2 \\times N). You are given two parameters d_1 and x. d_i - d_{i-1} is equal to x for all i (2 \\leq i \\leq 2 \\times N).\n\nWe want to push all N balls into holes one by one. When a ball rolls over a hole, the ball will drop into the hole if there is no ball in the hole yet. Otherwise, the ball will pass this hole and continue to roll. (In any scenario considered in this problem, balls will never collide.)\n\nIn each step, we will choose one of the remaining balls uniformly at random and then choose a direction (either left or right) uniformly at random and push the ball in this direction. Please calculate the expected total distance rolled by all balls during this process.\n\nFor example, when N = 3, d_1 = 1, and x = 1, the following is one possible scenario:\n\nfirst step: push the ball numbered 2 to its left, it will drop into the hole numbered 2. The distance rolled is 3.\n\nsecond step: push the ball numbered 1 to its right, it will pass the hole numbered 2 and drop into the hole numbered 3. The distance rolled is 9.\n\nthird step: push the ball numbered 3 to its right, it will drop into the hole numbered 4. The distance rolled is 6.\n\nSo the total distance in this scenario is 18.\n\nNote that in all scenarios every ball will drop into some hole and there will be a hole containing no ball in the end.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq d_1 \\leq 100\n\n0 \\leq x \\leq 100\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN d_1 x\n\nOutput\n\nPrint a floating number denoting the answer. The relative or absolute error of your answer should not be higher than 10^{-9}.\n\nSample Input 1\n\n1 3 3\n\nSample Output 1\n\n4.500000000000000\n\nThe distance between the only ball and the left hole is 3 and distance between the only ball and the right hole is 6. There are only two scenarios (i.e. push left and push right). The only ball will roll 3 and 6 unit distance, respectively. So the answer for this example is (3+6)/2 = 4.5.\n\nSample Input 2\n\n2 1 0\n\nSample Output 2\n\n2.500000000000000\n\nSample Input 3\n\n1000 100 100\n\nSample Output 3\n\n649620280.957660079002380", "sample_input": "1 3 3\n"}, "reference_outputs": ["4.500000000000000\n"], "source_document_id": "p03939", "source_text": "Score : 1000 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nThere are N balls and N+1 holes in a line. Balls are numbered 1 through N from left to right. Holes are numbered 1 through N+1 from left to right. The i-th ball is located between the i-th hole and (i+1)-th hole. We denote the distance between neighboring items (one ball and one hole) from left to right as d_i (1 \\leq i \\leq 2 \\times N). You are given two parameters d_1 and x. d_i - d_{i-1} is equal to x for all i (2 \\leq i \\leq 2 \\times N).\n\nWe want to push all N balls into holes one by one. When a ball rolls over a hole, the ball will drop into the hole if there is no ball in the hole yet. Otherwise, the ball will pass this hole and continue to roll. (In any scenario considered in this problem, balls will never collide.)\n\nIn each step, we will choose one of the remaining balls uniformly at random and then choose a direction (either left or right) uniformly at random and push the ball in this direction. Please calculate the expected total distance rolled by all balls during this process.\n\nFor example, when N = 3, d_1 = 1, and x = 1, the following is one possible scenario:\n\nfirst step: push the ball numbered 2 to its left, it will drop into the hole numbered 2. The distance rolled is 3.\n\nsecond step: push the ball numbered 1 to its right, it will pass the hole numbered 2 and drop into the hole numbered 3. The distance rolled is 9.\n\nthird step: push the ball numbered 3 to its right, it will drop into the hole numbered 4. The distance rolled is 6.\n\nSo the total distance in this scenario is 18.\n\nNote that in all scenarios every ball will drop into some hole and there will be a hole containing no ball in the end.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq d_1 \\leq 100\n\n0 \\leq x \\leq 100\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN d_1 x\n\nOutput\n\nPrint a floating number denoting the answer. The relative or absolute error of your answer should not be higher than 10^{-9}.\n\nSample Input 1\n\n1 3 3\n\nSample Output 1\n\n4.500000000000000\n\nThe distance between the only ball and the left hole is 3 and distance between the only ball and the right hole is 6. There are only two scenarios (i.e. push left and push right). The only ball will roll 3 and 6 unit distance, respectively. So the answer for this example is (3+6)/2 = 4.5.\n\nSample Input 2\n\n2 1 0\n\nSample Output 2\n\n2.500000000000000\n\nSample Input 3\n\n1000 100 100\n\nSample Output 3\n\n649620280.957660079002380", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 4, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s237120703", "group_id": "codeNet:p03944", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n w,h,n,ni,i,j,a,x,y,sum:Integer;\n xy:array of array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ぬりえ }\n Read(w);\n Read(h);\n Readln(n);\n\n SetLength(xy,h,w);\n\n for i := 0 to h - 1 do\n for j := 0 to w - 1 do\n xy[i,j]:=0;\n\n for ni := 0 to n-1 do begin\n Read(x);\n Read(y);\n Readln(a);\n case a of\n 1:begin\n for i := 0 to h - 1 do\n for j := 0 to x - 1 do\n xy[i,j]:=1;\n end;\n 2:begin\n for i := 0 to h-1 do\n for j := x to w - 1 do\n xy[i,j]:=1;\n end;\n 3:begin\n for i := 0 to y - 1 do\n for j := 0 to w - 1 do\n xy[i,j]:=1;\n end;\n 4:begin\n for i := y to h - 1 do\n for j := 0 to w - 1 do\n xy[i,j]:=1;\n end;\n end;\n end;\n\n sum:=0;\n for i := 0 to h - 1 do\n for j := 0 to w - 1 do\n sum:=sum+(xy[i,j]xor 1 xor 0);\n\n Writeln(sum);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "language": "Pascal", "metadata": {"date": 1514067147, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03944.html", "problem_id": "p03944", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03944/input.txt", "sample_output_relpath": "derived/input_output/data/p03944/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03944/Pascal/s237120703.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s237120703", "user_id": "u755925739"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n w,h,n,ni,i,j,a,x,y,sum:Integer;\n xy:array of array of Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ぬりえ }\n Read(w);\n Read(h);\n Readln(n);\n\n SetLength(xy,h,w);\n\n for i := 0 to h - 1 do\n for j := 0 to w - 1 do\n xy[i,j]:=0;\n\n for ni := 0 to n-1 do begin\n Read(x);\n Read(y);\n Readln(a);\n case a of\n 1:begin\n for i := 0 to h - 1 do\n for j := 0 to x - 1 do\n xy[i,j]:=1;\n end;\n 2:begin\n for i := 0 to h-1 do\n for j := x to w - 1 do\n xy[i,j]:=1;\n end;\n 3:begin\n for i := 0 to y - 1 do\n for j := 0 to w - 1 do\n xy[i,j]:=1;\n end;\n 4:begin\n for i := y to h - 1 do\n for j := 0 to w - 1 do\n xy[i,j]:=1;\n end;\n end;\n end;\n\n sum:=0;\n for i := 0 to h - 1 do\n for j := 0 to w - 1 do\n sum:=sum+(xy[i,j]xor 1 xor 0);\n\n Writeln(sum);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.\n\nSnuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).\n\nThen, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:\n\nIf a_i = 1, he painted the region satisfying x < x_i within the rectangle.\n\nIf a_i = 2, he painted the region satisfying x > x_i within the rectangle.\n\nIf a_i = 3, he painted the region satisfying y < y_i within the rectangle.\n\nIf a_i = 4, he painted the region satisfying y > y_i within the rectangle.\n\nFind the area of the white region within the rectangle after he finished painting.\n\nConstraints\n\n1 ≦ W, H ≦ 100\n\n1 ≦ N ≦ 100\n\n0 ≦ x_i ≦ W (1 ≦ i ≦ N)\n\n0 ≦ y_i ≦ H (1 ≦ i ≦ N)\n\nW, H (21:32, added), x_i and y_i are integers.\n\na_i (1 ≦ i ≦ N) is 1, 2, 3 or 4.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nW H N\nx_1 y_1 a_1\nx_2 y_2 a_2\n:\nx_N y_N a_N\n\nOutput\n\nPrint the area of the white region within the rectangle after Snuke finished painting.\n\nSample Input 1\n\n5 4 2\n2 1 1\n3 3 4\n\nSample Output 1\n\n9\n\nThe figure below shows the rectangle before Snuke starts painting.\n\nFirst, as (x_1, y_1) = (2, 1) and a_1 = 1, he paints the region satisfying x < 2 within the rectangle:\n\nThen, as (x_2, y_2) = (3, 3) and a_2 = 4, he paints the region satisfying y > 3 within the rectangle:\n\nNow, the area of the white region within the rectangle is 9.\n\nSample Input 2\n\n5 4 3\n2 1 1\n3 3 4\n1 4 2\n\nSample Output 2\n\n0\n\nIt is possible that the whole region within the rectangle is painted black.\n\nSample Input 3\n\n10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n\nSample Output 3\n\n64", "sample_input": "5 4 2\n2 1 1\n3 3 4\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03944", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.\n\nSnuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).\n\nThen, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:\n\nIf a_i = 1, he painted the region satisfying x < x_i within the rectangle.\n\nIf a_i = 2, he painted the region satisfying x > x_i within the rectangle.\n\nIf a_i = 3, he painted the region satisfying y < y_i within the rectangle.\n\nIf a_i = 4, he painted the region satisfying y > y_i within the rectangle.\n\nFind the area of the white region within the rectangle after he finished painting.\n\nConstraints\n\n1 ≦ W, H ≦ 100\n\n1 ≦ N ≦ 100\n\n0 ≦ x_i ≦ W (1 ≦ i ≦ N)\n\n0 ≦ y_i ≦ H (1 ≦ i ≦ N)\n\nW, H (21:32, added), x_i and y_i are integers.\n\na_i (1 ≦ i ≦ N) is 1, 2, 3 or 4.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nW H N\nx_1 y_1 a_1\nx_2 y_2 a_2\n:\nx_N y_N a_N\n\nOutput\n\nPrint the area of the white region within the rectangle after Snuke finished painting.\n\nSample Input 1\n\n5 4 2\n2 1 1\n3 3 4\n\nSample Output 1\n\n9\n\nThe figure below shows the rectangle before Snuke starts painting.\n\nFirst, as (x_1, y_1) = (2, 1) and a_1 = 1, he paints the region satisfying x < 2 within the rectangle:\n\nThen, as (x_2, y_2) = (3, 3) and a_2 = 4, he paints the region satisfying y > 3 within the rectangle:\n\nNow, the area of the white region within the rectangle is 9.\n\nSample Input 2\n\n5 4 3\n2 1 1\n3 3 4\n1 4 2\n\nSample Output 2\n\n0\n\nIt is possible that the whole region within the rectangle is painted black.\n\nSample Input 3\n\n10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n\nSample Output 3\n\n64", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1160, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s638241636", "group_id": "codeNet:p03947", "input_text": "var\n s : string;\n cnt,i : longint;\nbegin\n read(s);\n for i := 1 to length(s)-1 do\n begin\n if s[i] <> s[i+1] then\n cnt := cnt + 1;\n end;\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596664540, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s638241636.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s638241636", "user_id": "u018679195"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var\n s : string;\n cnt,i : longint;\nbegin\n read(s);\n for i := 1 to length(s)-1 do\n begin\n if s[i] <> s[i+1] then\n cnt := cnt + 1;\n end;\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 193, "cpu_time_ms": 5, "memory_kb": 1368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s171829560", "group_id": "codeNet:p03947", "input_text": "var s:ansistring;\n i,j,cnt:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n while (b=false) do begin\n b:=true;\n for i:=1 to length(s) do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='W';\n end\n else begin\n insert('B',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='B';\n end;\n end\n else break;\n end;\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596663400, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s171829560.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s171829560", "user_id": "u018679195"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s:ansistring;\n i,j,cnt:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n while (b=false) do begin\n b:=true;\n for i:=1 to length(s) do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='W';\n end\n else begin\n insert('B',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='B';\n end;\n end\n else break;\n end;\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 560, "cpu_time_ms": 2205, "memory_kb": 1380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s946848420", "group_id": "codeNet:p03947", "input_text": "var s:ansistring;\n i,j,cnt,k:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n k:=2;\n while (b=false) do begin\n //writeln(s);\n b:=true;\n for i:=length(s) downto k do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n for i:=1 to length(s) do begin\n if (s[1]<>s[i]) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='W';\n k:=i;\n //writeln(s);\n break;\n end\n else begin\n insert('B',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='B';\n k:=i;\n //writeln(s);\n break;\n end;\n end;\n end;\n end\n else break;\n end;\n writeln(cnt);\nend.", "language": "Pascal", "metadata": {"date": 1596660201, "filename_ext": "pas", "original_language": "Pascal (FPC 3.0.4)", "problem_description_relpath": "problem_descriptions/p03947.html", "problem_id": "p03947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03947/input.txt", "sample_output_relpath": "derived/input_output/data/p03947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03947/Pascal/s946848420.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s946848420", "user_id": "u863370423"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "var s:ansistring;\n i,j,cnt,k:longint;\n b:boolean;\nbegin\n readln(s);\n cnt:=0;\n b:=false;\n k:=2;\n while (b=false) do begin\n //writeln(s);\n b:=true;\n for i:=length(s) downto k do begin\n if (s[1]<>s[i]) then begin\n b:=false;\n break;\n end;\n end;\n if (b=false) then begin\n for i:=1 to length(s) do begin\n if (s[1]<>s[i]) then begin\n if s[i]='W' then begin\n insert('W',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='W';\n k:=i;\n //writeln(s);\n break;\n end\n else begin\n insert('B',s,1);\n inc(cnt);\n for j:=2 to i do s[j]:='B';\n k:=i;\n //writeln(s);\n break;\n end;\n end;\n end;\n end\n else break;\n end;\n writeln(cnt);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "sample_input": "BBBWW\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03947", "source_text": "Score : 300 points\n\nProblem Statement\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.\n\nIn the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S. There are |S| (the length of S) stones on the board, and each character in S represents the color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in S is B, it means that the color of the corresponding stone on the board is black. Similarly, if the i-th character in S is W, it means that the color of the corresponding stone is white.\n\nJiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.\n\nConstraints\n\n1 ≦ |S| ≦ 10^5\n\nEach character in S is B or W.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of new stones that Jiro needs to place for his purpose.\n\nSample Input 1\n\nBBBWW\n\nSample Output 1\n\n1\n\nBy placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\nSample Input 2\n\nWWWWWW\n\nSample Output 2\n\n0\n\nIf all stones are already of the same color, no new stone is necessary.\n\nSample Input 3\n\nWBWBWBWBWB\n\nSample Output 3\n\n9", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 854, "cpu_time_ms": 2205, "memory_kb": 1308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s887705124", "group_id": "codeNet:p03948", "input_text": "var\n\tn,a,m,p,i,s:Longint;\nbegin\n\treadln(n);\n\tm:=1000000000;\n\tfor i:=1 to n do begin\n\t\tread(a);\n\t\tif a 0) and (pos('F',s) <> 0) then writeln('Yes')\n\telse writeln('No');\nend.", "language": "Pascal", "metadata": {"date": 1477285696, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Pascal/s952967852.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s952967852", "user_id": "u927369338"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "var\n\ts : ansistring;\nbegin\n\treadln(s);\n\tif (pos('C',s) < pos('F',s)) and (pos('C',s) <> 0) and (pos('F',s) <> 0) then writeln('Yes')\n\telse writeln('No');\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s210458111", "group_id": "codeNet:p03963", "input_text": "var n,k,s,i:Longint;begin read(n,k);s:=k;for i:=2 to n do s:=s*(k-1);write(s)end.", "language": "Pascal", "metadata": {"date": 1537921487, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03963.html", "problem_id": "p03963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03963/input.txt", "sample_output_relpath": "derived/input_output/data/p03963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03963/Pascal/s210458111.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s210458111", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var n,k,s,i:Longint;begin read(n,k);s:=k;for i:=2 to n do s:=s*(k-1);write(s)end.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N balls placed in a row.\nAtCoDeer the deer is painting each of these in one of the K colors of his paint cans.\nFor aesthetic reasons, any two adjacent balls must be painted in different colors.\n\nFind the number of the possible ways to paint the balls.\n\nConstraints\n\n1≦N≦1000\n\n2≦K≦1000\n\nThe correct answer is at most 2^{31}-1.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of the possible ways to paint the balls.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nWe will denote the colors by 0 and 1. There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1, or paint the left in color 1 and the right in color 0.\n\nSample Input 2\n\n1 10\n\nSample Output 2\n\n10\n\nSince there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.", "sample_input": "2 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03963", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N balls placed in a row.\nAtCoDeer the deer is painting each of these in one of the K colors of his paint cans.\nFor aesthetic reasons, any two adjacent balls must be painted in different colors.\n\nFind the number of the possible ways to paint the balls.\n\nConstraints\n\n1≦N≦1000\n\n2≦K≦1000\n\nThe correct answer is at most 2^{31}-1.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of the possible ways to paint the balls.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nWe will denote the colors by 0 and 1. There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1, or paint the left in color 1 and the right in color 0.\n\nSample Input 2\n\n1 10\n\nSample Output 2\n\n10\n\nSince there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 81, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s212549567", "group_id": "codeNet:p03965", "input_text": "var\n i,x,y,t:longint;\n s:ansistring;\nbegin\n readln(s);\n x:=0;y:=0;t:=0;\n for i:=1 to length(s) do\n if x=y then\n begin\n x:=x+1;\n if s[i]='p' then t:=t-1;\n end\n else\n begin\n y:=y+1;\n if s[i]='g' then t:=t+1;\n end;\n writeln(t);\nend.", "language": "Pascal", "metadata": {"date": 1555984199, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s212549567.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s212549567", "user_id": "u426964396"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i,x,y,t:longint;\n s:ansistring;\nbegin\n readln(s);\n x:=0;y:=0;t:=0;\n for i:=1 to length(s) do\n if x=y then\n begin\n x:=x+1;\n if s[i]='p' then t:=t-1;\n end\n else\n begin\n y:=y+1;\n if s[i]='g' then t:=t+1;\n end;\n writeln(t);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s189157349", "group_id": "codeNet:p03965", "input_text": "var\n ans,x,y,i:longint;\n s:string;\nbegin\n readln(s);\n for i:=1 to length(s) do\n begin\n if x=y then\n begin\n inc(x);\n if s[i]='p' then dec(ans);\n end\n else\n begin\n inc(y);\n if s[i]='g' then inc(ans);\n end;\n end;\n writeln(ans);\nend.\n", "language": "Pascal", "metadata": {"date": 1552352807, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s189157349.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s189157349", "user_id": "u476418095"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n ans,x,y,i:longint;\n s:string;\nbegin\n readln(s);\n for i:=1 to length(s) do\n begin\n if x=y then\n begin\n inc(x);\n if s[i]='p' then dec(ans);\n end\n else\n begin\n inc(y);\n if s[i]='g' then inc(ans);\n end;\n end;\n writeln(ans);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 461, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s944203270", "group_id": "codeNet:p03965", "input_text": "var s:ansistring;\ni,y,ans:longint;\nbegin\nreadln(s);\nfor i:=1 to length(s) do\n if s[i]='g' then\n begin\n if y>0 then\n begin\n inc(ans);inc(y);\n end\n else\n begin\n y:=y+1;\n dec(ans);\n end;\n end\n else\n begin\n if y>0 then y:=y-1\n else\n begin\n inc(y);\n dec(ans);\n end;\n end;\nwriteln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1540331369, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s944203270.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s944203270", "user_id": "u263933075"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var s:ansistring;\ni,y,ans:longint;\nbegin\nreadln(s);\nfor i:=1 to length(s) do\n if s[i]='g' then\n begin\n if y>0 then\n begin\n inc(ans);inc(y);\n end\n else\n begin\n y:=y+1;\n dec(ans);\n end;\n end\n else\n begin\n if y>0 then y:=y-1\n else\n begin\n inc(y);\n dec(ans);\n end;\n end;\nwriteln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 366, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s763500204", "group_id": "codeNet:p03965", "input_text": "var\n s:ansistring;\n i,a,b,ans:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if a=b then begin inc(a);if s[i]='p' then dec(ans);end\n else begin inc(b);if s[i]='g' then inc(ans);end;\n writeln(ans);\nend.", "language": "Pascal", "metadata": {"date": 1539301641, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s763500204.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s763500204", "user_id": "u426964396"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n s:ansistring;\n i,a,b,ans:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n if a=b then begin inc(a);if s[i]='p' then dec(ans);end\n else begin inc(b);if s[i]='g' then inc(ans);end;\n writeln(ans);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s383841957", "group_id": "codeNet:p03965", "input_text": "begin\nwrite('1');\nend.", "language": "Pascal", "metadata": {"date": 1528554441, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03965.html", "problem_id": "p03965", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03965/input.txt", "sample_output_relpath": "derived/input_output/data/p03965/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03965/Pascal/s383841957.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s383841957", "user_id": "u723721005"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "begin\nwrite('1');\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03965", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 22, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s792799244", "group_id": "codeNet:p03966", "input_text": "var\n\tn,i,x,y:Integer;\n\ta,b,c,d:int64;\nbegin\n\tread(n);\n\ta:=1;\n\tb:=1;\n\tfor i:=1 to n do begin\n\t\tread(x,y);\n\t\tc:=(a-1)div x+1;\n\t\td:=(b-1)div y+1;\n\t\tif c0) do begin\n dec(n); readln(p,q); tmp:=-a*q+b*p;\n exgcd(q,p,x,y);\n tmp1:=(x mod p+p) mod p; tmp2:=y+(x-tmp1) div p*q;\n if (tmp2>0) then begin\n tmp3:=tmp2 mod q-q;\n x:=tmp1-(tmp3-tmp2) div q*p;\n y:=tmp3;\n end else begin x:=tmp1; y:=tmp2; end;\n a:=a+x; b:=b-y;\n end;\n writeln(a+b);\nend.\n", "language": "Pascal", "metadata": {"date": 1476581906, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03966.html", "problem_id": "p03966", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03966/input.txt", "sample_output_relpath": "derived/input_output/data/p03966/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03966/Pascal/s883917703.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s883917703", "user_id": "u021294378"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var n,a,b,x,y,p,q,tmp,tmp1,tmp2,tmp3:int64;\nfunction gcd(a,b:int64):int64; begin if b=0 then exit(a); exit(gcd(b,a mod b)); end;\nprocedure exgcd(a,b:int64; var x,y:int64);\n var t:int64;\n begin\n if b=0 then begin\n x:=tmp; y:=0; exit;\n end;\n exgcd(b,a mod b,x,y);\n t:=x; x:=y; y:=t-a div b*y;\n end;\nbegin\n readln(n); a:=1; b:=1;\n while (n>0) do begin\n dec(n); readln(p,q); tmp:=-a*q+b*p;\n exgcd(q,p,x,y);\n tmp1:=(x mod p+p) mod p; tmp2:=y+(x-tmp1) div p*q;\n if (tmp2>0) then begin\n tmp3:=tmp2 mod q-q;\n x:=tmp1-(tmp3-tmp2) div q*p;\n y:=tmp3;\n end else begin x:=tmp1; y:=tmp2; end;\n a:=a+x; b:=b-y;\n end;\n writeln(a+b);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "sample_input": "3\n2 3\n1 1\n3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03966", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 679, "cpu_time_ms": 1, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s652267809", "group_id": "codeNet:p03966", "input_text": "var n,a,b,x,y,p,q,tmp,tmp1,tmp2:int64;\nfunction gcd(a,b:int64):int64; begin if b=0 then exit(a); exit(gcd(b,a mod b)); end;\nprocedure exgcd(a,b:int64; var x,y:int64);\n var t:int64;\n begin\n if b=0 then begin\n x:=tmp; y:=0; exit;\n end;\n exgcd(b,a mod b,x,y);\n t:=x; x:=y; y:=t-a div b*y;\n end;\nbegin\n readln(n); a:=1; b:=1;\n while (n>0) do begin\n dec(n); readln(p,q); tmp:=-a*q+b*p;\n exgcd(q,p,x,y);//writeln(x,' ',y);\n while (x-p>=0) do begin dec(x,p); inc(y,q); end;\n while (x<0) do begin inc(x,p); dec(y,q); end;\n while (y>0) do begin inc(x,p); dec(y,q); end;\n a:=a+x; b:=b-y;\n end;\n writeln(a+b);\nend.\n", "language": "Pascal", "metadata": {"date": 1476581373, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03966.html", "problem_id": "p03966", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03966/input.txt", "sample_output_relpath": "derived/input_output/data/p03966/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03966/Pascal/s652267809.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s652267809", "user_id": "u021294378"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "var n,a,b,x,y,p,q,tmp,tmp1,tmp2:int64;\nfunction gcd(a,b:int64):int64; begin if b=0 then exit(a); exit(gcd(b,a mod b)); end;\nprocedure exgcd(a,b:int64; var x,y:int64);\n var t:int64;\n begin\n if b=0 then begin\n x:=tmp; y:=0; exit;\n end;\n exgcd(b,a mod b,x,y);\n t:=x; x:=y; y:=t-a div b*y;\n end;\nbegin\n readln(n); a:=1; b:=1;\n while (n>0) do begin\n dec(n); readln(p,q); tmp:=-a*q+b*p;\n exgcd(q,p,x,y);//writeln(x,' ',y);\n while (x-p>=0) do begin dec(x,p); inc(y,q); end;\n while (x<0) do begin inc(x,p); dec(y,q); end;\n while (y>0) do begin inc(x,p); dec(y,q); end;\n a:=a+x; b:=b-y;\n end;\n writeln(a+b);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "sample_input": "3\n2 3\n1 1\n3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03966", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have obtained, but not the actual numbers of votes.\nAtCoDeer has checked the report N times, and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i.\nIt is known that each candidate had at least one vote when he checked the report for the first time.\n\nFind the minimum possible total number of votes obtained by the two candidates when he checked the report for the N-th time.\nIt can be assumed that the number of votes obtained by each candidate never decreases.\n\nConstraints\n\n1≦N≦1000\n\n1≦T_i,A_i≦1000 (1≦i≦N)\n\nT_i and A_i (1≦i≦N) are coprime.\n\nIt is guaranteed that the correct answer is at most 10^{18}.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 A_1\nT_2 A_2\n:\nT_N A_N\n\nOutput\n\nPrint the minimum possible total number of votes obtained by Takahashi and Aoki when AtCoDeer checked the report for the N-th time.\n\nSample Input 1\n\n3\n2 3\n1 1\n3 2\n\nSample Output 1\n\n10\n\nWhen the numbers of votes obtained by the two candidates change as 2,3 → 3,3 → 6,4, the total number of votes at the end is 10, which is the minimum possible number.\n\nSample Input 2\n\n4\n1 1\n1 1\n1 5\n1 100\n\nSample Output 2\n\n101\n\nIt is possible that neither candidate obtained a vote between the moment when he checked the report, and the moment when he checked it for the next time.\n\nSample Input 3\n\n5\n3 10\n48 17\n31 199\n231 23\n3 2\n\nSample Output 3\n\n6930", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 646, "cpu_time_ms": 2102, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s179898052", "group_id": "codeNet:p03967", "input_text": "var\n\ti,t:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=1 to length(s)do inc(t,ord(s[i])mod 11-3);\n\tif t>=0 then writeln(t div 2)else writeln((t-1)div 2);\nend.\n", "language": "Pascal", "metadata": {"date": 1539076366, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03967.html", "problem_id": "p03967", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03967/input.txt", "sample_output_relpath": "derived/input_output/data/p03967/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03967/Pascal/s179898052.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s179898052", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n\ti,t:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=1 to length(s)do inc(t,ord(s[i])mod 11-3);\n\tif t>=0 then writeln(t div 2)else writeln((t-1)div 2);\nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03967", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s325009464", "group_id": "codeNet:p03967", "input_text": "var\n i, g, p: integer;\n s: string;\nbegin\n readln(s);\n for i := 1 to length(s) do\n begin\n if s[i] = 'g' then\n g := g + 1;\n if s[i] = 'p' then\n p := p + 1;\n end;\n \n if p < g then\n writeln((g - p) div 2)\n else\n writeln(0);\nend.", "language": "Pascal", "metadata": {"date": 1516875406, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03967.html", "problem_id": "p03967", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03967/input.txt", "sample_output_relpath": "derived/input_output/data/p03967/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03967/Pascal/s325009464.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s325009464", "user_id": "u598016178"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "var\n i, g, p: integer;\n s: string;\nbegin\n readln(s);\n for i := 1 to length(s) do\n begin\n if s[i] = 'g' then\n g := g + 1;\n if s[i] = 'p' then\n p := p + 1;\n end;\n \n if p < g then\n writeln((g - p) div 2)\n else\n writeln(0);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03967", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s317248094", "group_id": "codeNet:p03967", "input_text": "const maxn = 100050;\nvar n,i,now,ans:longint;\n st:ansistring;\n f:array[0..maxn] of longint;\nbegin\n readln(st); n:=length(st); now:=0; ans:=0;\n for i:=1 to n do begin\n if st[i]='g' then begin\n if (now+1)<=(i>>1) then begin inc(now); inc(ans); end;\n continue;\n end;\n if (now+1)<=(i>>1) then inc(now) else dec(ans);\n end;\n writeln(ans); \nend.\n", "language": "Pascal", "metadata": {"date": 1476583206, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03967.html", "problem_id": "p03967", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03967/input.txt", "sample_output_relpath": "derived/input_output/data/p03967/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03967/Pascal/s317248094.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s317248094", "user_id": "u021294378"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "const maxn = 100050;\nvar n,i,now,ans:longint;\n st:ansistring;\n f:array[0..maxn] of longint;\nbegin\n readln(st); n:=length(st); now:=0; ans:=0;\n for i:=1 to n do begin\n if st[i]='g' then begin\n if (now+1)<=(i>>1) then begin inc(now); inc(ans); end;\n continue;\n end;\n if (now+1)<=(i>>1) then inc(now) else dec(ans);\n end;\n writeln(ans); \nend.\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "sample_input": "gpg\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03967", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following condition:\n\n(※) After each turn, (the number of times the player has played Paper)≦(the number of times the player has played Rock).\n\nEach player's score is calculated by (the number of turns where the player wins) - (the number of turns where the player loses), where the outcome of each turn is determined by the rules of Rock-paper-scissors.\n\n(For those who are not familiar with Rock-paper-scissors: If one player plays Rock and the other plays Paper, the latter player will win and the former player will lose. If both players play the same gesture, the round is a tie and neither player will win nor lose.)\n\nWith his supernatural power, AtCoDeer was able to foresee the gesture that TopCoDeer will play in each of the N turns, before the game starts.\nPlan AtCoDeer's gesture in each turn to maximize AtCoDeer's score.\n\nThe gesture that TopCoDeer will play in each turn is given by a string s. If the i-th (1≦i≦N) character in s is g, TopCoDeer will play Rock in the i-th turn. Similarly, if the i-th (1≦i≦N) character of s in p, TopCoDeer will play Paper in the i-th turn.\n\nConstraints\n\n1≦N≦10^5\n\nN=|s|\n\nEach character in s is g or p.\n\nThe gestures represented by s satisfy the condition (※).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the AtCoDeer's maximum possible score.\n\nSample Input 1\n\ngpg\n\nSample Output 1\n\n0\n\nPlaying the same gesture as the opponent in each turn results in the score of 0, which is the maximum possible score.\n\nSample Input 2\n\nggppgggpgg\n\nSample Output 2\n\n2\n\nFor example, consider playing gestures in the following order: Rock, Paper, Rock, Paper, Rock, Rock, Paper, Paper, Rock, Paper. This strategy earns three victories and suffers one defeat, resulting in the score of 2, which is the maximum possible score.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s157914687", "group_id": "codeNet:p03971", "input_text": "var n,a,b,i:Longint;\ns:String;\nbegin\nreadln(n,a,b);\nreadln(s);\nfor i:=1 to n do begin\nif s[i]='a'then begin\nif a>0 then begin dec(a);writeln('Yes');end\nelse if b>0 then begin dec(b);writeln('Yes');end\nelse writeln('No');\nend else if s[i]='b'then begin\nif b>0 then begin dec(b);writeln('Yes');end\nelse writeln('No');\nend else writeln('No');\nend;\nend.", "language": "Pascal", "metadata": {"date": 1581662491, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03971.html", "problem_id": "p03971", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03971/input.txt", "sample_output_relpath": "derived/input_output/data/p03971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03971/Pascal/s157914687.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s157914687", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "var n,a,b,i:Longint;\ns:String;\nbegin\nreadln(n,a,b);\nreadln(s);\nfor i:=1 to n do begin\nif s[i]='a'then begin\nif a>0 then begin dec(a);writeln('Yes');end\nelse if b>0 then begin dec(b);writeln('Yes');end\nelse writeln('No');\nend else if s[i]='b'then begin\nif b>0 then begin dec(b);writeln('Yes');end\nelse writeln('No');\nend else writeln('No');\nend;\nend.", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "sample_input": "10 2 3\nabccabaabb\n"}, "reference_outputs": ["Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n"], "source_document_id": "p03971", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 349, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s584349623", "group_id": "codeNet:p03974", "input_text": " {$mode objfpc}\n {$coperators on}\nprogram Lexicographical_disorder________________________CODE_FESTIVAL_2016_qual_B____________________________________________________________;\nconst\n fi = 'lex.inp';\n fo = 'lex.out';\n sz=round(1e5)+100;\ntype\n Tnode = ^node;\n node =\n record\n c:array['_'..'z'] of Tnode;\n cnt:longint;\n end;\nvar\n n,q,kth:longint;\n a:array[1..sz]of ansistring;\n s:string;\n nod,root:Tnode;\n count:array[0..sz,'_'..'z','_'..'z']of longint;\n\n\nfunction min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;\nfunction max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;\nprocedure spaw(var nod:Tnode);\nvar i:char;\n begin\n new(nod);\n nod^.cnt:=0;\n for i:='_' to 'z' do nod^.c[i]:=nil;\n end;\n\nprocedure enter;\nvar i : integer;\n begin\n readln(n);\n for i:=1 to n do\n begin\n readln(a[i]);\n a[i]:=a[i]+'_';\n end;\n readln(q);\n end;\nprocedure update(const a:ansistring);\nvar ch,rr:char;\n i:longint;\n begin\n nod:=root;\n for i:=1 to length(a) do\n begin\n ch:=a[i];\n if nod^.c[ch]=nil then spaw(nod^.c[ch]);\n nod := nod^.c[ch];\n inc(nod^.cnt);\n end;\n end;\nprocedure updateElement(p:longint);\nvar i:longint;\n ch,rr:char;\n begin\n nod:=root;\n for i:=1 to length(a[p]) do\n begin\n ch:=a[p][i];\n for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then\n count[p][ch][rr] += nod^.c[rr]^.cnt;\n nod:=nod^.c[ch];\n end;\n end;\nprocedure Build();\nvar i:longint;\n begin\n spaw(root);\n for i:=1 to n do\n begin\n update(a[i]);\n end;\n for i:=1 to n do\n begin\n updateElement(i);\n end;\n end;\nprocedure doQuerry;\nvar i,j:longint;\n ans:longint;\n begin\n ans:=0;\n for i:=1 to 26 do\n for j:=1 to i-1 do ans += count[kth,s[i],s[j]];\n for i:=1 to 26 do ans += count[kth,s[i],'_'];\n ans+=1;\n writeln(ans);\n end;\nprocedure solve;\nvar i: integer;\n begin\n Build();\n for i:=1 to q do\n begin\n read(kth);\n readln(s); delete(s,1,1);\n doQuerry;\n end;\n end;\nprocedure print();\nvar i:longint;\n begin\n end;\nbegin\n enter(); solve(); print();\nend.\n", "language": "Pascal", "metadata": {"date": 1479873549, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03974.html", "problem_id": "p03974", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03974/input.txt", "sample_output_relpath": "derived/input_output/data/p03974/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03974/Pascal/s584349623.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584349623", "user_id": "u196616044"}, "prompt_components": {"gold_output": "1\n2\n5\n4\n2\n", "input_to_evaluate": " {$mode objfpc}\n {$coperators on}\nprogram Lexicographical_disorder________________________CODE_FESTIVAL_2016_qual_B____________________________________________________________;\nconst\n fi = 'lex.inp';\n fo = 'lex.out';\n sz=round(1e5)+100;\ntype\n Tnode = ^node;\n node =\n record\n c:array['_'..'z'] of Tnode;\n cnt:longint;\n end;\nvar\n n,q,kth:longint;\n a:array[1..sz]of ansistring;\n s:string;\n nod,root:Tnode;\n count:array[0..sz,'_'..'z','_'..'z']of longint;\n\n\nfunction min(const x,y:longint):longint; begin if x<=y then exit(x) else exit(y); end;\nfunction max(const x,y:longint):longint; begin if x>=y then exit(x) else exit(y); end;\nprocedure spaw(var nod:Tnode);\nvar i:char;\n begin\n new(nod);\n nod^.cnt:=0;\n for i:='_' to 'z' do nod^.c[i]:=nil;\n end;\n\nprocedure enter;\nvar i : integer;\n begin\n readln(n);\n for i:=1 to n do\n begin\n readln(a[i]);\n a[i]:=a[i]+'_';\n end;\n readln(q);\n end;\nprocedure update(const a:ansistring);\nvar ch,rr:char;\n i:longint;\n begin\n nod:=root;\n for i:=1 to length(a) do\n begin\n ch:=a[i];\n if nod^.c[ch]=nil then spaw(nod^.c[ch]);\n nod := nod^.c[ch];\n inc(nod^.cnt);\n end;\n end;\nprocedure updateElement(p:longint);\nvar i:longint;\n ch,rr:char;\n begin\n nod:=root;\n for i:=1 to length(a[p]) do\n begin\n ch:=a[p][i];\n for rr:='_' to 'z' do if (rr<>ch)and(nod^.c[rr]<>nil) then\n count[p][ch][rr] += nod^.c[rr]^.cnt;\n nod:=nod^.c[ch];\n end;\n end;\nprocedure Build();\nvar i:longint;\n begin\n spaw(root);\n for i:=1 to n do\n begin\n update(a[i]);\n end;\n for i:=1 to n do\n begin\n updateElement(i);\n end;\n end;\nprocedure doQuerry;\nvar i,j:longint;\n ans:longint;\n begin\n ans:=0;\n for i:=1 to 26 do\n for j:=1 to i-1 do ans += count[kth,s[i],s[j]];\n for i:=1 to 26 do ans += count[kth,s[i],'_'];\n ans+=1;\n writeln(ans);\n end;\nprocedure solve;\nvar i: integer;\n begin\n Build();\n for i:=1 to q do\n begin\n read(kth);\n readln(s); delete(s,1,1);\n doQuerry;\n end;\n end;\nprocedure print();\nvar i:longint;\n begin\n end;\nbegin\n enter(); solve(); print();\nend.\n", "problem_context": "Score : 1100 points\n\nProblem Statement\n\nThere are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.\n\nProvide answers for the Q queries below. The i-th query has the following format:\n\nQuery: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that results from permuting {a,b,...,z} are given. Output the sequence of the string S_{k_i} among the N strings in lexicographical order when the literal sequence is p_{i,1}0 then insert(a[p][s[i,x]],x+1,i) else\n begin\n inc(dem);\n a[p][s[i,x]]:=dem;\n insert(dem,x+1,i);\n end;\nend;\n\nprocedure nhapdl;\nvar\n i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(s[i]);\n s[i]:=s[i]+'@';\n insert(0,1,i);\n end;\nend;\n\nprocedure dfs(p,x,i:longint);\nvar\n j:longint;\nbegin\n if x=length(s[i])+1 then exit;\n for j:=1 to 27 do\n if al[j]=s[i,x] then break else\n begin\n inc(res,c[p,al[j]]);\n end;\n dfs(a[p][s[i,x]],x+1,i);\nend;\n\nprocedure xuli;\nvar\n o,i,j,x:longint;\n blank:char;\nbegin\n readln(q);\n for o:=1 to q do\n begin\n readln(x,blank,al);\n al:='@'+al;\n\n res:=0;\n dfs(0,1,x);\n\n writeln(res+1);\n end;\nend;\n\nbegin\n //mofile;\n nhapdl;\n xuli;\n dongfile;\nend.\n\n\n\n\n\n\n\n\n\n\n\n\n", "language": "Pascal", "metadata": {"date": 1479847845, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03974.html", "problem_id": "p03974", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03974/input.txt", "sample_output_relpath": "derived/input_output/data/p03974/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03974/Pascal/s267954725.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s267954725", "user_id": "u662875859"}, "prompt_components": {"gold_output": "1\n2\n5\n4\n2\n", "input_to_evaluate": "uses math;\n\nprocedure mofile;\nbegin\n {$IFDEF ONLINE_JUDGE}\n assign(input,'');\n reset(input);\n assign(output,'');\n rewrite(output);\n {$ELSE}\n assign(input,'checking.inp');\n reset(input);\n assign(output,'');\n rewrite(output);\n {$ENDIF}\nend;\n\nprocedure dongfile;\nbegin\n close(input);\n close(output);\nend;\n\nconst\n maxc=1000000000+69;\n modulo=1000000000+7;\n maxn=400000+10;\n\ntype\n re=record\n x,y:longint;\n end;\n\nvar\n n,q,dem,res:longint;\n s:array[0..maxn] of ansistring;\n a,c:array[0..maxn*4,'@'..'z'] of longint;\n al:ansistring;\n\nprocedure insert(p,x,i:longint);\nbegin\n if x=length(s[i])+1 then exit;\n inc(c[p][s[i,x]]);\n if a[p][s[i,x]]>0 then insert(a[p][s[i,x]],x+1,i) else\n begin\n inc(dem);\n a[p][s[i,x]]:=dem;\n insert(dem,x+1,i);\n end;\nend;\n\nprocedure nhapdl;\nvar\n i:longint;\nbegin\n readln(n);\n for i:=1 to n do\n begin\n readln(s[i]);\n s[i]:=s[i]+'@';\n insert(0,1,i);\n end;\nend;\n\nprocedure dfs(p,x,i:longint);\nvar\n j:longint;\nbegin\n if x=length(s[i])+1 then exit;\n for j:=1 to 27 do\n if al[j]=s[i,x] then break else\n begin\n inc(res,c[p,al[j]]);\n end;\n dfs(a[p][s[i,x]],x+1,i);\nend;\n\nprocedure xuli;\nvar\n o,i,j,x:longint;\n blank:char;\nbegin\n readln(q);\n for o:=1 to q do\n begin\n readln(x,blank,al);\n al:='@'+al;\n\n res:=0;\n dfs(0,1,x);\n\n writeln(res+1);\n end;\nend;\n\nbegin\n //mofile;\n nhapdl;\n xuli;\n dongfile;\nend.\n\n\n\n\n\n\n\n\n\n\n\n\n", "problem_context": "Score : 1100 points\n\nProblem Statement\n\nThere are N strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.\n\nProvide answers for the Q queries below. The i-th query has the following format:\n\nQuery: An integer k_i and a string p_{i,1}p_{i,2}...p_{i,26} that results from permuting {a,b,...,z} are given. Output the sequence of the string S_{k_i} among the N strings in lexicographical order when the literal sequence is p_{i,1}0)and(st[i]='T') then\n begin\n dec(s1);\n s2:=s2+2;\n end;\n end;\n writeln(length(st)-s2);\nend.", "language": "Pascal", "metadata": {"date": 1583531072, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s701310367.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s701310367", "user_id": "u476418095"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n st:ansistring;\n i,s1,s2:longint;\nbegin\n readln(st);\n for i:=1 to length(st) do\n begin\n if st[i]='S' then inc(s1);\n if (s1>0)and(st[i]='T') then\n begin\n dec(s1);\n s2:=s2+2;\n end;\n end;\n writeln(length(st)-s2);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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:s048715324", "group_id": "codeNet:p03986", "input_text": "var\ni,t,x:longint;\ns:ansistring;\nbegin\nreadln(s);\nt:=length(s);\nx:=0;\nfor i:=1 to length(s) do\n if s[i]='S' then inc(x)\n else if x>=1 then\n begin\n x:=x-1;\n t:=t-2;\n end;\nwriteln(t);\nend.", "language": "Pascal", "metadata": {"date": 1583463911, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s048715324.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s048715324", "user_id": "u723721005"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\ni,t,x:longint;\ns:ansistring;\nbegin\nreadln(s);\nt:=length(s);\nx:=0;\nfor i:=1 to length(s) do\n if s[i]='S' then inc(x)\n else if x>=1 then\n begin\n x:=x-1;\n t:=t-2;\n end;\nwriteln(t);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 214, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s407138401", "group_id": "codeNet:p03986", "input_text": "var\ni,t,x:longint;\ns:ansistring;\nbegin\nreadln(s);\nt:=length(s);\nx:=0;\nfor i:=1 to length(s) do\n if s[i]='S' then inc(x)\n else\n begin\n x:=x-1;\n t:=t-2;\n end;\nwriteln(t);\nend.", "language": "Pascal", "metadata": {"date": 1583463860, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s407138401.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s407138401", "user_id": "u426964396"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\ni,t,x:longint;\ns:ansistring;\nbegin\nreadln(s);\nt:=length(s);\nx:=0;\nfor i:=1 to length(s) do\n if s[i]='S' then inc(x)\n else\n begin\n x:=x-1;\n t:=t-2;\n end;\nwriteln(t);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s515082559", "group_id": "codeNet:p03986", "input_text": "var\ns:ansistring;\nbegin\nreadln(s);\nwhile pos('ST',s)<>0 do delete(s,pos('ST',s),2);\nwriteln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1583463666, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s515082559.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s515082559", "user_id": "u723721005"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\ns:ansistring;\nbegin\nreadln(s);\nwhile pos('ST',s)<>0 do delete(s,pos('ST',s),2);\nwriteln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s591950340", "group_id": "codeNet:p03986", "input_text": "var s:ansistring;\n i,m,t:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n begin\n if s[i]='S' then inc(m);\n if (m<>0)and(s[i]='T') then\n begin\n dec(m);\n inc(t,2);\n end;\n end;\n writeln(length(s)-t);\nend.", "language": "Pascal", "metadata": {"date": 1581728741, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s591950340.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s591950340", "user_id": "u743614777"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var s:ansistring;\n i,m,t:longint;\nbegin\n readln(s);\n for i:=1 to length(s) do\n begin\n if s[i]='S' then inc(m);\n if (m<>0)and(s[i]='T') then\n begin\n dec(m);\n inc(t,2);\n end;\n end;\n writeln(length(s)-t);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s013511845", "group_id": "codeNet:p03986", "input_text": "var\n s:ansistring;\n k:int64;\nbegin\n readln(s);\n while pos('ST',s)<>0 do\n begin\n k:=pos('ST',s);\n delete(s,k,2);\n end; \n if s<>'' then writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1541954666, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s013511845.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s013511845", "user_id": "u723721005"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n s:ansistring;\n k:int64;\nbegin\n readln(s);\n while pos('ST',s)<>0 do\n begin\n k:=pos('ST',s);\n delete(s,k,2);\n end; \n if s<>'' then writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s648456253", "group_id": "codeNet:p03986", "input_text": "var\n st:ansistring;\nbegin\n readln(st);\n while (pos('ST',st)>0) and (length(st)>0) do delete(st,pos('ST',st),2);\n if length(st)>0 then writeln(length(st));\nend.", "language": "Pascal", "metadata": {"date": 1541091859, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s648456253.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s648456253", "user_id": "u723721005"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n st:ansistring;\nbegin\n readln(st);\n while (pos('ST',st)>0) and (length(st)>0) do delete(st,pos('ST',st),2);\n if length(st)>0 then writeln(length(st));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 163, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s446283221", "group_id": "codeNet:p03986", "input_text": "var\n s:string;\n k:longint;\nbegin\n readln(s);\n while pos('ST',s)<>0 do\n begin\n k:=pos('ST',s);\n delete(s,k,2);\n end; \n if s<>'' then writeln(length(s));\nend.", "language": "Pascal", "metadata": {"date": 1535724232, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s446283221.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s446283221", "user_id": "u476418095"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "var\n s:string;\n k:longint;\nbegin\n readln(s);\n while pos('ST',s)<>0 do\n begin\n k:=pos('ST',s);\n delete(s,k,2);\n end; \n if s<>'' then writeln(length(s));\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 163, "cpu_time_ms": 1055, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s254776680", "group_id": "codeNet:p03986", "input_text": " var\n s,t:ansistring;\n i,m,ans,n:longint;\nbegin\n readln(s);\n n:=length(s);\n m:=0; t:='';\n for i:=1 to n do\n begin\n if(s[i]='T') and (m<>0) and (t[m]='S')then begin delete(t,m,1); dec(m); end\n else begin inc(m); t:=t+s[i]; end;\n end;\n writeln(m);\nend.", "language": "Pascal", "metadata": {"date": 1476986366, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s254776680.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s254776680", "user_id": "u041368761"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": " var\n s,t:ansistring;\n i,m,ans,n:longint;\nbegin\n readln(s);\n n:=length(s);\n m:=0; t:='';\n for i:=1 to n do\n begin\n if(s[i]='T') and (m<>0) and (t[m]='S')then begin delete(t,m,1); dec(m); end\n else begin inc(m); t:=t+s[i]; end;\n end;\n writeln(m);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 327, "cpu_time_ms": 15, "memory_kb": 608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s207780513", "group_id": "codeNet:p03986", "input_text": " var\n s,t:ansistring;\n i,m,ans,n:longint;\nbegin\n readln(s);\n n:=length(s);\n m:=0; t:='';\n for i:=1 to n do\n begin\n if(s[i]='T') and (m<>0) and (t[m]='S')then dec(m)\n else begin inc(m); t:=t+s[i]; end;\n end;\n writeln(m);\nend.", "language": "Pascal", "metadata": {"date": 1476986016, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Pascal/s207780513.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s207780513", "user_id": "u041368761"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": " var\n s,t:ansistring;\n i,m,ans,n:longint;\nbegin\n readln(s);\n n:=length(s);\n m:=0; t:='';\n for i:=1 to n do\n begin\n if(s[i]='T') and (m<>0) and (t[m]='S')then dec(m)\n else begin inc(m); t:=t+s[i]; end;\n end;\n writeln(m);\nend.", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 301, "cpu_time_ms": 13, "memory_kb": 608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s825832358", "group_id": "codeNet:p04006", "input_text": "var f:array[0..2000,0..2000] of int64;\n a:array[1..2000] of int64;\n n,i,j:longint;\n tot,minn,x:int64;\nfunction left(k:longint):longint;\nbegin\n exit(((k-2+n) mod n)+1);\nend;\nfunction min(a,b:int64):int64;\nbegin\n if am) then b[i,j]:='#'\n else b[i,j]:='.';\n for i:=1 to n do\n b[i,1]:='#';\n for i:=1 to n do\n for j:=1 to m do\n if (i mod 2=1) and (j<>1) then c[i,j]:='#'\n else c[i,j]:='.';\n for i:=1 to n do\n c[i,m]:='#';\n for i:=1 to n do\n begin\n for j:=1 to m do\n if a[i,j]='#' then write(a[i,j])\n else write(b[i,j]);\n writeln;\n end;\n writeln;\n for i:=1 to n do\n begin\n for j:=1 to m do\n if a[i,j]='#' then write(a[i,j])\n else write(c[i,j]);\n writeln;\n end;\n end.\n", "language": "Pascal", "metadata": {"date": 1509394265, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04007.html", "problem_id": "p04007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04007/input.txt", "sample_output_relpath": "derived/input_output/data/p04007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04007/Pascal/s874256687.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874256687", "user_id": "u353919145"}, "prompt_components": {"gold_output": ".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n", "input_to_evaluate": "program V802;\n var\n a,b,c:array[0..501,0..501] of char;\n i,j,m,n:longint;\n begin\n readln(n,m);\n for i:=1 to n do\n begin\n for j:=1 to m do\n read(a[i,j]);\n readln;\n end;\n for i:=1 to n do\n for j:=1 to m do\n if (i mod 2=0) and (j<>m) then b[i,j]:='#'\n else b[i,j]:='.';\n for i:=1 to n do\n b[i,1]:='#';\n for i:=1 to n do\n for j:=1 to m do\n if (i mod 2=1) and (j<>1) then c[i,j]:='#'\n else c[i,j]:='.';\n for i:=1 to n do\n c[i,m]:='#';\n for i:=1 to n do\n begin\n for j:=1 to m do\n if a[i,j]='#' then write(a[i,j])\n else write(b[i,j]);\n writeln;\n end;\n writeln;\n for i:=1 to n do\n begin\n for j:=1 to m do\n if a[i,j]='#' then write(a[i,j])\n else write(c[i,j]);\n writeln;\n end;\n end.\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "sample_input": "5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n"}, "reference_outputs": [".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n"], "source_document_id": "p04007", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 835, "cpu_time_ms": 27, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s431686126", "group_id": "codeNet:p04007", "input_text": "program ec12;\nvar \n\tn,m,i,j,tot:longint;\n\tpoint:array[1..2510000,1..2] of longint;\n\tvis:array[1..501,1..501] of longint;\n\ta:array[1..501,1..501] of char;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=point[(l+r) div 2][1];\n\trepeat\n\twhile (point[i][1]v) or ((point[j][1]=v) and (point[j][2]>point[(l+r) div 2][2])) do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=point[i][1];\n\t\tpoint[i][1]:=point[j][1];\n\t\tpoint[j][1]:=s;\n\t\ts:=point[i][2];\n\t\tpoint[i][2]:=point[j][2];\n\t\tpoint[j][2]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l1 then \n\t\tbegin \n\t\t\tif point[i][1]=point[i-1][1] then \n\t\t\tbegin \t\n\t\t\t\tfor j:=point[i-1][2] to point[i][2] do \n\t\t\t\tbegin \n\t\t\t\t\tif vis[point[i][1],j]=0 then \n\t\t\t\t\tvis[point[i][1],j]:=2;\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif point[i][2]=point[i-1][2] then \n\t\t\t\tbegin \n\t\t\t\t\tfor j:=point[i-1][1] to point[i][1] do \n\t\t\t\t\tbegin \t\n\t\t\t\t\t\tif vis[j,point[i][2]]=0 then\n\t\t\t\t\t\tvis[j,point[i][2]]:=2;\n\t\t\t\t\tend;\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tbegin \n\t\t\t\t\tif point[i][2]=1 then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\n\twriteln;\n\tfor i:=1 to n do \n\tbegin \t\n\t\tfor j:=1 to m do\n\t\tbegin \t\n\t\t\tif vis[i,j]<=1 then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1509389347, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04007.html", "problem_id": "p04007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04007/input.txt", "sample_output_relpath": "derived/input_output/data/p04007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04007/Pascal/s431686126.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s431686126", "user_id": "u816631826"}, "prompt_components": {"gold_output": ".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n", "input_to_evaluate": "program ec12;\nvar \n\tn,m,i,j,tot:longint;\n\tpoint:array[1..2510000,1..2] of longint;\n\tvis:array[1..501,1..501] of longint;\n\ta:array[1..501,1..501] of char;\nprocedure qsrt(l,r:longint);\nvar \n\ti,j,v,s:longint;\nbegin \n\ti:=l; j:=r; v:=point[(l+r) div 2][1];\n\trepeat\n\twhile (point[i][1]v) or ((point[j][1]=v) and (point[j][2]>point[(l+r) div 2][2])) do dec(j);\n\tif i<=j then \n\tbegin \n\t\ts:=point[i][1];\n\t\tpoint[i][1]:=point[j][1];\n\t\tpoint[j][1]:=s;\n\t\ts:=point[i][2];\n\t\tpoint[i][2]:=point[j][2];\n\t\tpoint[j][2]:=s;\n\t\tinc(i);\n\t\tdec(j);\n\tend;\n\tuntil i>=j;\n\tif l1 then \n\t\tbegin \n\t\t\tif point[i][1]=point[i-1][1] then \n\t\t\tbegin \t\n\t\t\t\tfor j:=point[i-1][2] to point[i][2] do \n\t\t\t\tbegin \n\t\t\t\t\tif vis[point[i][1],j]=0 then \n\t\t\t\t\tvis[point[i][1],j]:=2;\n\t\t\t\tend;\n\t\t\tend\n\t\t\telse\n\t\t\tbegin \n\t\t\t\tif point[i][2]=point[i-1][2] then \n\t\t\t\tbegin \n\t\t\t\t\tfor j:=point[i-1][1] to point[i][1] do \n\t\t\t\t\tbegin \t\n\t\t\t\t\t\tif vis[j,point[i][2]]=0 then\n\t\t\t\t\t\tvis[j,point[i][2]]:=2;\n\t\t\t\t\tend;\n\t\t\t\tend\n\t\t\t\telse\n\t\t\t\tbegin \n\t\t\t\t\tif point[i][2]=1 then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\n\twriteln;\n\tfor i:=1 to n do \n\tbegin \t\n\t\tfor j:=1 to m do\n\t\tbegin \t\n\t\t\tif vis[i,j]<=1 then \n\t\t\twrite('#')\n\t\t\telse\n\t\t\twrite('.');\n\t\tend;\n\t\twriteln;\n\tend;\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "sample_input": "5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n"}, "reference_outputs": [".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n"], "source_document_id": "p04007", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2414, "cpu_time_ms": 29, "memory_kb": 7040}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s966717174", "group_id": "codeNet:p04007", "input_text": "const mo=1000000007;\nvar\n\tn,m,i,j:longint;\n\tf:Array[0..600,0..600]of char;\nbegin\n\treadln(n,m);\n\tfor i:=0 to n-1 do\n\tbegin\n\t\tfor j:=0 to m-1 do read(f[i,j]);\n\t\treadln;\n\tend;\n\tfor i:=0 to n-1 do\n\tbegin\n\t\tfor j:=0 to m-1 do\n\t\tbegin\n\t\t\tif j=0 then write('.')\n\t\t\telse if i and 1=0 then write('#')\n\t\t\telse if (i and 1<>0)and(j=m-1)then write('#')\n\t\t\telse if f[i,j]='#' then write('#')\n\t\t\telse write('.');\n\t\tend;\n\t\twriteln;\n\tend;\n\twriteln;\n\tfor i:=0 to n-1 do\n\tbegin\n\t\tfor j:=0 to m-1 do\n\t\tbegin\n\t\t\tif j=m-1 then write('.')\n\t\t\telse if i and 1<>0 then write('#')\n\t\t\telse if (i and 1=0)and(j=0)then write('#')\n\t\t\telse if f[i,j]='#' then write('#')\n\t\t\telse write('.');\n\t\tend;\n\t\twriteln;\n\tend;\nend.", "language": "Pascal", "metadata": {"date": 1482079044, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04007.html", "problem_id": "p04007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04007/input.txt", "sample_output_relpath": "derived/input_output/data/p04007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04007/Pascal/s966717174.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s966717174", "user_id": "u040677949"}, "prompt_components": {"gold_output": ".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n", "input_to_evaluate": "const mo=1000000007;\nvar\n\tn,m,i,j:longint;\n\tf:Array[0..600,0..600]of char;\nbegin\n\treadln(n,m);\n\tfor i:=0 to n-1 do\n\tbegin\n\t\tfor j:=0 to m-1 do read(f[i,j]);\n\t\treadln;\n\tend;\n\tfor i:=0 to n-1 do\n\tbegin\n\t\tfor j:=0 to m-1 do\n\t\tbegin\n\t\t\tif j=0 then write('.')\n\t\t\telse if i and 1=0 then write('#')\n\t\t\telse if (i and 1<>0)and(j=m-1)then write('#')\n\t\t\telse if f[i,j]='#' then write('#')\n\t\t\telse write('.');\n\t\tend;\n\t\twriteln;\n\tend;\n\twriteln;\n\tfor i:=0 to n-1 do\n\tbegin\n\t\tfor j:=0 to m-1 do\n\t\tbegin\n\t\t\tif j=m-1 then write('.')\n\t\t\telse if i and 1<>0 then write('#')\n\t\t\telse if (i and 1=0)and(j=0)then write('#')\n\t\t\telse if f[i,j]='#' then write('#')\n\t\t\telse write('.');\n\t\tend;\n\t\twriteln;\n\tend;\nend.", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "sample_input": "5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n"}, "reference_outputs": [".....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n"], "source_document_id": "p04007", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to traverse from any red cell to any other red cell, by moving to vertically or horizontally adjacent red cells only.\n\nCiel painted some of the cells blue in her paper. Here, the cells painted blue were 4-connected.\n\nAfterwards, they precisely overlaid the two sheets in the same direction. Then, the intersection of the red cells and the blue cells appeared purple.\n\nYou are given a matrix of letters a_{ij} (1≤i≤H, 1≤j≤W) that describes the positions of the purple cells. If the cell at the i-th row and j-th column is purple, then a_{ij} is #, otherwise a_{ij} is .. Here, it is guaranteed that no outermost cell is purple. That is, if i=1, H or j = 1, W, then a_{ij} is ..\n\nFind a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation described. It can be shown that a solution always exists.\n\nConstraints\n\n3≤H,W≤500\n\na_{ij} is # or ..\n\nIf i=1,H or j=1,W, then a_{ij} is ..\n\nAt least one of a_{ij} is #.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\na_{11}...a_{1W}\n:\na_{H1}...a_{HW}\n\nOutput\n\nPrint a pair of the set of the positions of the red cells and the blue cells that is consistent with the situation, as follows:\n\nThe first H lines should describe the positions of the red cells.\n\nThe following 1 line should be empty.\n\nThe following H lines should describe the positions of the blue cells.\n\nThe description of the positions of the red or blue cells should follow the format of the description of the positions of the purple cells.\n\nSample Input 1\n\n5 5\n.....\n.#.#.\n.....\n.#.#.\n.....\n\nSample Output 1\n\n.....\n#####\n#....\n#####\n.....\n\n.###.\n.#.#.\n.#.#.\n.#.#.\n.....\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:\n\nSample Input 2\n\n7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#.###.###.\n.............\n\nSample Output 2\n\n.............\n.###########.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.###.###.###.\n.............\n\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n.#.#.#.#.#...\n.#.#########.\n.............\n\nOne possible pair of the set of the positions of the red cells and the blue cells is as follows:", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 687, "cpu_time_ms": 27, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s009961410", "group_id": "codeNet:p04011", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n n,k,x,y:Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n Readln(k);\n Readln(x);\n Readln(y);\n\n Writeln(((n+k-abs(n-k))div 2 * x) + ((n-k+abs(n-k)) div 2 * y));//nとkの最小値*x、n-kと0の最大値*y\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1513895831, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04011.html", "problem_id": "p04011", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04011/input.txt", "sample_output_relpath": "derived/input_output/data/p04011/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04011/Pascal/s009961410.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s009961410", "user_id": "u755925739"}, "prompt_components": {"gold_output": "48000\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils,Classes;\nvar\n n,k,x,y:Integer;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(n);\n Readln(k);\n Readln(x);\n Readln(y);\n\n Writeln(((n+k-abs(n-k))div 2 * x) + ((n-k+abs(n-k)) div 2 * y));//nとkの最小値*x、n-kと0の最大値*y\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\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "sample_input": "5\n3\n10000\n9000\n"}, "reference_outputs": ["48000\n"], "source_document_id": "p04011", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 458, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s433646521", "group_id": "codeNet:p04026", "input_text": "var\n n:ansistring;\n i:longint;\nbegin\n readln(n);\n for i:=1 to length(n) do\n begin\n if n[i]=n[i+1] then\n begin\n writeln(i,' ',i+1);exit;\n end;\n if n[i]=n[i+2] then\n begin\n writeln(i,' ',i+2);exit;\n end;\n end;\n writeln('-1 -1');\nend.", "language": "Pascal", "metadata": {"date": 1588902235, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04026.html", "problem_id": "p04026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04026/input.txt", "sample_output_relpath": "derived/input_output/data/p04026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04026/Pascal/s433646521.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s433646521", "user_id": "u263933075"}, "prompt_components": {"gold_output": "2 5\n", "input_to_evaluate": "var\n n:ansistring;\n i:longint;\nbegin\n readln(n);\n for i:=1 to length(n) do\n begin\n if n[i]=n[i+1] then\n begin\n writeln(i,' ',i+1);exit;\n end;\n if n[i]=n[i+2] then\n begin\n writeln(i,' ',i+2);exit;\n end;\n end;\n writeln('-1 -1');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "sample_input": "needed\n"}, "reference_outputs": ["2 5\n"], "source_document_id": "p04026", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 298, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s009731564", "group_id": "codeNet:p04026", "input_text": "var\n n:string;\n i:longint;\nbegin\n readln(n);\n for i:=1 to length(n) do\n begin\n if n[i]=n[i+1] then\n begin\n writeln(i+1,' ',i+2);exit;\n end;\n if n[i]=n[i+2] then\n begin\n writeln(i+1,' ',i+3);exit;\n end;\n end;\n writeln('-1 -1');\nend.", "language": "Pascal", "metadata": {"date": 1588902149, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04026.html", "problem_id": "p04026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04026/input.txt", "sample_output_relpath": "derived/input_output/data/p04026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04026/Pascal/s009731564.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s009731564", "user_id": "u247366051"}, "prompt_components": {"gold_output": "2 5\n", "input_to_evaluate": "var\n n:string;\n i:longint;\nbegin\n readln(n);\n for i:=1 to length(n) do\n begin\n if n[i]=n[i+1] then\n begin\n writeln(i+1,' ',i+2);exit;\n end;\n if n[i]=n[i+2] then\n begin\n writeln(i+1,' ',i+3);exit;\n end;\n end;\n writeln('-1 -1');\nend.", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "sample_input": "needed\n"}, "reference_outputs": ["2 5\n"], "source_document_id": "p04026", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 298, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s242216549", "group_id": "codeNet:p04026", "input_text": "var\n\ti:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=2 to length(s)do begin\n\t\tif s[i]=s[i-1]then begin\n\t\t\twriteln(i-1,' ',i);\n\t\t\texit;\n\t\tend;\n\t\tif s[i]=s[i-2]then begin\n\t\t\twriteln(i-2,' ',i);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('-1 -1');\nend.\n", "language": "Pascal", "metadata": {"date": 1541912073, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04026.html", "problem_id": "p04026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04026/input.txt", "sample_output_relpath": "derived/input_output/data/p04026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04026/Pascal/s242216549.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s242216549", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2 5\n", "input_to_evaluate": "var\n\ti:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=2 to length(s)do begin\n\t\tif s[i]=s[i-1]then begin\n\t\t\twriteln(i-1,' ',i);\n\t\t\texit;\n\t\tend;\n\t\tif s[i]=s[i-2]then begin\n\t\t\twriteln(i-2,' ',i);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('-1 -1');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "sample_input": "needed\n"}, "reference_outputs": ["2 5\n"], "source_document_id": "p04026", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s704433508", "group_id": "codeNet:p04026", "input_text": "var\n\ti:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=2 to length(s)do begin\n\t\tif s[i]=s[i-1]then begin\n\t\t\twriteln(i-1,' ',i);\n\t\t\texit;\n\t\tend;\n\t\tif(i>2)and(s[i]=s[i-2])then begin\n\t\t\twriteln(i-2,' ',i);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('-1 -1');\nend.\n", "language": "Pascal", "metadata": {"date": 1541912038, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04026.html", "problem_id": "p04026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04026/input.txt", "sample_output_relpath": "derived/input_output/data/p04026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04026/Pascal/s704433508.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s704433508", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2 5\n", "input_to_evaluate": "var\n\ti:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tfor i:=2 to length(s)do begin\n\t\tif s[i]=s[i-1]then begin\n\t\t\twriteln(i-1,' ',i);\n\t\t\texit;\n\t\tend;\n\t\tif(i>2)and(s[i]=s[i-2])then begin\n\t\t\twriteln(i-2,' ',i);\n\t\t\texit;\n\t\tend;\n\tend;\n\twriteln('-1 -1');\nend.\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "sample_input": "needed\n"}, "reference_outputs": ["2 5\n"], "source_document_id": "p04026", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 247, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s965947106", "group_id": "codeNet:p04026", "input_text": "var\n\tn,i:Longint;\n\ts:String;\nbegin\n\treadln(s);\n\tn:=length(s);\n\ti:=1;\n\twhile(i=length(s) div 2 then\n begin\n ch:=j;p:=1;\n break;\n end;\n if p=0 then writeln('-1 -1')\n else\n begin\n i:=1;\n while s[i]<>ch do inc(i);\n p:=length(s);\n while s[p]<>ch do dec(p); \n writeln(i,' ',p);\n end;\nend. ", "language": "Pascal", "metadata": {"date": 1538768669, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04026.html", "problem_id": "p04026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04026/input.txt", "sample_output_relpath": "derived/input_output/data/p04026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04026/Pascal/s158885526.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s158885526", "user_id": "u476418095"}, "prompt_components": {"gold_output": "2 5\n", "input_to_evaluate": "var\n i,p:longint;\n s:ansistring;\n j,ch:char;\n a:array['a'..'z'] of longint;\nbegin\n readln(s);\n for i:=1 to length(s) do \n inc(a[s[i]]);\n for j:='a' to 'z' do\n if a[j]>=length(s) div 2 then\n begin\n ch:=j;p:=1;\n break;\n end;\n if p=0 then writeln('-1 -1')\n else\n begin\n i:=1;\n while s[i]<>ch do inc(i);\n p:=length(s);\n while s[p]<>ch do dec(p); \n writeln(i,' ',p);\n end;\nend. ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "sample_input": "needed\n"}, "reference_outputs": ["2 5\n"], "source_document_id": "p04026", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.\n\nYou are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.\n\nConstraints\n\n2 ≦ |s| ≦ 10^5\n\ns consists of lowercase letters.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf there exists no unbalanced substring of s, print -1 -1.\n\nIf there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.\n\nSample Input 1\n\nneeded\n\nSample Output 1\n\n2 5\n\nThe string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.\n\nSample Input 2\n\natcoder\n\nSample Output 2\n\n-1 -1\n\nThe string atcoder contains no unbalanced substring.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s627690305", "group_id": "codeNet:p04029", "input_text": "var n,i,s:integer;\nbegin\n read(n);s:=0;\n for i:=1 to n do\n s:=s+i;\n write(s);\n readln;\nend.", "language": "Pascal", "metadata": {"date": 1471141033, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04029.html", "problem_id": "p04029", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04029/input.txt", "sample_output_relpath": "derived/input_output/data/p04029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04029/Pascal/s627690305.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s627690305", "user_id": "u006358909"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "var n,i,s:integer;\nbegin\n read(n);s:=0;\n for i:=1 to n do\n s:=s+i;\n write(s);\n readln;\nend.", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?\n\nConstraints\n\n1≦N≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the necessary number of candies in total.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nThe answer is 1+2+3=6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n55\n\nThe sum of the integers from 1 to 10 is 55.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nOnly one child. The answer is 1 in this case.", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p04029", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candies will be necessary in total?\n\nConstraints\n\n1≦N≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the necessary number of candies in total.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nThe answer is 1+2+3=6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n55\n\nThe sum of the integers from 1 to 10 is 55.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nOnly one child. The answer is 1 in this case.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s941471585", "group_id": "codeNet:p04030", "input_text": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,i:Integer;\n s,e:string;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(s);\n\n n:=1;\n for i := 1 to Length(s) do begin\n if s[i]='B' then begin\n if not(e='') then begin\n Delete(e, n-1, 1);\n n:=n-1;\n end;\n end else begin\n e:=e+s[i];\n inc(n);\n end;\n end;\n\n Writeln(e);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "language": "Pascal", "metadata": {"date": 1513809181, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04030.html", "problem_id": "p04030", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04030/input.txt", "sample_output_relpath": "derived/input_output/data/p04030/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04030/Pascal/s941471585.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s941471585", "user_id": "u755925739"}, "prompt_components": {"gold_output": "00\n", "input_to_evaluate": "program Project1;\n\n{$APPTYPE CONSOLE}\n\nuses\n SysUtils;\nvar\n n,i:Integer;\n s,e:string;\nbegin\n try\n { TODO -oUser -cConsole Main : ここにコードを記述してください }\n Readln(s);\n\n n:=1;\n for i := 1 to Length(s) do begin\n if s[i]='B' then begin\n if not(e='') then begin\n Delete(e, n-1, 1);\n n:=n-1;\n end;\n end else begin\n e:=e+s[i];\n inc(n);\n end;\n end;\n\n Writeln(e);\n Readln;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.\n\nTo begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:\n\nThe 0 key: a letter 0 will be inserted to the right of the string.\n\nThe 1 key: a letter 1 will be inserted to the right of the string.\n\nThe backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.\n\nSig has launched the editor, and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. In this string, the letter 0 stands for the 0 key, the letter 1 stands for the 1 key and the letter B stands for the backspace key. What string is displayed in the editor now?\n\nConstraints\n\n1 ≦ |s| ≦ 10 (|s| denotes the length of s)\n\ns consists of the letters 0, 1 and B.\n\nThe correct answer is not an empty string.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string displayed in the editor in the end.\n\nSample Input 1\n\n01B0\n\nSample Output 1\n\n00\n\nEach time the key is pressed, the string in the editor will change as follows: 0, 01, 0, 00.\n\nSample Input 2\n\n0BB1\n\nSample Output 2\n\n1\n\nEach time the key is pressed, the string in the editor will change as follows: 0, (empty), (empty), 1.", "sample_input": "01B0\n"}, "reference_outputs": ["00\n"], "source_document_id": "p04030", "source_text": "Score : 200 points\n\nProblem Statement\n\nSig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.\n\nTo begin with, he is using a plain text editor with this keyboard. This editor always displays one string (possibly empty). Just after the editor is launched, this string is empty. When each key on the keyboard is pressed, the following changes occur to the string:\n\nThe 0 key: a letter 0 will be inserted to the right of the string.\n\nThe 1 key: a letter 1 will be inserted to the right of the string.\n\nThe backspace key: if the string is empty, nothing happens. Otherwise, the rightmost letter of the string is deleted.\n\nSig has launched the editor, and pressed these keys several times. You are given a string s, which is a record of his keystrokes in order. In this string, the letter 0 stands for the 0 key, the letter 1 stands for the 1 key and the letter B stands for the backspace key. What string is displayed in the editor now?\n\nConstraints\n\n1 ≦ |s| ≦ 10 (|s| denotes the length of s)\n\ns consists of the letters 0, 1 and B.\n\nThe correct answer is not an empty string.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string displayed in the editor in the end.\n\nSample Input 1\n\n01B0\n\nSample Output 1\n\n00\n\nEach time the key is pressed, the string in the editor will change as follows: 0, 01, 0, 00.\n\nSample Input 2\n\n0BB1\n\nSample Output 2\n\n1\n\nEach time the key is pressed, the string in the editor will change as follows: 0, (empty), (empty), 1.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 562, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s135116831", "group_id": "codeNet:p04033", "input_text": "var\ni,a,b,s:longint;\nbegin\ns:=1;\nread(a,b);\nfor i:=a to b do\ns:=s*i;\nif s=0 then writeln('Zero')\nelse if s<0 then writeln('Negative')\nelse writeln('Positive');\nend.\n", "language": "Pascal", "metadata": {"date": 1534446095, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04033.html", "problem_id": "p04033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04033/input.txt", "sample_output_relpath": "derived/input_output/data/p04033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04033/Pascal/s135116831.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s135116831", "user_id": "u263933075"}, "prompt_components": {"gold_output": "Positive\n", "input_to_evaluate": "var\ni,a,b,s:longint;\nbegin\ns:=1;\nread(a,b);\nfor i:=a to b do\ns:=s*i;\nif s=0 then writeln('Zero')\nelse if s<0 then writeln('Negative')\nelse writeln('Positive');\nend.\n", "problem_context": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "sample_input": "1 3\n"}, "reference_outputs": ["Positive\n"], "source_document_id": "p04033", "source_text": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 2103, "memory_kb": 128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s482184112", "group_id": "codeNet:p04034", "input_text": "var N,M,i,c,x,y:Longint;\nA,B:Array[1..100000]of Longint;\nbegin\nread(N,M);\nfor i:=1 to N do A[i]:=1;\nB[1]:=1;\nfor i:=1 to M do begin\nread(x,y);\ndec(A[x]);\ninc(A[y]);\nif B[x]=1 then B[y]:=1;\nif A[x]=0 then B[x]:=0;\nend;\nfor i:=1 to N do inc(c,B[i]);\nwriteln(c);\nend.\n", "language": "Pascal", "metadata": {"date": 1579566033, "filename_ext": "pas", "original_language": "Pascal (FPC 2.6.2)", "problem_description_relpath": "problem_descriptions/p04034.html", "problem_id": "p04034", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04034/input.txt", "sample_output_relpath": "derived/input_output/data/p04034/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04034/Pascal/s482184112.pas", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s482184112", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "var N,M,i,c,x,y:Longint;\nA,B:Array[1..100000]of Longint;\nbegin\nread(N,M);\nfor i:=1 to N do A[i]:=1;\nB[1]:=1;\nfor i:=1 to M do begin\nread(x,y);\ndec(A[x]);\ninc(A[y]);\nif B[x]=1 then B[y]:=1;\nif A[x]=0 then B[x]:=0;\nend;\nfor i:=1 to N do inc(c,B[i]);\nwriteln(c);\nend.\n", "problem_context": "Problem Statement\n\nWe have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.\n\nSnuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.\n\nFind the number of boxes that may contain the red ball after all operations are performed.\n\nConstraints\n\n2≤N≤10^5\n\n1≤M≤10^5\n\n1≤x_i,y_i≤N\n\nx_i≠y_i\n\nJust before the i-th operation is performed, box x_i contains at least 1 ball.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nx_1 y_1\n:\nx_M y_M\n\nOutput\n\nPrint the number of boxes that may contain the red ball after all operations are performed.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\n2\n\nJust after the first operation, box 1 is empty, box 2 contains one red ball and one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2, the red ball will go into box 3. If he picks the white ball instead, the red ball will stay in box 2.\nThus, the number of boxes that may contain the red ball after all operations, is 2.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n2 3\n\nSample Output 2\n\n1\n\nAll balls will go into box 3.\n\nSample Input 3\n\n4 4\n1 2\n2 3\n4 1\n3 4\n\nSample Output 3\n\n3", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p04034", "source_text": "Problem Statement\n\nWe have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.\n\nSnuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.\n\nFind the number of boxes that may contain the red ball after all operations are performed.\n\nConstraints\n\n2≤N≤10^5\n\n1≤M≤10^5\n\n1≤x_i,y_i≤N\n\nx_i≠y_i\n\nJust before the i-th operation is performed, box x_i contains at least 1 ball.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nx_1 y_1\n:\nx_M y_M\n\nOutput\n\nPrint the number of boxes that may contain the red ball after all operations are performed.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\n2\n\nJust after the first operation, box 1 is empty, box 2 contains one red ball and one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2, the red ball will go into box 3. If he picks the white ball instead, the red ball will stay in box 2.\nThus, the number of boxes that may contain the red ball after all operations, is 2.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n2 3\n\nSample Output 2\n\n1\n\nAll balls will go into box 3.\n\nSample Input 3\n\n4 4\n1 2\n2 3\n4 1\n3 4\n\nSample Output 3\n\n3", "split": "validation", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 265, "cpu_time_ms": 23, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Pascal:s375759417", "group_id": "codeNet:p04047", "input_text": "uses math;\nvar\n n,i,j,s,t:longint;\n a:array[1..100]of longint;\nbegin\n readln(n);\n for i:=1 to n*2 do read(a[i]);\n for i:=1 to n*2-1 do\n for j:=i+1 to n*2 do\n if a[i]x do\n inc(i);\n while x>a[j] do\n dec(j);\n if not(i>j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if lx do\n inc(i);\n while x>a[j] do\n dec(j);\n if not(i>j) then\n begin\n y:=a[i];\n a[i]:=a[j];\n a[j]:=y;\n inc(i);\n j:=j-1;\n end;\n until i>j;\n if l